/* Car Maintenance Tracker — shared styles for Login.html and App.html */

* { box-sizing: border-box; }

:root {
    --bg: #f2f4f6;
    --panel: #ffffff;
    --border: #d8dee4;
    --text: #23282d;
    --text-muted: #68737d;
    --primary: #2563ab;
    --primary-dark: #1c4d84;
    --danger: #b3372f;
    --safe: #2e9e5b;
    --level: #e07b2a;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

h1, h2, h3 { margin: 0 0 12px; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

button {
    font: inherit;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    border: 1px solid transparent;
}
button:disabled { opacity: 0.6; cursor: not-allowed; }

.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--primary-dark); }
.button-secondary { background: var(--panel); color: var(--text); border-color: var(--border); }
.button-secondary:hover:not(:disabled) { background: var(--bg); }
.button-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.button-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], select {
    font: inherit;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.empty-note { color: var(--text-muted); font-style: italic; }
.error-note { color: var(--danger); }
.info-note { color: var(--safe); }

/* --- header + layout --- */

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
}
.app-header h1 { margin: 0; }
.header-user { display: flex; align-items: center; gap: 12px; color: var(--text-muted); }

.app-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}
@media (max-width: 760px) {
    .app-layout { grid-template-columns: 1fr; }
}

/* --- sidebar --- */

.sidebar {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    align-self: start;
}

.car-list { list-style: none; margin: 0 0 20px; padding: 0; }
.car-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
}
.car-item:hover { background: var(--bg); }
.car-item.selected { background: #e3ecf6; }
.car-item .car-sub { flex: 1; }
.car-count { color: var(--text-muted); font-size: 13px; white-space: nowrap; }

.license-plate {
    font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
    font-weight: 700;
    background: #f6c944;
    border: 1px solid #b89a2d;
    border-radius: 4px;
    padding: 1px 7px;
    white-space: nowrap;
}
.license-plate.large { font-size: 22px; padding: 3px 12px; }

.car-sub { color: var(--text-muted); font-size: 13px; }

.add-car-form { display: flex; flex-direction: column; gap: 8px; }

/* --- car detail --- */

.car-detail {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    min-height: 300px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 20px;
}

.upload-form {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 24px;
    background: var(--bg);
}
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: end;
}
.form-row label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--text-muted);
}
.form-row .checkbox-label { flex-direction: row; align-items: center; padding-bottom: 8px; }
.mileage-group { display: flex; gap: 6px; }
.mileage-group input { width: 110px; }
.mileage-group select { width: auto; }

/* --- measurement cards --- */

.measurement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.measurement-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.photo-slot {
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #10151a;
}
.photo-slot img { max-width: 100%; max-height: 100%; object-fit: contain; }

.measurement-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    font-size: 14px;
}
.measurement-date { font-weight: 600; }
.level-readout { color: var(--text-muted); font-size: 13px; }

.badge {
    align-self: start;
    font-size: 12px;
    padding: 1px 8px;
    border-radius: 999px;
    color: #fff;
}
.badge-warm { background: var(--level); }
.badge-cold { background: var(--primary); }

.measurement-edit {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.measurement-edit .checkbox-label { display: flex; flex-direction: row; align-items: center; gap: 6px; }
.measurement-edit .edit-buttons { display: flex; gap: 8px; margin-top: 4px; }

.measurement-actions {
    display: flex;
    gap: 8px;
    padding: 0 12px 12px;
    margin-top: auto;
}

/* --- maintenance activity log --- */

.activity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.activity-table th, .activity-table td {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}
.activity-table th { font-weight: 600; color: var(--text-muted); }
.activity-row-actions { text-align: right; white-space: nowrap; }
.activity-row-actions button { margin-left: 8px; }

/* --- annotator overlay --- */

.annotator-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 18, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.annotator-dialog {
    background: var(--panel);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    width: min(96vw, 1000px);
    height: min(94vh, 820px);
    overflow: hidden;
}

.annotator-toolbar, .annotator-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    flex-wrap: wrap;
}
.annotator-toolbar { border-bottom: 1px solid var(--border); }
.annotator-footer { border-top: 1px solid var(--border); justify-content: space-between; }

.annotator-title { font-weight: 700; }
.annotator-modes { display: flex; gap: 8px; }
.mode-button {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--panel);
    border-color: var(--border);
}
.mode-button.active { outline: 2px solid var(--primary); }
.line-swatch { width: 18px; height: 4px; border-radius: 2px; display: inline-block; }

.annotator-readout { margin-left: auto; font-weight: 600; color: var(--safe); }

.annotator-canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #10151a;
    overflow: hidden;
    min-height: 0;
}
.annotator-canvas-wrap canvas { touch-action: none; cursor: crosshair; }

.annotator-hint { color: var(--text-muted); font-size: 13px; }
.annotator-actions { display: flex; gap: 8px; }

/* --- login page --- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 36px;
    width: min(92vw, 380px);
}
.login-container h1 { text-align: center; margin-bottom: 24px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 14px; color: var(--text-muted); }

.login-button { width: 100%; padding: 11px; margin-top: 4px; }

.auth-toggle { text-align: center; color: var(--text-muted); font-size: 14px; }
.auth-toggle a { color: var(--primary); }
