/* ═══════════════════════════════════════════════════════
   VMC Workshop — Web App Styles
   Dark theme with orange branding (matches mobile app)
   ═══════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────── */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1e2a45;
    --bg-input: #0f1729;
    --bg-modal: #1a1a2e;
    --text-primary: #e0e0e0;
    --text-secondary: #8892a4;
    --text-muted: #5a6478;
    --accent: #e87a2e;
    --accent-hover: #f5922e;
    --accent-light: rgba(232, 122, 46, 0.15);
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --success: #27ae60;
    --warning: #f39c12;
    --border: #2a3550;
    --border-light: #1e2a45;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
    height: 100%;
    font-family: var(--font);
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Utility Classes ──────────────────────────────── */

.hidden { display: none !important; }
.screen { display: none; }
.screen.active { display: flex; }

/* ── Login Screen ─────────────────────────────────── */

#login-screen {
    height: 100vh;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.login-container {
    width: 100%;
    max-width: 380px;
    padding: 40px 32px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo h1 {
    font-size: 48px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 4px;
    margin-bottom: 0;
}

.login-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.error-text {
    color: var(--danger);
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
}

/* ── Buttons ──────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 13px;
}

.btn-ghost:hover {
    color: var(--accent);
}

.btn-full {
    width: 100%;
    padding: 14px;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 28px;
    font-weight: 300;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

/* ── App Shell ────────────────────────────────────── */

#app-shell {
    display: none;
    flex-direction: column;
    height: 100vh;
}

#app-shell.active {
    display: flex;
}

/* ── Top Bar ──────────────────────────────────────── */

#top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#top-bar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
}

#top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

#user-name {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ── Tab Navigation ───────────────────────────────── */

#tab-nav {
    display: flex;
    gap: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    flex-shrink: 0;
}

#tab-nav .tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#tab-nav .tab-btn:hover {
    color: var(--text-primary);
}

#tab-nav .tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── Loading Spinner ──────────────────────────────── */

#loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Stats Bar ────────────────────────────────────── */

.stats-bar {
    display: flex;
    gap: 16px;
    padding: 20px 24px;
    flex-shrink: 0;
}

.stat-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ── Views Container ──────────────────────────────── */

.view {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
}

/* ── Vehicle Sections & Cards ─────────────────────── */

.vehicle-section {
    margin-top: 20px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vehicle-card {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
    gap: 14px;
}

.vehicle-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.vehicle-card .card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.vehicle-card .card-info {
    flex: 1;
    min-width: 0;
}

.vehicle-card .card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vehicle-card .card-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.vehicle-card .card-meta {
    text-align: right;
    flex-shrink: 0;
}

.vehicle-card .card-date {
    font-size: 11px;
    color: var(--text-muted);
}

.vehicle-card .card-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.badge-action { background: rgba(231, 76, 60, 0.2); color: #e74c3c; }
.badge-progress { background: rgba(243, 156, 18, 0.2); color: #f39c12; }
.badge-completed { background: rgba(39, 174, 96, 0.2); color: #27ae60; }
.badge-pending { background: rgba(232, 122, 46, 0.2); color: #e87a2e; }
.badge-scheduled { background: rgba(52, 152, 219, 0.2); color: #3498db; }
.badge-waiting { background: rgba(155, 89, 182, 0.2); color: #9b59b6; }

/* ── Kanban Board ─────────────────────────────────── */

.kanban-board {
    display: flex;
    gap: 16px;
    padding: 20px 0;
    overflow-x: auto;
    height: 100%;
    align-items: flex-start;
}

.kanban-column {
    min-width: 260px;
    max-width: 300px;
    flex: 1;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.column-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px 10px;
    flex-shrink: 0;
}

.column-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 10px 14px;
    overflow-y: auto;
    flex: 1;
}

.kanban-card {
    padding: 12px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
}

.kanban-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.kanban-card .kc-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.kanban-card .kc-sub {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.kanban-card .kc-tags {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.kanban-card .kc-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 500;
}

.kc-tag.warranty { background: rgba(39, 174, 96, 0.15); color: var(--success); }
.kc-tag.loan-car { background: rgba(52, 152, 219, 0.15); color: #3498db; }

/* ── Filter Tabs (Mechanic) ───────────────────────── */

.filter-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 0 12px;
}

.filter-tab {
    padding: 8px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-tab:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.filter-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Modal ────────────────────────────────────────── */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-modal);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 28px;
    box-shadow: var(--shadow-lg);
    z-index: 1;
}

.modal-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.add-type-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.add-type-buttons .btn {
    flex: 1;
}

/* ── Detail Modal Content ─────────────────────────── */

.detail-header {
    margin-bottom: 20px;
}

.detail-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.detail-header .detail-rego {
    font-size: 14px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 2px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.detail-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.detail-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

/* ── Context Menu ─────────────────────────────────── */

.context-menu {
    position: fixed;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 4px 0;
    min-width: 160px;
}

.context-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition);
}

.context-item:hover {
    background: var(--accent-light);
}

.context-item.danger {
    color: var(--danger);
}

.context-item.danger:hover {
    background: rgba(231, 76, 60, 0.15);
}

/* ── Empty State ──────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ── Responsive ───────────────────────────────────── */

@media (max-width: 768px) {
    .stats-bar {
        padding: 14px 16px;
        gap: 10px;
    }

    .stat-card {
        padding: 12px 8px;
    }

    .stat-value {
        font-size: 22px;
    }

    .view {
        padding: 0 16px 16px;
    }

    .kanban-board {
        gap: 12px;
        padding: 14px 0;
    }

    .kanban-column {
        min-width: 220px;
    }

    #top-bar {
        padding: 12px 16px;
    }

    #tab-nav {
        padding: 0 16px;
        overflow-x: auto;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .login-container {
        margin: 0 16px;
        padding: 32px 24px;
    }

    .add-type-buttons {
        flex-direction: column;
    }
}
