/* ========== VARIABLES COULEURS v1.5 ========== */
:root {
    /* Couleurs principales - Bleu + Rouge MB TECH */
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --accent-red: #dc2626;
    --accent-red-light: #fee2e2;
    
    /* Couleurs fonctionnelles */
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0369a1;
    
    /* Neutres */
    --white: #ffffff;
    --bg-light: #f9fafb;
    --bg-lighter: #f3f4f6;
    --border: #e5e7eb;
    --text-dark: #111827;
    --text-gray: #6b7280;
    --text-light: #9ca3af;
    
    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Transition */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* ========== RESET ET BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ========== LAYOUT PRINCIPAL ========== */
.container {
    width: 100%;
    height: 100%;
    background: var(--white);
    display: flex;
    flex-direction: column;
}

/* ========== HEADER ========== */
.header {
    background: var(--white);
    color: var(--primary-dark);
    padding: 16px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 99;
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    flex-shrink: 0;
    border-bottom: 2px solid var(--primary-color);
}

.header img.logo {
    height: 48px;
    width: auto;
    flex-shrink: 0;
    transition: var(--transition);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.header-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* ========== NAVIGATION ONGLETS ========== */
.nav-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    background: var(--white);
    padding: 0 24px;
    padding-bottom: 8px;
    gap: 8px;
    overflow-y: visible;
    overflow-x: auto;
    width: 100%;
    flex-shrink: 0;
    position: relative;
    z-index: 98;
    align-items: flex-start;
}

.nav-tab {
    padding: 14px 18px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-gray);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
}

.nav-tab:hover {
    color: var(--primary-color);
    background-color: var(--bg-lighter);
}

.nav-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* ========== DROPDOWN NAVIGATION ========== */
#listeWrapper {
    position: relative;
    display: inline-block;
    align-self: center;
}

#listeMenuBtn {
    position: relative;
}

.liste-dropdown {
    position: fixed;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
    z-index: 10000;
    min-width: 220px;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    display: none;
    top: 0;
    left: 0;
}

.liste-dropdown.active {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.liste-dropdown.hide {
    display: none !important;
}

.nav-subtab {
    display: block;
    width: 100%;
    padding: 14px 18px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    text-align: left;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.nav-subtab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.nav-subtab:hover {
    background-color: rgba(30, 64, 175, 0.05);
    color: var(--primary-color);
    padding-left: 22px;
}

.nav-subtab:hover::before {
    transform: scaleX(1);
}

.nav-subtab.active {
    background-color: rgba(30, 64, 175, 0.1);
    color: var(--primary-color);
    font-weight: 600;
    padding-left: 22px;
}

.nav-subtab.active::before {
    transform: scaleX(1);
}

/* ========== CONTENU DES ONGLETS ========== */
.tab-content {
    display: none;
    padding: 32px 24px;
    flex: 1;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

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

.tab-content.active {
    display: block;
}

/* ========== SECTIONS ET HEADERS ========== */
.section-header {
    margin-bottom: 32px;
}

.section-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

/* ========== FILTRES ========== */
.filters {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.search-bar {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-bar .search-input {
    flex: 1;
    min-width: 250px;
}

.search-input, .filter-select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: var(--transition);
    background: var(--white);
}

.search-input:focus, .filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

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

/* ========== TABLEAUX REDESIGNÉS ========== */
.table-wrapper {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: linear-gradient(to right, var(--bg-lighter), var(--bg-light));
    border-bottom: 2px solid var(--border);
}

.data-table th {
    padding: 16px 18px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    letter-spacing: 0.3px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background-color: var(--bg-lighter);
}

.data-table td {
    padding: 14px 18px;
    color: var(--text-gray);
    vertical-align: middle;
}

.data-table td strong {
    color: var(--text-dark);
    font-weight: 600;
}

/* Alternance de couleurs */
.data-table tbody tr:nth-child(odd) {
    background-color: var(--white);
}

.data-table tbody tr:nth-child(even) {
    background-color: rgba(249, 250, 251, 0.5);
}

/* ========== BOUTONS ========== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
}

.btn-primary:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--bg-lighter);
    color: var(--primary-dark);
    border: 1.5px solid var(--border);
    font-weight: 500;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

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

.btn-danger:hover {
    background: #b91c1c;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

.btn-success:hover {
    background: #047857;
    box-shadow: var(--shadow-md);
}

.btn-icon {
    padding: 8px 12px;
    font-size: 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    white-space: nowrap;
}

.btn-edit {
    color: #3b82f6;
}

.btn-edit:hover {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

.btn-edit:active {
    transform: translateY(0);
}

.btn-delete {
    color: #ef4444;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

.btn-delete:active {
    transform: translateY(0);
}

.btn-danger {
    color: #ef4444;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

.btn-danger:active {
    transform: translateY(0);
}

.btn-intervention-badge {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.1) 0%, rgba(30, 64, 175, 0.05) 100%);
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-intervention-badge:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.btn-intervention-badge:active {
    transform: translateY(0);
}

/* ========== FORMULAIRES ========== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
    background: var(--white);
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 12px;
    grid-column: 1 / -1;
    margin-top: 20px;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.form-actions .btn {
    min-width: 120px;
    height: 44px;
    padding: 10px 20px;
}

/* ========== SELECT AVEC BOUTON ADD (Nouvelle Affaire seulement) ========== */
#nouveau .select-container {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

#nouveau .select-container select {
    flex: 1;
    min-width: 0;
}

.btn-quick {
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 16px;
    flex-shrink: 0;
}

#nouveau .btn-quick {
    padding: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ========== STATUT BADGES ========== */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: var(--transition);
}

.status-badge.En\ cours {
    background: rgba(59, 130, 246, 0.1);
    color: #1e40af;
}

.status-badge.Terminé {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success);
}

.status-badge.Facturé {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.status-badge.Annulé {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-gray);
}

.empty-state p {
    margin: 8px 0;
    font-size: 15px;
}

.empty-state p:first-child {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.text-muted {
    color: var(--text-light);
}

/* ========== MODALS ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--white);
    padding: 32px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

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

.modal-content h3 {
    font-size: 22px;
    margin-bottom: 20px;
    color: var(--text-dark);
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: flex-end;
}

/* ========== TOAST ========== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    color: var(--white);
    font-size: 14px;
    font-weight: 500;
    animation: slideInRight 0.3s ease;
    z-index: 2000;
    max-width: 400px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    background: var(--success);
    box-shadow: var(--shadow-lg);
}

.toast.error {
    background: var(--danger);
    box-shadow: var(--shadow-lg);
}

/* ========== SPINNER ========== */
.spinner {
    border: 3px solid var(--bg-lighter);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

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

/* ========== ICÔNES SVG ========== */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

.icon-lg {
    width: 24px;
    height: 24px;
}

/* ========== RESPONSIVE ========== */
.text-right {
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .section-header h2 {
        font-size: 22px;
    }
    
    .tab-content {
        padding: 20px 16px;
    }
    
    .nav-tabs {
        padding: 0 16px;
    }
    
    .table-wrapper {
        border-radius: 0;
        overflow-x: auto;
    }
    
    .data-table {
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 12px 12px;
    }
    
    .modal-content {
        width: 95%;
        padding: 24px;
    }
    
    .filters {
        flex-direction: column;
        gap: 12px;
    }
    
    .search-input,
    .filter-select {
        width: 100%;
        font-size: 16px;
        padding: 12px 14px;
    }
    
    .btn {
        font-size: 14px;
        padding: 10px 16px;
        min-height: 44px;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    /* ===== HEADER ET NAVIGATION ===== */
    .header {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
        gap: 12px;
    }
    
    .header-content {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    
    .header h1 {
        font-size: 16px;
        font-weight: 600;
    }
    
    .header-buttons {
        width: 100%;
        margin-left: 0;
        gap: 8px;
    }
    
    .nav-tabs {
        padding: 0 12px;
        gap: 8px;
        flex-wrap: wrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-tab {
        font-size: 13px;
        padding: 8px 12px;
        white-space: nowrap;
    }
    
    /* ===== SECTIONS ===== */
    .section-header {
        padding: 16px 12px;
    }
    
    .section-header h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .tab-content {
        padding: 12px;
    }
    
    /* ===== FILTRES ===== */
    .filters {
        flex-direction: column;
        gap: 10px;
        padding: 0;
    }
    
    .search-input,
    .filter-select {
        width: 100%;
        font-size: 16px;
        padding: 12px;
        border-radius: 8px;
        border: 1px solid var(--border);
    }
    
    .search-input::placeholder {
        font-size: 14px;
    }
    
    /* ===== TABLEAUX RESPONSIVE ===== */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        margin: 0 -12px;
        padding: 0 12px;
    }
    
    .data-table {
        font-size: 12px;
        width: auto;
        min-width: 100%;
    }
    
    .data-table thead {
        background-color: var(--bg-lighter);
        position: sticky;
        top: 0;
    }
    
    .data-table th {
        padding: 10px 8px;
        font-size: 11px;
        font-weight: 600;
        white-space: nowrap;
        border-bottom: 2px solid var(--border);
    }
    
    .data-table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    .data-table tr:nth-child(odd) {
        background-color: var(--bg-light);
    }
    
    .data-table tr:hover {
        background-color: var(--bg-lighter);
    }
    
    /* ===== FORMULAIRES ===== */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .form-group {
        margin-bottom: 0;
    }
    
    .form-group label {
        font-size: 14px;
        font-weight: 500;
        margin-bottom: 8px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    input[type="url"],
    select,
    textarea {
        width: 100%;
        font-size: 16px;
        padding: 12px;
        border-radius: 8px;
        border: 1px solid var(--border);
    }
    
    textarea {
        min-height: 100px;
        resize: vertical;
    }
    
    /* ===== BOUTONS ===== */
    .btn {
        width: 100%;
        font-size: 14px;
        padding: 12px 16px;
        min-height: 44px;
        border-radius: 8px;
        justify-content: center;
    }
    
    .btn-sm {
        width: auto;
        min-height: 36px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .btn-icon {
        width: auto;
        padding: 8px;
        min-height: 36px;
        min-width: 36px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .form-actions .btn {
        width: 100%;
        min-width: auto;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* ===== MODALES ===== */
    .modal-content {
        width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        overflow-y: auto;
        padding: 20px;
        padding-bottom: 40px;
    }
    
    .modal-header {
        font-size: 16px;
        padding: 16px 0;
        border-bottom: 1px solid var(--border);
    }
    
    /* ===== ACTIONS TABLE ===== */
    .table-actions {
        flex-direction: row;
        gap: 8px;
    }
    
    .btn-edit, .btn-delete {
        font-size: 12px;
        padding: 6px 8px;
    }
    
    /* ===== CARDS ET CONTENEURS ===== */
    .settings-card,
    .data-card {
        padding: 16px;
        margin-bottom: 12px;
    }
    
    .settings-card h3 {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .settings-card p {
        font-size: 13px;
    }
    
    /* ===== BADGES ===== */
    .btn-intervention-badge {
        font-size: 12px;
        padding: 6px 10px;
        white-space: nowrap;
    }
    
    /* ===== TOASTS ===== */
    .toast {
        bottom: 20px;
        right: 12px;
        left: 12px;
        width: auto;
        font-size: 14px;
        padding: 12px 16px;
    }
    
    /* ===== TEXTE ===== */
    .text-muted {
        font-size: 13px;
    }
    
    .text-right {
        text-align: right;
    }
    
    /* ===== DROPDOWN LISTE ===== */
    .liste-dropdown {
        position: fixed;
        width: auto;
        min-width: 180px;
        max-width: 90vw;
        z-index: 10001;
    }
    
    .nav-subtab {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    /* ===== SCROLL SMOOTH ===== */
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    input, select, textarea, button {
        -webkit-appearance: none;
        appearance: none;
        border-radius: 8px;
    }
    
    /* ===== ICONS TAILLE MOBILE ===== */
    .btn-icon::before {
        font-size: 16px;
    }
    
    /* ===== SPACING ===== */
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 18px;
    }
    
    h2 {
        font-size: 16px;
    }
    
    h3 {
        font-size: 14px;
    }
}

/* ========== OPTIMISATIONS MOBILE ADDITIONNELLES ========== */

/* Safe area pour iPhone avec notch */
@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    
    .modal-content {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* Disable double tap zoom sur inputs */
input, select, textarea, button {
    font-size: 16px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Better touch support */
@media (hover: none) and (pointer: coarse) {
    .btn, button, a {
        min-width: 44px;
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Enlever hover sur tactile */
    .btn:hover, button:hover, a:hover {
        transform: none;
    }
}

/* Keyboard support for iOS */
@supports (-webkit-touch-callout: none) {
    input, select, textarea {
        font-size: 16px;
        background-color: rgba(255, 255, 255, 0.5);
    }
    
    body {
        -webkit-user-select: none;
        -webkit-user-select: text;
        user-select: text;
    }
}

/* Android specific optimizations */
@media (prefers-color-scheme: light) {
    body {
        background-color: #fafbfc;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========== PAGE DE LOGIN ========== */
.login-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    text-align: center;
}

.login-header {
    margin-bottom: 30px;
}

.login-logo {
    max-width: 120px;
    height: auto;
    display: block;
    margin: 0 auto 15px;
}

.login-header p {
    font-size: 14px;
    color: var(--text-gray);
    margin: 8px 0 0 0;
}

.login-form {
    margin-bottom: 20px;
}

.login-form .form-group {
    margin-bottom: 18px;
    text-align: left;
}

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

.login-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.btn-login {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
}

.login-error {
    color: #ef4444;
    font-size: 13px;
    margin-top: 12px;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
    border-left: 3px solid #ef4444;
}

.login-footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-gray);
}

.login-footer p {
    margin: 0;
}

/* Logout Button */
.logout-btn {
    background: #ef4444 !important;
    color: white !important;
}

.logout-btn:hover {
    background: #dc2626 !important;
}

/* ========== IMPRESSION ==========*/
@media print {
    .header,
    .nav-tabs,
    .filters,
    .header-buttons {
        display: none;
    }
    
    .tab-content {
        padding: 0;
    }
    
    .btn {
        display: none;
    }
}
