/* DRVN - Garage Management System Styles */
/* v3.9.8 - Image Lightbox & Print Fix */

/* ==========================================
   NATIVE APP FEEL - iOS Optimizations
   ========================================== */

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    overscroll-behavior: none;
}

/* Prevent text selection everywhere (native apps don't select text) */
body {
    -webkit-user-select: none;
    user-select: none;
}

/* Allow text selection only in input fields */
input, textarea, [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
}

/* Prevent long-press image save dialog */
img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

/* But allow clickable images */
a img, button img, [onclick] img, img[onclick], img.cursor-pointer, .lightbox-thumb, .edit-lightbox-thumb {
    pointer-events: auto;
}

button, a, [onclick] {
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}


/* ==========================================
   MODAL ANIMATIONS - Slide Up from Bottom
   ========================================== */

@keyframes modalSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0.5;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* Modal backdrop fade */
#carModal:not(.hidden),
#accountModal:not(.hidden),
#calendarModal:not(.hidden),
#carSelectorModal:not(.hidden),
#sparePartsModal:not(.hidden),
#advancedSearchModal:not(.hidden),
#backupModal:not(.hidden),
#dashboardModal:not(.hidden) {
    animation: modalFadeIn 0.25s ease-out;
}

/* Modal content slide up */
#carModal:not(.hidden) > div,
#accountModal:not(.hidden) > div,
#calendarModal:not(.hidden) > div,
#carSelectorModal:not(.hidden) > div,
#sparePartsModal:not(.hidden) > div,
#advancedSearchModal:not(.hidden) > div,
#backupModal:not(.hidden) > div,
#dashboardModal:not(.hidden) > div {
    animation: modalSlideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

/* ==========================================
   SECTION TRANSITIONS - Smooth fade between views
   ========================================== */

#carsGrid, #dashboardContent, #calendarContent {
    transition: opacity 0.2s ease;
}

/* Prevent double-tap zoom on buttons */
button {
    touch-action: manipulation;
}

/* Ensure hidden modals don't receive any events */
.hidden {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Prevent body scroll and interaction when modal is open */
body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    touch-action: none !important;
}

body.modal-open #mainApp,
body.modal-open #carsGrid,
body.modal-open .mobile-bottom-nav,
body.modal-open .fab-button {
    pointer-events: none !important;
    user-select: none !important;
}

/* Hide FAB and bottom nav completely when any modal is open */
body.modal-open .fab-button,
body.modal-open .mobile-bottom-nav {
    opacity: 0 !important;
    transform: translateY(100px) !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important;
}

/* Hide bottom nav and FAB when sidebar is open */
.mobile-bottom-nav.nav-hidden {
    transform: translateY(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: transform 0.3s ease, opacity 0.3s ease !important;
}

.fab-button.fab-hidden {
    transform: translateY(200%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: transform 0.3s ease, opacity 0.3s ease !important;
}

/* Normal state handled by base styles (lines 398+ and 494+) */
/* Modal-open hiding is handled above (lines 45-50) */
/* Scroll hiding uses .hidden-scroll class (line 419) */
/* Sidebar hiding uses .nav-hidden / .fab-hidden classes (lines 53-65) */

:root {
    --primary: #f59e0b;
    --primary-dark: #d97706;
    --primary-light: #fbbf24;
    --secondary: #0f172a;
    --secondary-light: #1e293b;
    --accent: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 6px 12px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.15);
    --shadow-xl: 0 20px 40px -10px rgb(0 0 0 / 0.2);

    /* Light Mode Colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --card-bg: #1e293b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-md: 0 6px 12px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.5);
    --shadow-xl: 0 20px 40px -10px rgb(0 0 0 / 0.6);
}

/* Dark Mode - Text Colors Override */
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3 {
    color: #f8fafc !important;
}

[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] label {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .text-gray-600 {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .text-gray-500 {
    color: #94a3b8 !important;
}

[data-theme="dark"] .text-gray-400 {
    color: #64748b !important;
}

/* Dark Mode - Background Colors */
[data-theme="dark"] .bg-white {
    background-color: #1e293b !important;
}

[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-gray-100 {
    background-color: #334155 !important;
}

/* Dark Mode - Borders */
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-300 {
    border-color: #475569 !important;
}

/* Dark Mode - Inputs */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #334155 !important;
    color: #f8fafc !important;
    border-color: #475569 !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] select::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #94a3b8 !important;
}

/* Dark Mode - Modal */
[data-theme="dark"] .modal-content,
[data-theme="dark"] #carModal > div,
[data-theme="dark"] #carSelectorModal > div {
    background-color: #1e293b !important;
}

/* Dark Mode - Cards remain visible */
[data-theme="dark"] .card {
    background-color: #1e293b !important;
    border-color: #475569 !important;
}

/* Dark Mode - Amber colors remain visible */
[data-theme="dark"] .text-amber-600,
[data-theme="dark"] .text-amber-700,
[data-theme="dark"] .text-amber-800 {
    /* Keep amber colors as they are visible in dark mode */
}

/* Dark Mode - Select elements */
[data-theme="dark"] select option {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}


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

/* Safe area spacer for status bar */
.safe-area-spacer {
    height: env(safe-area-inset-top, 0px);
    background: var(--card-bg);
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
}

body {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s ease, color 0.3s ease;
    /* Padding for safe area */
    padding-top: env(safe-area-inset-top, 0px);
    /* Prevent overscroll bounce/flash */
    overscroll-behavior: none;
}

/* Dark Mode Toggle Button */
.theme-toggle {
    position: relative;
    width: 60px;
    height: 32px;
    background: var(--bg-tertiary);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 4px;
    flex-shrink: 0;
    overflow: hidden;
}

.theme-toggle-slider {
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    will-change: transform;
    position: absolute;
    left: 4px;
}

[data-theme="dark"] .theme-toggle-slider {
    transform: translateX(28px);
    left: 4px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Hide desktop header buttons on mobile */
    .header-buttons {
        display: none !important;
    }

    /* Search box container - smaller and hide on scroll */
    .search-container {
        transition: all 0.3s ease;
        margin-top: 0.5rem !important;
    }

    .search-container.hidden-scroll {
        opacity: 0;
        max-height: 0;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        pointer-events: none;
    }

    .search-container input {
        padding: 0.5rem 1rem !important;
        font-size: 14px !important;
    }

    /* Mobile Header Compact */
    .app-header .container {
        padding: 0.75rem 1rem;
    }

    .app-header h1 {
        font-size: 1.25rem;
    }

    .app-header p {
        font-size: 0.75rem;
    }

    /* Mobile Bottom Navigation */
    .mobile-bottom-nav {
        display: flex !important;
    }

    /* FAB Button */
    .fab-button {
        display: flex !important;
    }

    /* Add padding for bottom nav */
    #mainApp {
        padding-bottom: 80px;
    }

    .logo-badge {
        width: 48px;
        height: 48px;
    }

    .logo-badge span {
        font-size: 1.5rem;
    }

    .user-badge {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .theme-toggle {
        width: 56px;
        height: 30px;
    }

    .theme-toggle-slider {
        width: 22px;
        height: 22px;
        font-size: 11px;
        left: 3px;
    }

    [data-theme="dark"] .theme-toggle-slider {
        transform: translateX(26px);
        left: 3px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .card {
        border-radius: 12px;
    }

    .card .info-item {
        font-size: 0.8rem;
    }
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 8px 0 max(env(safe-area-inset-bottom, 8px), 12px) 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-bottom-nav.hide-on-modal {
    transform: translateY(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.mobile-bottom-nav.hidden-scroll {
    transform: translateY(100%) !important;
}

[data-theme="dark"] .mobile-bottom-nav {
    background: #1e293b;
    border-top-color: #334155;
}

.mobile-bottom-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
    margin: 0 auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 12px;
    min-width: 56px;
    position: relative;
}

.nav-item:active {
    transform: scale(0.92);
}

.nav-item-icon {
    font-size: 1.4rem;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.nav-item.active .nav-item-icon {
    opacity: 1;
    transform: scale(1.1);
}

.nav-item-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: #94a3b8;
    transition: all 0.2s ease;
}

[data-theme="dark"] .nav-item-label {
    color: #64748b;
}

.nav-item.active .nav-item-label {
    color: #f59e0b;
    font-weight: 700;
}

/* Active indicator dot */
.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #f59e0b;
    border-radius: 50%;
}

/* Floating Action Button */
.fab-button {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(245,158,11,0.4);
    cursor: pointer;
    z-index: 999;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-button.hide-on-modal {
    opacity: 0;
    pointer-events: none;
    transform: translateY(100px);
}

.fab-button:active {
    transform: scale(0.9) translateY(0);
}

.fab-button:hover {
    box-shadow: 0 12px 32px rgba(245,158,11,0.5);
    transform: scale(1.05);
}

/* Mobile Quick Actions */
.mobile-quick-actions {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.quick-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.quick-action-btn:active {
    transform: none;
}

@media (min-width: 769px) {
    .mobile-quick-actions {
        display: none;
    }
}

@media (max-width: 640px) {
    .app-header {
        padding: 0.75rem 0;
    }

    .header-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .user-badge span:not(.text-lg) {
        display: none;
    }

    .header-buttons .btn-danger {
        padding: 0.5rem 0.75rem;
    }

    .header-buttons .btn-danger span {
        display: none;
    }

    .header-buttons .btn-danger::after {
        content: '⬅';
    }

    .header-buttons {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .header-buttons .btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
    }
}

/* ===== Calendar Modern Styles ===== */
.calendar-modal-content {
    padding: 0 !important;
}

.calendar-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.calendar-nav-btn {
    background: var(--gray-100);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav-btn:hover {
    background: var(--primary);
    color: white;
}

.calendar-month-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.calendar-day-names {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 12px 16px 8px;
    background: var(--gray-50);
}

.calendar-day-name {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    padding: 4px;
}

#calendarGrid {
    gap: 4px;
    padding: 8px 16px 16px;
    background: var(--gray-50);
}

#calendarGrid > div {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    position: relative;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    border: 2px solid transparent;
}

#calendarGrid > div:hover {
    background: var(--gray-100);
    transform: scale(1.05);
}

#calendarGrid > div.today {
    background: var(--primary) !important;
    color: white !important;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

#calendarGrid > div.selected {
    border-color: var(--primary) !important;
    border-width: 3px !important;
    background: var(--primary-light) !important;
    color: var(--secondary) !important;
    font-weight: 700;
}

#calendarGrid > div.selected.today {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary-dark) !important;
}

#calendarGrid > div.has-appointments {
    background: #fef3c7 !important;
    color: #d97706 !important;
}

#calendarGrid > div.has-appointments.today {
    background: var(--primary) !important;
    color: white !important;
}

#calendarGrid > div.has-appointments.selected {
    background: #fde68a !important;
    border-color: var(--primary) !important;
}

#calendarGrid > div.has-appointments::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 5px;
    height: 5px;
    background: #ef4444;
    border-radius: 50%;
}

#calendarGrid > div.has-appointments.today::after,
#calendarGrid > div.has-appointments.selected.today::after {
    background: white;
}

.appointments-section {
    padding: 20px;
    background: white;
    border-top: 1px solid var(--border-color);
}

.appointments-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.appointment-card {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    border-right: 4px solid var(--primary);
    transition: all 0.2s;
}

.appointment-card:hover {
    background: var(--gray-100);
    transform: translateX(-4px);
}

.appointment-time {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.appointment-info {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}

.appointment-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.appointment-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.appointment-action-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.appointment-action-btn.edit {
    background: #dbeafe;
    color: #2563eb;
}

.appointment-action-btn.edit:hover {
    background: #2563eb;
    color: white;
}

.appointment-action-btn.delete {
    background: #fee2e2;
    color: #dc2626;
}

.appointment-action-btn.delete:hover {
    background: #dc2626;
    color: white;
}

.appointment-action-btn.whatsapp {
    background: #dcfce7;
    color: #16a34a;
}

.appointment-action-btn.whatsapp:hover {
    background: #16a34a;
    color: white;
}

.no-appointments {
    text-align: center;
    padding: 30px;
    color: var(--text-tertiary);
}

.no-appointments-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

@media (max-width: 480px) {
    .logo-badge {
        width: 40px;
        height: 40px;
    }

    .logo-badge span {
        font-size: 1.25rem;
    }

    .app-header h1 {
        font-size: 1rem;
    }

    .app-header p {
        display: none;
    }

    .theme-toggle {
        width: 52px;
        height: 28px;
    }

    .theme-toggle-slider {
        width: 20px;
        height: 20px;
        font-size: 10px;
        left: 3px;
    }

    [data-theme="dark"] .theme-toggle-slider {
        transform: translateX(24px);
        left: 3px;
    }

    .user-badge {
        padding: 0.375rem 0.5rem;
    }

    .header-buttons {
        grid-template-columns: 1fr;
    }

    /* Modal improvements for mobile */
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }

    /* Form inputs on mobile */
    input, select, textarea {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }

    /* Button grid on mobile */
    .grid.grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    /* Card padding on mobile */
    .card > div {
        padding: 1rem;
    }

    /* Search bar on mobile */
    #searchInput {
        font-size: 16px;
    }

    /* Image upload on mobile */
    label[for="carImage"] {
        padding: 3rem 1.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
        touch-action: manipulation;
        min-height: 220px !important;
        border-width: 5px !important;
    }

    label[for="carImage"] svg {
        width: 4rem !important;
        height: 4rem !important;
    }

    label[for="carImage"] div {
        font-size: 1.3rem !important;
    }

    #imagePreview img {
        width: 100% !important;
        height: auto !important;
        max-width: 300px;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .app-header {
        position: relative;
    }

    .modal-content {
        max-height: calc(100vh - 1rem);
        overflow-y: auto;
    }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    /* Remove iOS tap highlight */
    .btn,
    .card,
    .quick-action-btn,
    .nav-item,
    button,
    a {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none;
        outline: none !important;
    }

    .btn {
        min-height: 44px; /* Apple's recommended touch target */
        min-width: 44px;
    }

    .theme-toggle {
        min-height: 44px;
        width: 70px;
    }

    .card:active {
        transform: none;
    }

    .btn:active {
        transform: none;
    }

    /* Better touch target for file input */
    label[for="carImage"] {
        min-height: 200px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* Loading Animation */
.loader {
    width: 60px;
    height: 60px;
    border: 5px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Card Styles */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

@media (hover: hover) {
    .card {
        transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    }
    .card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
        border-color: var(--primary-light);
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    outline: none;
}

@media (hover: hover) {
    .btn {
        position: relative;
        overflow: hidden;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
}

@media (hover: hover) {
    .btn::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
    }

    .btn:active::before {
        width: 300px;
        height: 300px;
    }
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-dark {
    background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
    color: var(--white);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

@media (hover: hover) {
    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    }
    .btn-secondary:hover {
        border-color: var(--primary);
        background: var(--bg-tertiary);
        transform: translateY(-2px);
    }
    .btn-dark:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }
    .btn-success:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
    }
    .btn-danger:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
    }
}

/* ========== SIDEBAR MENU ========== */
.sidebar {
    position: fixed;
    right: -320px;
    top: 0;
    width: 320px;
    height: 100%;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    box-shadow: -5px 0 25px rgba(0,0,0,0.3);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    /* Safe area padding */
    padding-top: env(safe-area-inset-top, 0px);
}

body.sidebar-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}

.sidebar.open {
    right: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(245, 158, 11, 0.1);
    border-bottom: 2px solid #f59e0b;
}

.sidebar-content {
    padding: 0;
}

.sidebar-user-info {
    text-align: center;
    padding: 30px 20px;
    background: rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: white;
}

.sidebar-subscription {
    text-align: center;
    padding: 15px;
    background: rgba(34, 197, 94, 0.1);
    border-bottom: 1px solid rgba(34, 197, 94, 0.2);
    margin: 10px;
    border-radius: 10px;
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 20px;
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    font-weight: 500;
    text-align: right;
    cursor: pointer;
    transition: all 0.2s;
    border-right: 4px solid transparent;
}

.sidebar-menu-item:hover {
    background: rgba(245, 158, 11, 0.15);
    border-right-color: #f59e0b;
    padding-right: 25px;
}

.sidebar-icon {
    font-size: 24px;
    width: 30px;
    text-align: center;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 10px 20px;
}

.sidebar-logout {
    color: #ef4444;
    margin-top: 10px;
}

.sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    border-right-color: #ef4444;
}

.hamburger-menu {
    font-size: 24px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dark mode adjustments */
[data-theme="dark"] .sidebar {
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
}

/* Header */
.app-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 40;
    /* Safe area padding for notch/status bar */
    padding-top: env(safe-area-inset-top, 0px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-header.hidden-scroll {
    transform: translateY(-100%);
}

.header-accent {
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary) 100%);
}

/* Logo Badge */
.logo-badge {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* User Badge */
.user-badge {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.625rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Input Styles */
input, select, textarea {
    transition: all 0.2s ease;
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1) !important;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
}

.badge-primary {
    background: rgba(245, 158, 11, 0.1);
    color: var(--primary-dark);
}

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

/* Status Badges */
.status-waiting {
    background: rgba(234, 179, 8, 0.1);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.status-progress {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.status-ready {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-completed {
    background: rgba(100, 116, 139, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

/* Modal Backdrop */
.modal-backdrop {
    backdrop-filter: blur(8px);
    background: rgba(15, 23, 42, 0.5);
    animation: fadeIn 0.2s ease;
    padding-top: env(safe-area-inset-top, 0px);
}

[data-theme="dark"] .modal-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

/* Info Item */
.info-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 0.5rem 0;
}

.info-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Car Image */
.car-image {
    aspect-ratio: 16/9;
    object-fit: cover;
    width: 100%;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.car-image-placeholder {
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.car-image-placeholder:hover {
    background: var(--bg-primary);
}

/* Design 1: Electric Vehicle Style Card */
.card-ev-style {
    background: var(--card-bg);
    border-radius: 16px !important;
    border: 2px solid #e5e7eb !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
    overflow: hidden;
    transition: all 0.3s ease;
}

[data-theme="dark"] .card-ev-style {
    border-color: #374151 !important;
}

.card-ev-style:hover {
    transform: translateY(-2px);
    border-color: #f59e0b !important;
    box-shadow: 0 8px 24px rgba(245,158,11,0.15) !important;
}

.ev-card-content {
    padding: 1.25rem;
}

.ev-plate-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    letter-spacing: 1px;
}

.ev-owner-name {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.ev-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
}

.ev-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem;
}

.ev-info-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.ev-info-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ev-info-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ev-main-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.ev-main-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.ev-main-btn:active {
    transform: scale(0.98);
}

.ev-secondary-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.ev-action-btn {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: none;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ev-action-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.ev-action-btn.danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

[data-theme="dark"] .ev-action-btn.danger:hover {
    background: rgba(220, 38, 38, 0.2);
}

.ev-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Design 2: Classic Simple Card */
.card-classic {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.2s ease;
}

.card-classic:active {
    transform: scale(0.98);
}

.classic-no-image {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 1.5rem;
    opacity: 0.3;
    cursor: pointer;
}

.classic-content {
    padding: 1rem;
}

.classic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.classic-plate {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
}

.classic-status {
    font-size: 1rem;
}

.classic-owner {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.classic-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.classic-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-secondary);
}

.classic-actions {
    display: flex;
    gap: 0.5rem;
}

.classic-btn {
    flex: 1;
    padding: 0.6rem 0.5rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}

.classic-btn:active {
    transform: scale(0.95);
}

.classic-btn.primary {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    border: none;
}

.classic-btn.call {
    flex: 0;
    padding: 0.6rem 0.75rem;
    background: #22c55e;
    color: white;
    border: none;
}

.classic-btn.danger {
    flex: 0;
    padding: 0.6rem 0.75rem;
    color: #ef4444;
    border-color: #fecaca;
}

[data-theme="dark"] .classic-btn.danger {
    border-color: #7f1d1d;
}

/* Mobile: smaller placeholder when no image */
@media (max-width: 768px) {
    .car-image-placeholder {
        aspect-ratio: 3/1;
        padding: 1rem;
    }

    .car-image-placeholder .text-5xl {
        font-size: 2rem !important;
        margin-bottom: 0.25rem !important;
    }

    .car-image-placeholder .text-sm {
        font-size: 0.75rem !important;
    }

    .car-image {
        aspect-ratio: 16/9;
    }

    .ev-info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .ev-info-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .ev-info-value {
        font-size: 0.85rem;
    }

    .ev-plate-number {
        font-size: 1.25rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Loading Screen */
.loading-screen {
    background: var(--bg-secondary);
    animation: fadeIn 0.3s ease;
    padding-top: env(safe-area-inset-top, 0px);
}

/* Section Title */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, transparent 100%);
}

/* Stats Card */
.stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

/* Accent Line */
.accent-line {
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 2px;
}

/* Glass Effect */
.glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Notification */
.notification {
    animation: slideUp 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Card Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    animation: fadeIn 0.5s ease;
}

/* Divider */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--border-color) 50%, transparent 100%);
}

/* Mobile Scroll Fix */
@media (max-width: 768px) {
    #backupModal {
        align-items: center !important;
        padding: 1rem !important;
    }

    #backupModal > div {
        margin: auto !important;
        max-height: 85vh !important;
        border-radius: 1rem !important;
    }

    /* Smooth scrolling */
    #backupModal,
    #backupModal > div {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* Prevent body scroll when modal open */
    body.modal-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
        touch-action: none;
    }

    /* Disable interactions with background when modal is open */
    body.modal-open #mainApp,
    body.modal-open #carsGrid,
    body.modal-open .mobile-bottom-nav {
        pointer-events: none !important;
    }

    /* Hide floating add button when modal is open */
    body.modal-open .floating-add-btn {
        display: none !important;
    }
}

/* ==========================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ========================================== */

/* GPU Acceleration for animated elements */
.card,
.btn,
.nav-item,
.fab-button,
.mobile-bottom-nav,
.sidebar,
.modal-content,
.search-container {
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    /* Disable heavy effects on mobile */
    .glass,
    .modal-backdrop {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Lighter shadows on mobile */
    .card {
        box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
    }

    .card:hover {
        transform: none !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
    }

    /* Faster transitions on mobile */
    .card,
    .btn,
    .nav-item,
    input,
    select,
    textarea {
        transition-duration: 0.15s !important;
    }

    /* Remove hover effects on touch devices */
    .btn:hover {
        transform: none !important;
    }

    /* Lighter bottom nav */
    .mobile-bottom-nav {
        background: rgba(255,255,255,0.95) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    [data-theme="dark"] .mobile-bottom-nav {
        background: rgba(30,41,59,0.95) !important;
    }

    /* Lighter FAB */
    .fab-button {
        box-shadow: 0 4px 12px rgba(245,158,11,0.25) !important;
    }

    /* Disable card border color change on hover */
    .card:hover {
        border-color: inherit !important;
    }

    /* Simpler loading animation */
    .loader {
        animation: spin 0.8s linear infinite !important;
    }

    /* Remove section title gradient */
    .section-title::after {
        background: var(--border-color) !important;
    }

    /* Simpler scrollbar */
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    /* Optimize images */
    img {
        content-visibility: auto;
    }

    /* Disable animations during scroll */
    .is-scrolling * {
        transition: none !important;
        animation: none !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Kill ALL state changes on touch */
    .btn,
    .btn:hover,
    .btn:active,
    .btn:focus,
    .btn:visited,
    .btn-success,
    .btn-success:hover,
    .btn-success:active,
    .btn-primary,
    .btn-primary:hover,
    .btn-primary:active,
    .btn-danger,
    .btn-danger:hover,
    .btn-danger:active,
    .card,
    .card:hover,
    .card:active,
    .card:focus {
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }

    .btn:hover,
    .btn:focus {
        box-shadow: inherit !important;
        opacity: 1 !important;
        filter: none !important;
    }

    .btn:active {
        opacity: 0.8 !important;
    }

    .btn::before,
    .btn::after {
        display: none !important;
    }

    .card:hover,
    .card:active,
    .card:focus,
    .stat-card:hover,
    .car-image-placeholder:hover {
        box-shadow: none !important;
        border-color: rgb(31, 41, 55) !important;
        background-color: var(--card-bg) !important;
    }

    /* Faster modal opening */
    .modal-backdrop {
        animation-duration: 0.15s !important;
    }

    /* Optimize touch scrolling */
    .cards-grid,
    .sidebar,
    #mainApp {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: auto;
    }

    /* Remove ripple effect on mobile for speed */
    .btn::before {
        display: none !important;
    }
}

/* Car Modal Mobile Styles */
@media (max-width: 768px) {
    #carModal,
    #maintenanceModal,
    #carDetailsModal {
        padding: 0 !important;
    }

    .car-modal-container,
    .maintenance-modal-container,
    .car-details-container {
        border-radius: 0 !important;
    }

    .car-modal-header {
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        /* Safe area padding for status bar */
        padding-top: calc(env(safe-area-inset-top, 0px) + 0.75rem) !important;
    }

    .maintenance-modal-header {
        padding-top: calc(env(safe-area-inset-top, 0px) + 0.75rem) !important;
    }

    .car-details-header {
        padding-top: calc(env(safe-area-inset-top, 0px) + 0.75rem) !important;
    }

    #carForm input,
    #carForm select,
    #maintenanceForm input,
    #maintenanceForm select,
    #maintenanceForm textarea {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }

    /* Car Details Modal - Image stays below header */
    .car-details-container #carDetailsContent img {
        max-height: 200px;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Optimize paint for fixed elements */
.app-header,
.mobile-bottom-nav,
.fab-button,
.sidebar {
    contain: layout style paint;
}

/* Lazy render for off-screen cards */
.card {
    content-visibility: auto;
    contain-intrinsic-size: 0 400px;
}

/* Smooth details animation (backup modal) */
details summary::-webkit-details-marker {
    display: none;
}

details[open] summary span:last-child {
    transform: rotate(180deg);
    display: inline-block;
}

details summary span:last-child {
    transition: transform 0.2s ease;
}

/* Active scale - disabled for touch */
.active\:scale-98:active {
    transform: none;
}

/* ==========================================
   ONBOARDING STYLES
   ========================================== */

/* Slide-in animation */
.onboarding-slide-in {
    animation: onboardingSlideIn 0.4s ease-out;
}

@keyframes onboardingSlideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Success checkmark bounce */
.onboarding-success-bounce {
    animation: onboardingBounce 0.6s ease-out 0.2s both;
}

@keyframes onboardingBounce {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Onboarding input focus glow */
#onboardingOverlay input:focus {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* Dark mode support for onboarding */
[data-theme="dark"] #onboardingOverlay {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
}

[data-theme="dark"] #onboardingStep1 {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
}

[data-theme="dark"] #onboardingStep2 {
    background: linear-gradient(135deg, #1e293b 0%, #172554 100%) !important;
}

[data-theme="dark"] #onboardingStep3 {
    background: linear-gradient(135deg, #1e293b 0%, #14532d 100%) !important;
}

[data-theme="dark"] #onboardingStep4 {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
}

[data-theme="dark"] #onboardingOverlay h1,
[data-theme="dark"] #onboardingOverlay h2 {
    color: #f1f5f9;
}

[data-theme="dark"] #onboardingOverlay p {
    color: #94a3b8;
}

[data-theme="dark"] #onboardingOverlay .bg-white {
    background-color: #1e293b;
}

[data-theme="dark"] #onboardingOverlay label {
    color: #cbd5e1;
}

[data-theme="dark"] #onboardingOverlay input[type="text"],
[data-theme="dark"] #onboardingOverlay input[type="date"],
[data-theme="dark"] #onboardingOverlay input[type="time"] {
    background-color: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] #onboardingOverlay .bg-green-50 {
    background-color: #14532d33;
}

[data-theme="dark"] #onboardingOverlay .text-gray-700 {
    color: #cbd5e1;
}

[data-theme="dark"] #onboardingOverlay .text-gray-500 {
    color: #64748b;
}

[data-theme="dark"] #onboardingSummary {
    background-color: #1e293b;
}

/* Tutorial CSS moved to tutorial.js (all inline) */

/* ==========================================
   CAR WHEEL LOADER
   ========================================== */

/* Drive Type Toggle */
.drive-type-btn {
    background: white !important;
    color: #6b7280 !important;
    border: 2px solid #e5e7eb !important;
}

.drive-type-btn.active {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: white !important;
    border-color: #d97706 !important;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.wheel-spinner {
    animation: wheelSpin 1.2s linear infinite;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

@keyframes wheelSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================
   GARAGE STATUS
   ========================================== */

/* Green pulsing dot */
.garage-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: garagePulse 2s infinite;
}

.garage-dot-sm {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: garagePulse 2s infinite;
}

@keyframes garagePulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Dot overlay on car image */
.garage-dot-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Toggle button on card */
.garage-toggle-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.garage-toggle-btn.active {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-color: #16a34a;
    box-shadow: 0 2px 10px rgba(34, 197, 94, 0.4);
}

.garage-toggle-btn:active {
    transform: scale(0.92);
}

/* Filter bar */
.garage-filter-bar {
    background: white;
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
}

.garage-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    border: 2px solid #e5e7eb;
    background: white;
    font-size: 13px;
    font-weight: 700;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.garage-filter-btn:active {
    transform: scale(0.95);
}

.garage-filter-btn.active {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: #d97706;
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.garage-filter-btn.active .garage-dot-sm {
    background: white;
    box-shadow: 0 0 0 0 rgba(255,255,255, 0.7);
    animation: garagePulseWhite 2s infinite;
}

@keyframes garagePulseWhite {
    0% { box-shadow: 0 0 0 0 rgba(255,255,255, 0.6); }
    70% { box-shadow: 0 0 0 6px rgba(255,255,255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255, 0); }
}

.garage-count {
    background: rgba(0,0,0,0.1);
    padding: 1px 8px;
    border-radius: 8px;
    font-size: 12px;
    min-width: 22px;
    text-align: center;
}

.garage-filter-btn.active .garage-count {
    background: rgba(255,255,255,0.25);
}

/* ==========================================
   SERVICE TEMPLATES
   ========================================== */
.service-template-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.15s ease;
}

.service-template-btn:active {
    transform: scale(0.94);
}

.service-template-btn.active {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

/* Skeleton Loader */
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.skeleton-pulse {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-color) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

.skeleton-image {
    aspect-ratio: 16/9;
    width: 100%;
}

.skeleton-line {
    height: 14px;
    margin-bottom: 10px;
}

.skeleton-line-lg {
    height: 20px;
    margin-bottom: 12px;
}

.skeleton-badge {
    height: 28px;
    width: 100px;
    border-radius: 8px;
}

.skeleton-btn {
    height: 36px;
    border-radius: 10px;
}

.skeleton-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ==========================================
   PRINT OVERLAY
   ========================================== */
@media print {
    body > *:not(#printOverlay) {
        display: none !important;
    }
    #printOverlay {
        position: static !important;
        overflow: visible !important;
    }
    #printActions {
        display: none !important;
    }
}

/* ==========================================
   IMAGE LIGHTBOX
   ========================================== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.lightbox-overlay.active { opacity: 1; }
.lightbox-overlay img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
}
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    background: rgba(0,0,0,0.5);
    padding: 4px 12px;
    border-radius: 12px;
}
