/* ============================================================
   SécuFeu Pro - Feuille de style principale
   Prévention & Sécurité Incendie - ISO 9001/45001
   ============================================================ */

:root {
    --rouge: #c0392b;
    --rouge-dark: #96281b;
    --rouge-light: #f1948a;
    --orange: #e67e22;
    --vert: #27ae60;
    --vert-light: #a9dfbf;
    --bleu: #2980b9;
    --bleu-dark: #1a5276;
    --gris: #7f8c8d;
    --gris-light: #ecf0f1;
    --blanc: #ffffff;
    --noir: #2c3e50;
    --jaune: #f39c12;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --radius: 8px;
    --transition: 0.25s ease;
}

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

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f0f2f5;
    color: var(--noir);
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.app-wrapper { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-logo {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-logo .logo-icon {
    font-size: 42px;
    display: block;
    margin-bottom: 6px;
}

.sidebar-logo h1 {
    font-size: 18px;
    font-weight: 700;
    color: #ff6b6b;
    letter-spacing: 1px;
}

.sidebar-logo p {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}

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

.nav-section {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 13px;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,107,107,0.15);
    border-left-color: #ff6b6b;
    color: white;
}

.sidebar-nav a .nav-icon { font-size: 16px; width: 20px; text-align: center; }

/* MAIN CONTENT */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* TOPBAR */
.topbar {
    background: white;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--noir);
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-actions { display: flex; gap: 10px; align-items: center; }

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--gris-light);
    border-radius: 20px;
    font-size: 13px;
}

.user-avatar {
    width: 30px; height: 30px;
    background: var(--rouge);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 12px;
}

/* PAGE CONTENT */
.page-content { padding: 24px; flex: 1; }

/* ============================================================
   COMPOSANTS
   ============================================================ */

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, white 100%);
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 20px; }

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform var(--transition);
}

.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
    width: 56px; height: 56px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-icon.rouge { background: #fdecea; color: var(--rouge); }
.stat-icon.vert { background: #eafaf1; color: var(--vert); }
.stat-icon.orange { background: #fef5e7; color: var(--orange); }
.stat-icon.bleu { background: #ebf5fb; color: var(--bleu); }

.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--gris); margin-top: 4px; }

/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary { background: var(--rouge); color: white; }
.btn-primary:hover { background: var(--rouge-dark); }
.btn-success { background: var(--vert); color: white; }
.btn-success:hover { background: #219a52; }
.btn-info { background: var(--bleu); color: white; }
.btn-info:hover { background: #2471a3; }
.btn-warning { background: var(--orange); color: white; }
.btn-warning:hover { background: #ca6f1e; }
.btn-secondary { background: var(--gris-light); color: var(--noir); border: 1px solid #ddd; }
.btn-secondary:hover { background: #dde1e4; }
.btn-danger { background: var(--rouge); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-print { background: #455a64; color: white; }
.btn-export { background: #00897b; color: white; }

/* Formulaires */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--noir);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    color: var(--noir);
    transition: border-color var(--transition);
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--rouge);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.1);
}

.form-row {
    display: grid;
    gap: 16px;
}

.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

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

/* Tableaux */
.table-responsive { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
    background: #f8f9fa;
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gris);
    border-bottom: 2px solid #eee;
    white-space: nowrap;
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    vertical-align: middle;
}

tbody tr:hover { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-ok { background: var(--vert-light); color: #145a32; }
.badge-nok { background: #fadbd8; color: #922b21; }
.badge-na { background: #d5d8dc; color: #626567; }
.badge-warn { background: #fdebd0; color: #784212; }
.badge-info { background: #d6eaf8; color: #1a5276; }
.badge-critique { background: #fadbd8; color: #922b21; }
.badge-majeure { background: #fdebd0; color: #784212; }
.badge-mineure { background: #d5f5e3; color: #145a32; }

/* Checklist items */
.checklist-table { width: 100%; }
.checklist-table th { background: #1a1a2e; color: white; padding: 10px 12px; font-size: 12px; }
.checklist-table td { padding: 8px 12px; border-bottom: 1px solid #eee; vertical-align: top; }
.checklist-table .point-label { font-size: 13px; }
.checklist-table tr:nth-child(even) { background: #fafafa; }

.radio-group { display: flex; gap: 12px; align-items: center; }
.radio-group label { display: flex; align-items: center; gap: 4px; cursor: pointer; font-size: 13px; }
.radio-group input[type=radio] { accent-color: var(--rouge); }

.radio-ok label:last-child { color: var(--vert); }
.radio-nok label:nth-child(2) { color: var(--rouge); }

/* Alertes */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.alert-success { background: #eafaf1; border: 1px solid #a9dfbf; color: #145a32; }
.alert-danger  { background: #fdecea; border: 1px solid var(--rouge-light); color: #922b21; }
.alert-warning { background: #fef9e7; border: 1px solid #f9e79f; color: #784212; }
.alert-info    { background: #ebf5fb; border: 1px solid #aed6f1; color: #1a5276; }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #c0392b 100%);
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo .fire-icon { font-size: 60px; display: block; }
.login-logo h1 { color: var(--rouge); font-size: 24px; margin-top: 8px; }
.login-logo p { color: var(--gris); font-size: 12px; }

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-container {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.chart-container h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--noir);
}

/* Progress bar */
.progress {
    background: #eee;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin: 4px 0;
}
.progress-bar { height: 100%; border-radius: 10px; transition: width 0.5s ease; }
.progress-bar.vert { background: var(--vert); }
.progress-bar.rouge { background: var(--rouge); }
.progress-bar.orange { background: var(--orange); }

/* Pagination */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}
.page-link {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: var(--bleu);
    font-size: 13px;
}
.page-link.active {
    background: var(--rouge);
    border-color: var(--rouge);
    color: white;
}

/* Section header couleur */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius) var(--radius) 0 0;
    color: white;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 0;
}
.section-header.rouge { background: var(--rouge); }
.section-header.bleu { background: var(--bleu-dark); }
.section-header.vert { background: var(--vert); }
.section-header.orange { background: var(--orange); }
.section-header.gris { background: #455a64; }

/* Icons SVG inline */
.fire-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fdecea;
    color: var(--rouge);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Print */
@media print {
    .sidebar, .topbar, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
    .page-content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    body { background: white; font-size: 11px; }
    table { font-size: 10px; }
    .print-header { display: block !important; }
    @page { margin: 1cm; }
}

.print-header { display: none; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c0c0c0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }
