/**
 * Mobi - Mobile App Design
 * Inspired by Deliveroo, Airbnb, Booking
 * @version 2.1.0
 */

/* ==================== CSS RESET ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ==================== VARIABLES ==================== */
:root {
    /* Couleurs principales - Style Aquatycia */
    --primary: #002b5c;
    --primary-dark: #001e3d;
    --primary-light: #e8f0f7;
    --secondary: #1e5f8f;

    --accent: #f59e0b;
    --accent-light: #fef3c7;

    --success: #10b981;
    --success-light: #d1fae5;

    --warning: #f59e0b;
    --warning-light: #fef3c7;

    --danger: #ef4444;
    --danger-light: #fee2e2;

    /* Texte */
    --text-dark: #111827;
    --text-medium: #4b5563;
    --text-light: #6b7280;
    --text-white: #FFFFFF;

    /* Backgrounds */
    --bg-white: #FFFFFF;
    --bg-light: #f9fafb;
    --bg-card: #FFFFFF;
    --bg-overlay: rgba(0, 0, 0, 0.5);

    /* Borders */
    --border-light: #e5e7eb;
    --border-medium: #d1d5db;

    /* Shadows - Style Aquatycia */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-primary: 0 10px 25px rgba(0, 43, 92, 0.3);

    /* Radius - Arrondis modernes */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;

    /* Safe areas iOS */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ==================== BODY ==================== */
html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-dark);
    background: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ==================== LAYOUT ==================== */
.app-container {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1;
    padding: var(--space-4);
    padding-top: calc(var(--space-4) + 60px);
    padding-bottom: calc(80px + var(--safe-bottom));
}

/* ==================== HEADER - Style Deliveroo ==================== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-white);
    padding: var(--space-4);
    padding-top: calc(var(--space-4) + var(--safe-top));
    display: flex;
    align-items: center;
    gap: var(--space-4);
    box-shadow: var(--shadow-sm);
}

.app-header h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    flex: 1;
    letter-spacing: -0.3px;
}

.header-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s var(--ease-out);
}

.header-icon:active {
    transform: scale(0.95);
    background: var(--border-light);
}

/* ==================== BOTTOM NAV - Style Deliveroo ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    display: flex;
    padding: var(--space-2) 0;
    padding-bottom: calc(var(--space-2) + var(--safe-bottom));
    box-shadow: 0 -1px 0 var(--border-light), 0 -4px 12px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-2) 0;
    color: var(--text-light);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s var(--ease-out);
}

.nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
    transition: transform 0.2s var(--ease-out);
}

.nav-item.active {
    color: var(--primary);
}

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

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

/* ==================== CARDS - Style Airbnb ==================== */
.card, .intervention-card, .detail-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-4);
    overflow: hidden;
    border: 1px solid var(--border-light);
    transition: all 0.3s var(--ease-out);
}

.card:active, .intervention-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-md);
}

/* ==================== INTERVENTION CARD - Style Deliveroo ==================== */
.intervention-card {
    position: relative;
}

.intervention-header {
    padding: var(--space-4);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.intervention-time {
    min-width: 56px;
    padding: var(--space-2) var(--space-3);
    background: var(--primary-light);
    border-radius: var(--radius-md);
    text-align: center;
}

.intervention-time-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.2;
}

