:root {
    --bg: #ffffff;
    --text: #2c3e50;
    --muted: #5f6368;
    --border: #e9ecef;
    --card: #ffffff;
    --hover: #f8f9fa;
}

[data-theme='dark'] {
    --bg: #0f1115;
    --text: #e5e7eb;
    --muted: #9aa0a6;
    --border: #1f232b;
    --card: #151922;
    --hover: #1b2030;
}

.bg-surface {
    background: var(--bg) !important;
}

.text-surface {
    color: var(--text) !important;
}

.border-surface {
    border-color: var(--border) !important;
}

/* Dashboard professionnel et épuré */

.dashboard-container {
    min-height: 100%;
    background: var(--bg);
}

.dashboard-header {
    background: var(--card) !important;
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
}

.dashboard-header h1 {
    font-weight: 600;
    color: var(--text);
    margin: 0;
    font-size: 1.75rem;
}

/* Cartes de statistiques sobres */
.stat-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.15s ease;
    overflow: hidden;
    background: var(--card);
}

.stat-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* Tableau épuré */
.table-modern {
    border: none;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
    background: var(--card);
}

.table-modern thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--hover);
    border: none;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    padding: 0.875rem 1rem;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(180%) blur(6px);
}

.table-modern tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.1s ease;
    color: var(--text);
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

.table-modern tbody tr:hover td {
    background-color: var(--hover) !important;
}

/* Indicateurs de statut discrets */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Badges épurés */
.badge {
    font-weight: 500;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    border: none;
}

/* Skeleton loader discret */
.placeholder-glow .placeholder {
    border-radius: 6px;
    background: var(--hover);
}

/* Responsive design */
@media (max-width: 768px) {
    .dashboard-header .row {
        text-align: center;
    }

    .dashboard-header .text-md-end {
        justify-content: center !important;
        margin-top: 1rem;
    }

    .table-modern thead th {
        font-size: 0.8rem;
        padding: 0.75rem 0.5rem;
    }

    .table-modern tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }
}

/* Effets de survol subtils */
.card {
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

/* Style pour la recherche épurée */
.input-group-sm .form-control {
    border-radius: 6px;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.input-group-sm .form-control:focus {
    border-color: #6c757d;
    box-shadow: 0 0 0 0.1rem rgba(108, 117, 125, 0.15);
}

.input-group-text {
    border-radius: 6px 0 0 6px;
    border: 1px solid #dee2e6;
    border-right: none;
    background-color: #f8f9fa;
    color: #6c757d;
}

/* Messages d'alerte discrets */
.alert {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

/* Animation pour le refresh */
.btn:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Couleurs subtiles pour les états */
.bg-success-subtle {
    background-color: #d4edda !important;
    color: #155724 !important;
}

.bg-danger-subtle {
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

.bg-warning-subtle {
    background-color: #fff3cd !important;
    color: #856404 !important;
}

.bg-info-subtle {
    background-color: #d1ecf1 !important;
    color: #0c5460 !important;
}

.bg-secondary-subtle {
    background-color: #e2e3e5 !important;
    color: #383d41 !important;
}

.bg-primary-subtle {
    background-color: #cce5ff !important;
    color: #004085 !important;
}

/* Effets de focus accessibles */
.btn:focus,
.form-control:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(108, 117, 125, 0.25);
}

/* Transitions douces */
* {
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

/* Styles pour l'export PDF */
@media print,
(prefers-color-scheme: print) {
    body.pdf-export-mode .no-print {
        display: none !important;
    }

    body.pdf-export-mode {
        overflow: visible !important;
        height: auto !important;
    }

    .report-container {
        overflow: visible !important;
        height: auto !important;
    }

    .report-section {
        page-break-inside: avoid;
        overflow: visible !important;
    }

    .page-break-before {
        page-break-before: always;
    }

    .avoid-break {
        page-break-inside: avoid;
    }

    .report-machine-card {
        page-break-inside: avoid;
        margin-bottom: 2rem;
    }

    canvas {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Fix double scroll - force scroll to happen ONLY inside the article container */
html,
body {
    margin: 0;
    padding: 0;
    height: 100% !important;
    overflow: hidden !important;
}

body {
    width: 100%;
    margin: 0;
    padding: 0;
}

.page {
    width: 100%;
}

.report-container {
    width: 100%;
    overflow-x: hidden;
}

.report-container .row {
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
}

.report-container .col,
.report-container [class*="col-"] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.report-container .table-responsive {
    overflow-x: auto;
    max-width: 100%;
}