.intervention-time-label {
    font-size: 10px;
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

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

.intervention-company {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-dark);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.intervention-address {
    color: var(--text-medium);
    font-size: 13px;
    line-height: 1.4;
}

/* Status badges - Style moderne */
.intervention-status {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-planifie { background: var(--bg-light); color: var(--text-medium); }
.status-en-cours, .status-en-route { background: #E3F2FD; color: #1976D2; }
.status-termine { background: var(--success-light); color: #00875A; }
.status-annule { background: var(--danger-light); color: #C9252D; }
.status-absent { background: var(--warning-light); color: #B25000; }
.status-reporte { background: #F3E8FF; color: #7C3AED; }

.intervention-body {
    padding: 0 var(--space-4) var(--space-4);
}

.intervention-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    color: var(--text-light);
    font-size: 13px;
}

.intervention-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.intervention-meta-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

/* Actions - Style Deliveroo */
.intervention-actions {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
}

/* ==================== BUTTONS - Style Deliveroo ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s var(--ease-out);
    -webkit-appearance: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--text-white);
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 12px 30px rgba(0, 43, 92, 0.4);
}

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

.btn-success {
    background: var(--success);
    color: var(--text-white);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
    padding: var(--space-2) var(--space-3);
}

.btn-block { width: 100%; }
.btn-lg { padding: var(--space-4) var(--space-6); font-size: 16px; }
.btn-sm { padding: var(--space-2) var(--space-3); font-size: 13px; }

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: var(--radius-full);
}

/* ==================== STATS GRID - Style Booking ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    text-align: center;
    border: 1px solid var(--border-light);
    transition: all 0.2s var(--ease-out);
}

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

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
    margin-bottom: var(--space-1);
    letter-spacing: -1px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card.highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    box-shadow: var(--shadow-primary);
}

.stat-card.highlight .stat-value,
.stat-card.highlight .stat-label {
    color: var(--text-white);
}

/* ==================== DETAIL CARDS ==================== */
.detail-card-header {
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}

.detail-card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    flex: 1;
    margin: 0;
}

.detail-card-header.collapsible {
    cursor: pointer;
}

.detail-card-badge {
    background: var(--bg-light);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-medium);
}

.detail-card-count {
    background: var(--primary);
    color: var(--text-white);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

.detail-card-body {
    padding: var(--space-4);
}

.detail-card-body.collapsed {
    display: none;
}

.detail-card-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-light);
    background: var(--bg-light);
}

.collapse-icon {
    transition: transform 0.3s var(--ease-out);
    color: var(--text-light);
}

/* ==================== CLIENT INFO - Style Airbnb ==================== */
.client-info {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.client-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.client-details {
    flex: 1;
    min-width: 0;
}

.client-name {
    font-weight: 700;
    font-size: 18px;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.client-address, .client-city {
    color: var(--text-medium);
    font-size: 14px;
    line-height: 1.4;
}

/* ==================== QUICK ACTIONS - Style Deliveroo ==================== */
.quick-actions {
    display: flex;
    gap: var(--space-6);
    justify-content: center;
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    color: var(--text-medium);
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s var(--ease-out);
}

.quick-action:active {
    transform: scale(0.95);
}

.quick-action-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s var(--ease-out);
}

.quick-action:active .quick-action-icon {
    transform: scale(0.95);
    box-shadow: var(--shadow-md);
}

/* ==================== STATUS BANNER ==================== */
.status-banner {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

.status-banner.status-planifie { background: var(--bg-light); color: var(--text-medium); }
.status-banner.status-en-cours { background: #E3F2FD; color: #1976D2; }
.status-banner.status-termine { background: var(--success-light); color: #00875A; }
.status-banner.status-annule { background: var(--danger-light); color: #C9252D; }
.status-banner.status-absent { background: var(--warning-light); color: #B25000; }
.status-banner.status-reporte { background: #F3E8FF; color: #7C3AED; }

.status-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-icon svg {
    fill: white;
    width: 24px;
    height: 24px;
}

.status-text {
    font-weight: 700;
    font-size: 16px;
}

/* ==================== FIXED ACTIONS - Style Deliveroo ==================== */
.fixed-actions {
    position: fixed;
    bottom: calc(70px + var(--safe-bottom));
    left: 0;
    right: 0;
    padding: var(--space-4);
    background: linear-gradient(to top, var(--bg-white) 70%, transparent);
    z-index: 50;
}

.action-row {
    display: flex;
    gap: var(--space-3);
}

.flex-grow { flex: 1; }

.signed-complete {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
    background: var(--success);
    color: var(--text-white);
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: 16px;
}

/* ==================== LISTS ==================== */
.contact-row, .product-row, .sample-row, .history-row {
    display: flex;
    align-items: center;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-light);
    gap: var(--space-3);
}

.contact-row:last-child, .product-row:last-child,
.sample-row:last-child, .history-row:last-child {
    border-bottom: none;
}

.contact-info, .sample-info, .ranking-info {
    flex: 1;
    min-width: 0;
}

.contact-name, .sample-point, .ranking-name {
    font-weight: 600;
    color: var(--text-dark);
}

.contact-role, .sample-meta, .ranking-stats {
    font-size: 13px;
    color: var(--text-light);
}

.contact-phone-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--success);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.sample-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sample-id, .history-date {
    color: var(--text-light);
    font-size: 12px;
}

.history-id {
    font-weight: 600;
    color: var(--primary);
}

.history-row {
    text-decoration: none;
    color: inherit;
}

/* ==================== TIMELINE ==================== */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border-light);
    border-radius: 1px;
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-5);
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    background: var(--border-medium);
    border: 2px solid var(--bg-white);
}

.timeline-item.completed .timeline-dot { background: var(--success); }
.timeline-item.active .timeline-dot {
    background: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.timeline-time {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.timeline-title {
    font-weight: 600;
    color: var(--text-dark);
    margin: 2px 0;
}

.timeline-desc {
    font-size: 13px;
    color: var(--text-medium);
}

/* ==================== BADGES ==================== */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
}

.badge-item {
    text-align: center;
}

.badge-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-2);
    font-size: 24px;
    filter: grayscale(1);
    opacity: 0.4;
    transition: all 0.3s var(--ease-out);
}

.badge-item.earned .badge-icon {
    filter: none;
    opacity: 1;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.3);
}

.badge-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-medium);
}

/* ==================== RANKING ==================== */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.ranking-item.me {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--text-white);
    box-shadow: var(--shadow-primary);
}

.ranking-position {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: var(--text-dark);
}

.ranking-item.me .ranking-position { background: rgba(255,255,255,0.2); color: var(--text-white); }
.ranking-position.gold { background: #FFD700; color: #5D4037; }
.ranking-position.silver { background: #C0C0C0; color: #424242; }
.ranking-position.bronze { background: #CD7F32; color: #3E2723; }

.ranking-score {
    font-weight: 800;
    font-size: 18px;
}

/* ==================== PROFILE ==================== */
.profile-header {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--text-white);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    margin: calc(-1 * var(--space-4));
    margin-top: -60px;
    padding-top: calc(var(--space-8) + 60px);
    margin-bottom: var(--space-5);
    box-shadow: var(--shadow-primary);
}

.profile-avatar {
    width: 88px;
    height: 88px;
    border-radius: var(--radius-full);
    background: var(--bg-white);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    margin: 0 auto var(--space-4);
    box-shadow: var(--shadow-lg);
}

.profile-name {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: var(--space-1);
}

.profile-role {
    opacity: 0.9;
    font-weight: 500;
}

.profile-menu {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
    margin-bottom: var(--space-4);
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.profile-menu-item:last-child { border-bottom: none; }
.profile-menu-item:active { background: var(--bg-light); }

.profile-menu-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-medium);
}

.profile-menu-text { flex: 1; }
.profile-menu-title { font-weight: 600; color: var(--text-dark); }
.profile-menu-desc { font-size: 13px; color: var(--text-light); }

.profile-menu-item.danger .profile-menu-icon { background: var(--danger-light); color: var(--danger); }
.profile-menu-item.danger .profile-menu-title { color: var(--danger); }

/* ==================== SCANNER ==================== */
.scanner-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    max-height: 320px;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.scanner-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-frame {
    width: 200px;
    height: 200px;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-md);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    position: relative;
}

.scanner-frame::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    animation: scan 2s ease-in-out infinite;
}

@keyframes scan {
    0%, 100% { top: 0; }
    50% { top: calc(100% - 3px); }
}

.scanner-result {
    position: absolute;
    bottom: var(--space-4);
    left: var(--space-4);
    right: var(--space-4);
    background: rgba(0, 0, 0, 0.85);
    color: var(--text-white);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 500;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.3s var(--ease-out);
}

.scanner-result.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==================== FORMS ==================== */
.form-group { margin-bottom: var(--space-4); }

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--text-dark);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 16px;
    color: var(--text-dark);
    background: var(--bg-white);
    transition: all 0.2s var(--ease-out);
    -webkit-appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-input::placeholder { color: var(--text-light); }

/* ==================== ALERTS ==================== */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: var(--space-4);
}

.alert-success { background: var(--success-light); color: #00875A; }
.alert-danger { background: var(--danger-light); color: #C9252D; }
.alert-warning { background: var(--warning-light); color: #B25000; }
.alert-info { background: #E3F2FD; color: #1976D2; }

/* ==================== TOAST ==================== */
.toast {
    position: fixed;
    bottom: calc(100px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(24px);
    background: var(--text-dark);
    color: var(--text-white);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s var(--ease-out);
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success { background: var(--success); }
.toast-warning { background: var(--warning); color: var(--text-dark); }
.toast-danger { background: var(--danger); }
.toast-info { background: #1976D2; }

/* ==================== LOADER ==================== */
#app-loader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--ease-out);
}

#app-loader.show { opacity: 1; visibility: visible; }

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== EMPTY STATE ==================== */
.empty-state, .empty-message {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--text-light);
}

.empty-state-icon, .empty-message svg {
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-medium);
    margin-bottom: var(--space-2);
}

.empty-state-desc {
    color: var(--text-light);
    margin-bottom: var(--space-5);
}

/* ==================== JOURNEY PANEL ==================== */
.journey-panel {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-xl);
    z-index: 90;
    transform: translateY(100%);
    transition: transform 0.4s var(--ease-out);
    padding-bottom: var(--safe-bottom);
}

.journey-panel.active { transform: translateY(0); }

.journey-handle {
    width: 40px;
    height: 4px;
    background: var(--border-medium);
    border-radius: 2px;
    margin: var(--space-3) auto;
}

.journey-content { padding: var(--space-4); }

.journey-destination {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.journey-pin {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    box-shadow: var(--shadow-md);
}

.journey-address { flex: 1; }
.journey-address-main { font-weight: 700; font-size: 16px; }
.journey-address-sub { color: var(--text-medium); font-size: 14px; }

.journey-eta {
    display: flex;
    gap: var(--space-6);
    padding: var(--space-4);
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
}

.eta-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.eta-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

.journey-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.journey-action-main { grid-column: span 2; }

/* ==================== OFFLINE ==================== */
body.offline::before {
    content: 'Mode hors ligne';
    position: fixed;
    top: var(--safe-top);
    left: 0;
    right: 0;
    background: var(--warning);
    color: var(--text-dark);
    text-align: center;
    padding: var(--space-1);
    font-size: 12px;
    font-weight: 600;
    z-index: 9999;
}

body.offline .app-header {
    margin-top: 24px;
}

/* ==================== RESPONSIVE ==================== */
@media (min-width: 480px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .badge-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (min-width: 768px) {
    .app-content {
        max-width: 600px;
        margin: 0 auto;
    }

    .fixed-actions {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
    }

    .journey-panel {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%) translateY(100%);
    }

    .journey-panel.active {
        transform: translateX(-50%) translateY(0);
    }
}

/* ==================== MODE SOMBRE ==================== */
/* Optimisé pour écrans OLED - Économie batterie maximale */

[data-theme="dark"] {
    /* Couleurs principales - Mode sombre Aquatycia */
    --primary: #4a9eff;
    --primary-dark: #2563eb;
    --primary-light: #1e3a5f;
    --secondary: #60a5fa;

    --accent: #fbbf24;
    --accent-light: #3d2e0a;

    --success: #34d399;
    --success-light: #064e3b;

    --warning: #fbbf24;
    --warning-light: #3d2e0a;

    --danger: #f87171;
    --danger-light: #450a0a;

    /* Texte - Mode sombre */
    --text-dark: #f3f4f6;
    --text-medium: #d1d5db;
    --text-light: #9ca3af;
    --text-white: #000000;

    /* Backgrounds - Noir pur OLED */
    --bg-white: #000000;
    --bg-light: #0a0a0a;
    --bg-card: #111111;
    --bg-overlay: rgba(255, 255, 255, 0.1);

    /* Borders - Mode sombre */
    --border-light: #1f1f1f;
    --border-medium: #2a2a2a;

    /* Shadows - Mode sombre */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
    --shadow-primary: 0 10px 25px rgba(74, 158, 255, 0.2);
}

/* Body background en mode sombre */
[data-theme="dark"] body {
    background: #000000;
}

/* Header en mode sombre */
[data-theme="dark"] .app-header {
    background: #0a0a0a;
    border-bottom: 1px solid var(--border-light);
}

/* Bottom nav en mode sombre */
[data-theme="dark"] .bottom-nav {
    background: #0a0a0a;
    box-shadow: 0 -1px 0 var(--border-light);
}

/* Cards en mode sombre */
[data-theme="dark"] .card,
[data-theme="dark"] .intervention-card,
[data-theme="dark"] .detail-card {
    background: var(--bg-card);
    border-color: var(--border-light);
}

/* Stats cards avec gradient en mode sombre */
[data-theme="dark"] .stat-card.highlight {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
}

/* Bouton primaire en mode sombre */
[data-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: #ffffff;
}

/* Bouton secondaire en mode sombre */
[data-theme="dark"] .btn-secondary {
    background: #1a1a1a;
    border-color: var(--border-medium);
    color: var(--text-dark);
}

/* Profile header en mode sombre */
[data-theme="dark"] .profile-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
}

/* Profile avatar en mode sombre */
[data-theme="dark"] .profile-avatar {
    background: #1a1a1a;
    color: var(--primary);
}

/* Profile menu en mode sombre */
[data-theme="dark"] .profile-menu {
    background: var(--bg-card);
}

[data-theme="dark"] .profile-menu-item:active {
    background: #1a1a1a;
}

[data-theme="dark"] .profile-menu-icon {
    background: #1a1a1a;
}

/* Intervention time en mode sombre */
[data-theme="dark"] .intervention-time {
    background: var(--primary-light);
}

[data-theme="dark"] .intervention-time-value {
    color: var(--primary);
}

/* Actions en mode sombre */
[data-theme="dark"] .intervention-actions {
    background: #0a0a0a;
}

/* Fixed actions gradient en mode sombre */
[data-theme="dark"] .fixed-actions {
    background: linear-gradient(to top, #000000 70%, transparent);
}

/* Journey panel en mode sombre */
[data-theme="dark"] .journey-panel {
    background: #0a0a0a;
}

[data-theme="dark"] .journey-eta {
    background: #1a1a1a;
}

/* Forms en mode sombre */
[data-theme="dark"] .form-input {
    background: #1a1a1a;
    border-color: var(--border-medium);
    color: var(--text-dark);
}

[data-theme="dark"] .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(74, 158, 255, 0.2);
}

/* Toast en mode sombre */
[data-theme="dark"] .toast {
    background: #1a1a1a;
    color: var(--text-dark);
}

/* Loader en mode sombre */
[data-theme="dark"] #app-loader {
    background: rgba(0, 0, 0, 0.95);
}

[data-theme="dark"] .loader-spinner {
    border-color: var(--border-medium);
    border-top-color: var(--primary);
}

/* Status colors en mode sombre */
[data-theme="dark"] .status-planifie { background: #1a1a1a; color: var(--text-medium); }
[data-theme="dark"] .status-en-cours,
[data-theme="dark"] .status-en-route { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .status-termine { background: #064e3b; color: #34d399; }
[data-theme="dark"] .status-annule { background: #450a0a; color: #f87171; }
[data-theme="dark"] .status-absent { background: #3d2e0a; color: #fbbf24; }
[data-theme="dark"] .status-reporte { background: #2e1065; color: #a78bfa; }

/* Status banner en mode sombre */
[data-theme="dark"] .status-banner.status-planifie { background: #1a1a1a; color: var(--text-medium); }
[data-theme="dark"] .status-banner.status-en-cours { background: #1e3a5f; color: #60a5fa; }
[data-theme="dark"] .status-banner.status-termine { background: #064e3b; color: #34d399; }
[data-theme="dark"] .status-banner.status-annule { background: #450a0a; color: #f87171; }
[data-theme="dark"] .status-banner.status-absent { background: #3d2e0a; color: #fbbf24; }
[data-theme="dark"] .status-banner.status-reporte { background: #2e1065; color: #a78bfa; }

/* Quick actions en mode sombre */
[data-theme="dark"] .quick-action-icon {
    background: var(--primary);
}

/* Ranking en mode sombre */
[data-theme="dark"] .ranking-item {
    background: #1a1a1a;
}

[data-theme="dark"] .ranking-item.me {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
}

[data-theme="dark"] .ranking-position {
    background: #2a2a2a;
}

/* Sample icon en mode sombre */
[data-theme="dark"] .sample-icon {
    background: var(--primary-light);
}

/* Client avatar en mode sombre */
[data-theme="dark"] .client-avatar {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
}

/* Timeline en mode sombre */
[data-theme="dark"] .timeline::before {
    background: var(--border-medium);
}

[data-theme="dark"] .timeline-dot {
    background: var(--border-medium);
    border-color: var(--bg-card);
}

[data-theme="dark"] .timeline-item.active .timeline-dot {
    box-shadow: 0 0 0 4px rgba(74, 158, 255, 0.2);
}

/* Badge en mode sombre */
[data-theme="dark"] .badge-icon {
    background: #1a1a1a;
}

/* Offline banner en mode sombre */
[data-theme="dark"].offline::before {
    background: #3d2e0a;
    color: #fbbf24;
}

/* Scrollbar en mode sombre */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 6px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #0a0a0a;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 3px;
}

/* Theme toggle button style */
.theme-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-white);
}

.theme-toggle-info {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.theme-toggle-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-medium);
}

.theme-toggle-text {
    flex: 1;
}

.theme-toggle-title {
    font-weight: 600;
    color: var(--text-dark);
}

.theme-toggle-desc {
    font-size: 13px;
    color: var(--text-light);
}

/* Switch toggle */
.switch {
    position: relative;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-medium);
    transition: 0.3s;
    border-radius: 28px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.switch input:checked + .switch-slider {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(24px);
}

/* Dark mode icon animation */
[data-theme="dark"] .theme-toggle-icon svg {
    transform: rotate(180deg);
    transition: transform 0.3s var(--ease-out);
}

/* ==================== CLIENT NOTES ==================== */

.client-notes-card {
    border: 2px solid var(--accent);
}

.client-notes-card .detail-card-header {
    background: var(--accent-light);
}

.client-notes-list {
    min-height: 50px;
}

.empty-notes {
    color: var(--text-light);
    font-size: 13px;
    text-align: center;
    font-style: italic;
    padding: var(--space-3);
}

.client-note-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-light);
}

.client-note-item:last-child {
    border-bottom: none;
}

.note-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.note-content {
    flex: 1;
    min-width: 0;
}

.note-text {
    color: var(--text-dark);
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

.note-meta {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

.note-delete {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-light);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.note-delete:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* Note Modal */
.note-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

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

.note-modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-5);
    width: 100%;
    max-width: 480px;
    animation: slideUp 0.3s var(--ease-out);
}

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

.note-modal-content h4 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--space-4);
    text-align: center;
}

.note-types {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.note-type-btn {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    background: var(--bg-white);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.note-type-btn:hover {
    background: var(--bg-light);
}

.note-type-btn.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.note-modal-content textarea {
    width: 100%;
    padding: var(--space-3);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 16px;
    resize: none;
    margin-bottom: var(--space-4);
    font-family: inherit;
}

.note-modal-content textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.note-modal-actions {
    display: flex;
    gap: var(--space-3);
}

.note-modal-actions .btn {
    flex: 1;
}

/* ==================== HISTORY ENHANCED ==================== */

.history-card .detail-card-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.history-badge {
    font-size: 11px;
    font-weight: 600;
    color: #1976D2;
    background: white;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.history-list-enhanced {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.history-item-enhanced {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-light);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.history-item-enhanced:active {
    transform: scale(0.98);
}

.history-item-enhanced.recent {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
}

.history-date-badge {
    width: 50px;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    padding: var(--space-2);
    text-align: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.history-day {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
}

.history-month {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    margin-top: 2px;
}

.history-year {
    display: block;
    font-size: 10px;
    color: var(--text-light);
}

.history-details {
    flex: 1;
    min-width: 0;
}

.history-company {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: 4px;
}

.history-order {
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
}

.history-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.history-status-text {
    font-size: 11px;
    color: var(--text-light);
}

/* Dark mode for notes and history */
[data-theme="dark"] .client-notes-card {
    border-color: #3d2e0a;
}

[data-theme="dark"] .client-notes-card .detail-card-header {
    background: #3d2e0a;
}

[data-theme="dark"] .note-modal-content {
    background: var(--bg-card);
}

[data-theme="dark"] .note-type-btn {
    background: #1a1a1a;
    border-color: var(--border-medium);
    color: var(--text-dark);
}

[data-theme="dark"] .note-type-btn.selected {
    background: var(--primary);
    color: white;
}

[data-theme="dark"] .note-modal-content textarea {
    background: #1a1a1a;
    color: var(--text-dark);
    border-color: var(--border-medium);
}

[data-theme="dark"] .history-card .detail-card-header {
    background: #1e3a5f;
}

[data-theme="dark"] .history-badge {
    background: #0a0a0a;
    color: #60a5fa;
}

[data-theme="dark"] .history-item-enhanced {
    background: #1a1a1a;
}

[data-theme="dark"] .history-item-enhanced.recent {
    background: #1e3a5f;
    border-color: #2563eb;
}

[data-theme="dark"] .history-date-badge {
    background: #0a0a0a;
}

/* ==================== CHECKLIST ==================== */

.checklist-card {
    border: 2px solid var(--success);
}

.checklist-card .detail-card-header {
    background: var(--success-light);
}

.checklist-card .detail-card-header svg {
    color: var(--success);
}

.checklist-card .detail-card-header h3 {
    color: var(--success);
}

.checklist-progress {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--bg-white);
    color: var(--text-light);
}

.checklist-progress.partial {
    background: var(--warning-light);
    color: var(--warning);
}

.checklist-progress.complete {
    background: var(--success);
    color: white;
}

.checklist-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.checklist-item:active {
    transform: scale(0.98);
}

.checklist-item.checked {
    background: var(--success-light);
}

.checklist-item.checked .checklist-text {
    text-decoration: line-through;
    color: var(--text-light);
}

.checklist-item input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    background: var(--bg-white);
}

.checklist-item.checked .checkmark {
    background: var(--success);
    border-color: var(--success);
}

.checklist-item.checked .checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.checklist-text {
    flex: 1;
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.3;
}

.required-badge {
    color: var(--danger);
    font-weight: 700;
    margin-left: 2px;
}

/* Dark mode checklist */
[data-theme="dark"] .checklist-card {
    border-color: #064e3b;
}

[data-theme="dark"] .checklist-card .detail-card-header {
    background: #064e3b;
}

[data-theme="dark"] .checklist-progress {
    background: #0a0a0a;
}

[data-theme="dark"] .checklist-item {
    background: #1a1a1a;
}

[data-theme="dark"] .checklist-item.checked {
    background: #064e3b;
}

[data-theme="dark"] .checkmark {
    background: #0a0a0a;
    border-color: var(--border-medium);
}

/* ==================== PHOTOS TERRAIN ==================== */

.photos-card {
    border: 2px solid var(--secondary);
}

.photos-card .detail-card-header {
    background: rgba(30, 95, 143, 0.1);
}

.photos-card .detail-card-header svg {
    color: var(--secondary);
}

.photos-card .detail-card-header h3 {
    color: var(--secondary);
}

.photos-count {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--secondary);
    color: white;
    min-width: 24px;
    text-align: center;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.empty-photos {
    grid-column: 1 / -1;
    color: var(--text-light);
    font-size: 13px;
    text-align: center;
    font-style: italic;
    padding: var(--space-3);
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-light);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.photo-item:active img {
    transform: scale(1.05);
}

.photo-label {
    position: absolute;
    bottom: 4px;
    left: 4px;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
}

.photo-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(239, 68, 68, 0.9);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-item:hover .photo-delete,
.photo-item:active .photo-delete {
    opacity: 1;
}

.photos-actions {
    margin-top: var(--space-2);
}

/* Photo Modal */
.photo-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.photo-modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-4);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s var(--ease-out);
}

.photo-preview {
    width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-4);
    background: var(--bg-light);
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.photo-types {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.photo-type-btn {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    background: var(--bg-white);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.photo-type-btn:hover {
    background: var(--bg-light);
}

.photo-type-btn.selected {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

.photo-note-input {
    width: 100%;
    padding: var(--space-3);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 16px;
    margin-bottom: var(--space-4);
    font-family: inherit;
}

.photo-note-input:focus {
    outline: none;
    border-color: var(--secondary);
}

.photo-modal-actions {
    display: flex;
    gap: var(--space-3);
}

.photo-modal-actions .btn {
    flex: 1;
}

/* Photo View Modal */
.photo-view-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    animation: fadeIn 0.2s ease-out;
    padding: var(--space-4);
}

.photo-view-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-view-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
}

.photo-view-content img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.photo-view-info {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-top: var(--space-3);
    text-align: center;
    max-width: 100%;
}

.photo-view-info strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

.photo-view-info p {
    font-size: 14px;
    margin-bottom: 4px;
    opacity: 0.9;
}

.photo-view-info small {
    font-size: 12px;
    opacity: 0.7;
}

/* Dark mode photos */
[data-theme="dark"] .photos-card {
    border-color: #1e5f8f;
}

[data-theme="dark"] .photos-card .detail-card-header {
    background: rgba(30, 95, 143, 0.3);
}

[data-theme="dark"] .photo-modal-content {
    background: var(--bg-card);
}

[data-theme="dark"] .photo-type-btn {
    background: #1a1a1a;
    border-color: var(--border-medium);
    color: var(--text-dark);
}

[data-theme="dark"] .photo-type-btn.selected {
    background: var(--secondary);
    color: white;
}

[data-theme="dark"] .photo-note-input {
    background: #1a1a1a;
    color: var(--text-dark);
    border-color: var(--border-medium);
}

/* ==========================================
   OFFLINE INDICATOR & SYNC STATUS
   ========================================== */

/* Offline Banner */
.offline-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    padding: 8px 16px;
    padding-top: calc(8px + env(safe-area-inset-top));
    animation: slideDown 0.3s ease-out;
}

.offline-banner.visible {
    display: block;
}

.offline-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
    font-size: 13px;
    font-weight: 600;
}

.offline-banner svg {
    flex-shrink: 0;
}

.offline-sync-pending {
    display: none;
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.offline-sync-pending.visible {
    display: inline-flex;
}

/* Adjust app when offline banner is visible */
body.offline .app-header {
    margin-top: calc(36px + env(safe-area-inset-top));
}

body.offline .app-content {
    padding-top: calc(36px + env(safe-area-inset-top) + var(--header-height) + 16px);
}

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

/* Sync Toast */
.sync-toast {
    display: none;
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    animation: slideUp 0.3s ease-out;
    border: 1px solid var(--border-light);
}

.sync-toast.visible {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sync-toast-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sync-toast-icon svg {
    color: white;
}

.sync-spinner {
    animation: spin 1.5s linear infinite;
}

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

.sync-toast-content {
    flex: 1;
    min-width: 0;
}

.sync-toast-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.sync-toast-progress {
    height: 4px;
    background: var(--bg-light);
    border-radius: 2px;
    overflow: hidden;
}

.sync-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    transition: width 0.3s ease;
}

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

/* Sync Stats Card (Profile) */
.sync-stats-card {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    border: none;
}

.sync-stats-card .detail-card-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.sync-stats-card .detail-card-header h3 {
    color: white;
}

.sync-stats-card .section-icon {
    background: rgba(255, 255, 255, 0.2);
}

.sync-stats-card .section-icon svg {
    color: white;
}

.sync-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.sync-stat-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.sync-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.sync-stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sync-stat-item.warning .sync-stat-value {
    color: #ffc107;
}

.sync-stat-item.success .sync-stat-value {
    color: #4ade80;
}

.sync-last-update {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
}

.sync-last-update svg {
    color: rgba(255, 255, 255, 0.6);
}

.sync-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.sync-actions .btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px;
    font-size: 13px;
}

.sync-actions .btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sync-actions .btn.syncing svg {
    animation: spin 1s linear infinite;
}

/* Online/Offline Status Indicator */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.connection-status.online {
    background: rgba(74, 222, 128, 0.15);
    color: #22c55e;
}

.connection-status.offline {
    background: rgba(255, 107, 53, 0.15);
    color: #ff6b35;
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.connection-status.online .connection-dot {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* Dark mode adjustments */
[data-theme="dark"] .sync-toast {
    background: #1a1a1a;
    border-color: #333;
}

[data-theme="dark"] .sync-stats-card {
    background: linear-gradient(135deg, #0a1929 0%, #1a3a5c 100%);
}

[data-theme="dark"] .offline-banner {
    background: linear-gradient(135deg, #cc5500 0%, #b37400 100%);
}

/* Responsive */
@media (max-width: 360px) {
    .sync-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .sync-stat-value {
        font-size: 20px;
    }

    .sync-stat-label {
        font-size: 10px;
    }
}

/* ==========================================
   WEATHER (MÉTÉO)
   ========================================== */

/* Weather Mini - Affichage compact sur les cartes */
.weather-mini {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    margin-left: auto;
    transition: all 0.2s ease;
}

.weather-mini:hover {
    background: rgba(var(--primary-rgb), 0.15);
    transform: scale(1.05);
}

.weather-mini-icon {
    font-size: 16px;
    line-height: 1;
}

.weather-mini-temp {
    white-space: nowrap;
}

.weather-mini-alert {
    font-size: 14px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Weather Card - Affichage complet */
.weather-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-radius: 16px;
    padding: 16px;
    margin: 12px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.weather-icon {
    font-size: 48px;
    line-height: 1;
}

.weather-temp {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.weather-desc {
    font-size: 14px;
    opacity: 0.9;
    text-transform: capitalize;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.weather-detail-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.weather-detail-label {
    font-size: 16px;
}

.weather-detail-value {
    opacity: 0.95;
}

/* Weather Alert */
.weather-alert {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.15);
    border-left: 3px solid rgba(255, 255, 255, 0.5);
}

.weather-alert.warning {
    background: rgba(255, 193, 7, 0.2);
    border-left-color: #ffc107;
}

.weather-alert-icon {
    font-size: 18px;
}

.weather-alert-text {
    flex: 1;
    font-weight: 500;
}

/* Weather Modal */
.weather-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

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

.weather-modal-content {
    background: var(--bg-card);
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.weather-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.weather-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text-dark);
}

.weather-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.weather-modal-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.weather-modal-body {
    padding: 20px;
}

/* Weather Forecast */
.weather-forecast {
    margin-top: 20px;
}

.weather-forecast h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: var(--text-dark);
}

.weather-forecast-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.weather-forecast-item {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.forecast-time {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.forecast-icon {
    font-size: 32px;
    margin: 8px 0;
}

.forecast-temp {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 4px 0;
}

.forecast-rain {
    font-size: 11px;
    color: var(--primary);
    margin-top: 4px;
}

/* Responsive */
@media (max-width: 480px) {
    .weather-forecast-items {
        grid-template-columns: 1fr;
    }

    .weather-temp {
        font-size: 28px;
    }

    .weather-icon {
        font-size: 40px;
    }
}

/* ==========================================
   AUTOFILL (PRÉ-REMPLISSAGE INTELLIGENT)
   ========================================== */

/* Bannière de suggestion */
.autofill-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    animation: slideInDown 0.4s ease;
}

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

.autofill-banner-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.autofill-banner-content {
    flex: 1;
    min-width: 0;
}

.autofill-banner-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.autofill-banner-desc {
    font-size: 12px;
    opacity: 0.9;
}

.autofill-banner-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.autofill-banner-actions .btn {
    white-space: nowrap;
}

/* Template Selector */
.template-selector {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    border: 2px dashed var(--border-light);
}

.template-selector-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
}

.template-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.template-card {
    background: var(--bg-light);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.template-card:hover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.template-card-icon {
    font-size: 32px;
}

.template-card-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
}

/* AutoFill Modal */
.autofill-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.autofill-modal-content {
    background: var(--bg-card);
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.autofill-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.autofill-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-dark);
}

.autofill-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.autofill-modal-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.autofill-modal-body {
    padding: 20px;
}

.autofill-modal-body p {
    margin: 0 0 16px 0;
    color: var(--text-dark);
}

.autofill-modal-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.autofill-modal-actions .btn {
    flex: 1;
}

/* Samples Preview */
.samples-preview {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sample-preview-item {
    background: var(--bg-light);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sample-preview-type {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.sample-preview-location {
    font-size: 12px;
    color: var(--text-light);
}

/* Checklist Items */
.checklist-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checklist-item:hover {
    background: rgba(var(--primary-rgb), 0.05);
}

.checklist-item input[type="checkbox"] {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checklist-item span {
    flex: 1;
    color: var(--text-dark);
    font-size: 14px;
    line-height: 1.5;
}

.checklist-item input[type="checkbox"]:checked + span {
    text-decoration: line-through;
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 480px) {
    .template-selector-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .autofill-banner {
        flex-direction: column;
        text-align: center;
    }

    .autofill-banner-actions {
        width: 100%;
        flex-direction: column;
    }

    .autofill-banner-actions .btn {
        width: 100%;
    }
}

/* ==========================================
   VOICE INPUT (DICTÉE VOCALE)
   ========================================== */

/* Wrapper pour champ avec bouton vocal */
.voice-input-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.voice-input-wrapper textarea,
.voice-input-wrapper input {
    flex: 1;
    padding-right: 16px;
}

/* Bouton micro */
.voice-input-button {
    position: relative;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 43, 92, 0.2);
}

.voice-input-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 43, 92, 0.3);
}

.voice-input-button:active {
    transform: scale(0.95);
}

/* État écoute active */
.voice-input-button.listening {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    animation: voicePulse 1.5s infinite;
}

@keyframes voicePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(231, 76, 60, 0);
    }
}

.pulse-circle {
    animation: pulseCircle 1.5s ease-in-out infinite;
}

@keyframes pulseCircle {
    0%, 100% {
        opacity: 0.3;
        r: 8;
    }
    50% {
        opacity: 0.8;
        r: 12;
    }
}

/* Affichage du texte interim (reconnaissance en cours) */
.voice-interim {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(var(--primary-rgb), 0.1);
    border-left: 3px solid var(--primary);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-light);
    font-style: italic;
    animation: fadeIn 0.3s ease;
}

.voice-interim::before {
    content: '🎤 ';
    margin-right: 4px;
}

/* Pour les champs textarea avec vocal */
.voice-input-wrapper textarea {
    resize: vertical;
    min-height: 100px;
}

/* Badge "Vocal disponible" */
.voice-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.voice-badge svg {
    width: 12px;
    height: 12px;
}

/* Message si non supporté */
.voice-not-supported {
    padding: 12px;
    background: rgba(255, 193, 7, 0.1);
    border-left: 3px solid #ffc107;
    border-radius: 8px;
    font-size: 13px;
    color: #856404;
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 480px) {
    .voice-input-button {
        width: 44px;
        height: 44px;
    }
}

/* ==========================================
   GEOFENCING (DÉTECTION ARRIVÉE/DÉPART)
   ========================================== */

/* Notification géofencing */
.geofence-notification {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    animation: slideUpBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 3px solid;
}

@keyframes slideUpBounce {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    60% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.geofence-notification.dismissed {
    animation: slideDown 0.3s ease;
    opacity: 0;
    transform: translateY(100%);
}

/* Type arrivée */
.geofence-notification.arrival {
    border-color: #27ae60;
    background: linear-gradient(135deg, #ffffff 0%, #ecf9f2 100%);
}

.geofence-notification.arrival .geofence-notification-icon {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
}

/* Type départ */
.geofence-notification.departure {
    border-color: #3498db;
    background: linear-gradient(135deg, #ffffff 0%, #ebf5fb 100%);
}

.geofence-notification.departure .geofence-notification-icon {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.geofence-notification-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: iconPulse 2s infinite;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.geofence-notification-content {
    flex: 1;
    min-width: 0;
}

.geofence-notification-title {
    font-weight: 700;
    font-size: 18px;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.geofence-notification-text {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.geofence-notification-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.geofence-notification-actions .btn {
    flex: 1;
    min-width: 100px;
}

/* Badge distance */
.geofence-distance-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.geofence-distance-badge.nearby {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    animation: distancePulse 2s infinite;
}

@keyframes distancePulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.geofence-distance-badge svg {
    width: 14px;
    height: 14px;
}

/* Indicateur géofencing actif */
.geofencing-active-indicator {
    position: fixed;
    top: calc(var(--header-height) + 16px);
    right: 16px;
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.geofencing-active-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Responsive */
@media (max-width: 480px) {
    .geofence-notification {
        bottom: calc(100px + env(safe-area-inset-bottom));
        left: 12px;
        right: 12px;
        padding: 16px;
        flex-direction: column;
    }

    .geofence-notification-icon {
        width: 48px;
        height: 48px;
    }

    .geofence-notification-actions {
        width: 100%;
        flex-direction: column;
    }

    .geofence-notification-actions .btn {
        width: 100%;
    }
}

/* ========================================
   PDF EXPORT AUTOMATIQUE
   ======================================== */

/* Toast de génération en cours */
.pdf-generating-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    padding: 32px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.pdf-generating-toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

.pdf-generating-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #002b5c 0%, #1e5f8f 100%);
    border-radius: 12px;
}

.pdf-generating-icon svg {
    color: white;
}

.pdf-spinner {
    animation: rotate 1.5s linear infinite;
}

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

.pdf-generating-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.pdf-generating-subtitle {
    font-size: 13px;
    color: var(--text-light);
}

/* Modale PDF Export */
.pdf-export-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pdf-export-modal.active {
    opacity: 1;
}

.pdf-export-modal.active .pdf-export-content {
    transform: scale(1);
}

.pdf-export-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.pdf-export-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pdf-export-header {
    text-align: center;
    padding: 32px 24px 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 20px 20px 0 0;
}

.pdf-export-icon-success {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(39, 174, 96, 0.3);
    animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.pdf-export-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.pdf-export-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin: 0;
}

.pdf-export-body {
    padding: 24px;
}

.pdf-info-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.pdf-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.pdf-info-item:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.pdf-info-item svg {
    color: var(--primary);
    flex-shrink: 0;
}

.pdf-info-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 2px;
}

.pdf-info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Actions PDF */
.pdf-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.pdf-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 16px;
    border: 2px solid transparent;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 600;
}

.pdf-action-btn.primary {
    background: linear-gradient(135deg, #002b5c 0%, #1e5f8f 100%);
    color: white;
    grid-column: span 2;
}

.pdf-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 43, 92, 0.3);
}

.pdf-action-btn.secondary {
    background: #f8f9fa;
    color: var(--text-primary);
    border-color: #e9ecef;
}

.pdf-action-btn.secondary:hover {
    background: #e9ecef;
    border-color: var(--primary);
}

.pdf-action-btn svg {
    width: 24px;
    height: 24px;
}

.pdf-export-footer {
    padding: 16px 24px;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

/* Formulaire Email */
.pdf-email-form {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pdf-email-form h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
}

.pdf-email-form .form-group {
    margin-bottom: 16px;
}

.pdf-email-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.pdf-email-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.pdf-email-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.pdf-email-actions {
    display: flex;
    gap: 8px;
}

.pdf-email-actions .btn {
    flex: 1;
}

/* Spinner petit */
.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

/* Responsive */
@media (max-width: 480px) {
    .pdf-export-content {
        width: 95%;
        max-height: 85vh;
    }

    .pdf-export-header {
        padding: 24px 16px 16px;
    }

    .pdf-export-icon-success {
        width: 64px;
        height: 64px;
    }

    .pdf-export-header h2 {
        font-size: 20px;
    }

    .pdf-export-body {
        padding: 16px;
    }

    .pdf-actions-grid {
        grid-template-columns: 1fr;
    }

    .pdf-action-btn.primary {
        grid-column: span 1;
    }
}

/* ========================================
   ROUTE OPTIMIZATION (OPTIMISATION ITINÉRAIRE)
   ======================================== */

/* Bouton d'optimisation dans le header */
.route-optimize-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    transition: all 0.3s ease;
}

.route-optimize-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
}

/* Modale d'optimisation */
.route-optimize-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.route-optimize-modal.active {
    opacity: 1;
}

.route-optimize-modal.active .route-optimize-content {
    transform: translateY(0);
}

.route-optimize-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.route-optimize-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.route-optimize-header {
    padding: 32px 24px 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 20px 20px 0 0;
    text-align: center;
}

.route-stats-card {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    background: #f8f9fa;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
}

.route-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 12px;
}

.route-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.route-stop-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.route-stop-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary) 0%, #1e5f8f 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.route-order-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    z-index: 10;
}

/* ========================================
   AI ASSISTANT (ASSISTANT IA TERRAIN)
   ======================================== */

/* Bouton flottant (FAB) */
.ai-assistant-fab {
    position: fixed;
    bottom: calc(100px + env(safe-area-inset-bottom));
    right: 20px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    border: none;
    box-shadow: 0 8px 24px rgba(155, 89, 182, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
}

.ai-assistant-fab:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 12px 32px rgba(155, 89, 182, 0.5);
}

.ai-assistant-fab.hidden {
    transform: scale(0);
    opacity: 0;
}

/* Modale chatbot */
.ai-assistant-modal {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ai-assistant-modal.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ai-assistant-container {
    height: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.ai-assistant-header {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ai-assistant-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-assistant-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-assistant-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.ai-assistant-subtitle {
    font-size: 11px;
    opacity: 0.9;
}

.ai-assistant-header-right {
    display: flex;
    gap: 8px;
}

.ai-assistant-btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ai-assistant-btn-icon:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Body - Messages */
.ai-assistant-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.ai-message {
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease;
}

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

.ai-message-content {
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 85%;
    word-wrap: break-word;
}

.ai-message-user .ai-message-content {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.ai-message-bot .ai-message-content {
    background: white;
    color: var(--text-primary);
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ai-message-bot .ai-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-message-bot .ai-message-content li {
    margin: 4px 0;
}

/* Typing indicator */
.ai-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.ai-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9b59b6;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.ai-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Footer - Input */
.ai-assistant-footer {
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.ai-assistant-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-assistant-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.ai-assistant-input:focus {
    border-color: #9b59b6;
}

.ai-assistant-voice-btn,
.ai-assistant-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-assistant-voice-btn {
    background: #f8f9fa;
    color: var(--text-secondary);
}

.ai-assistant-voice-btn:hover {
    background: #e9ecef;
}

.ai-assistant-send-btn {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
}

.ai-assistant-send-btn:hover {
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 480px) {
    .ai-assistant-modal {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .ai-assistant-container {
        border-radius: 0;
    }

    .ai-assistant-fab {
        bottom: calc(80px + env(safe-area-inset-bottom));
        right: 16px;
    }
}

/* ==================== SIDE MENU (BURGER MENU) ==================== */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--ease-out);
    z-index: 998;
}

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

.side-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: var(--bg-white);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    transition: right 0.3s var(--ease-out);
    z-index: 999;
    display: flex;
    flex-direction: column;
}

.side-menu.active {
    right: 0;
}

.side-menu-header {
    padding: var(--space-6) var(--space-4);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--text-white);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
    padding-top: calc(var(--safe-top) + var(--space-6));
}

.side-menu-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
}

.side-menu-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-white);
    flex-shrink: 0;
}

.side-menu-user-info {
    flex: 1;
    min-width: 0;
}

.side-menu-user-name {
    font-weight: 600;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.side-menu-user-role {
    font-size: 13px;
    opacity: 0.9;
}

.side-menu-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.side-menu-close:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.25);
}

.side-menu-nav {
    flex: 1;
    padding: var(--space-4) 0;
    overflow-y: auto;
}

.side-menu-section {
    margin-bottom: var(--space-6);
}

.side-menu-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-light);
    padding: 0 var(--space-4);
    margin-bottom: var(--space-2);
    letter-spacing: 0.5px;
}

.side-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.side-menu-item:active {
    background: var(--bg-light);
}

.side-menu-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.side-menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
}

.side-menu-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.side-menu-item span {
    flex: 1;
    font-size: 15px;
}

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

.side-menu-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border-medium);
    border-radius: var(--radius-full);
    transition: background 0.3s;
    flex-shrink: 0;
}

.side-menu-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.side-menu-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--bg-white);
    border-radius: var(--radius-full);
    transition: transform 0.3s;
}

.side-menu-toggle input:checked ~ .side-menu-toggle-slider {
    transform: translateX(20px);
}

.side-menu-toggle input:checked ~ * {
    background: var(--primary);
}

.side-menu-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-light);
    padding-bottom: calc(var(--safe-bottom) + var(--space-4));
}

.side-menu-version {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
}

/* Dark mode pour le side menu */
[data-theme="dark"] .side-menu {
    background: #1a1a1a;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .side-menu-item {
    color: #e5e5e5;
}

[data-theme="dark"] .side-menu-item:active {
    background: #2a2a2a;
}

[data-theme="dark"] .side-menu-item.active {
    background: rgba(30, 95, 143, 0.2);
    color: #4da3ff;
}

[data-theme="dark"] .side-menu-section-title {
    color: #888;
}

[data-theme="dark"] .side-menu-footer {
    border-top: 1px solid #333;
}

/* Badge IA dans le menu */
.side-menu-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: auto;
}

/* Items info (non-cliquables) */
.side-menu-item-info {
    cursor: default;
    opacity: 0.8;
    pointer-events: none;
}

.side-menu-item-info div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.side-menu-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
}

.side-menu-item-subtitle {
    font-size: 11px;
    color: var(--text-light);
}

[data-theme="dark"] .side-menu-item-title {
    color: #e5e5e5;
}

[data-theme="dark"] .side-menu-item-subtitle {
    color: #888;
}
