/* ═══════════════════════════════════════════════════════
   PPI Manager — Symfony CSS
   Design inspiré du thème Hostinger Horizons original
   ═══════════════════════════════════════════════════════ */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #e0e7ff;
    --accent: #7c3aed;
    --accent-light: #ede9fe;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f0f4ff;
    --bg-700: #f8fafc;
    --white: #ffffff;
    --text: #1e293b;
    --text2: #010813;
    --text-muted: #64748b;
    --text-white: #fafbfd;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    /* background: linear-gradient(135deg, #06b6d4 0%, #4f46e5 30%, #7c3aed 55%, #a855f7 75%, #d946ef 100%); */
    /* background: linear-gradient(to top, #a8edea 0%, #fed6e3 100%); */
    background: #faf7f0;
    background-attachment: fixed;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Navbar ─── */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: linear-gradient(135deg, #d2edf1 0%);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 60px;
    box-shadow: var(--shadow);
}
.navbar-brand { display: flex; align-items: center; gap: 10px; }
.navbar-brand strong { font-size: 16px; display: block; }
.navbar-brand small { font-size: 11px; color: var(--text); }
.navbar-logo { font-size: 28px; }
.navbar-menu { display: flex; gap: 4px; }
.nav-link {
    padding: 8px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
    color: var(--text); transition: all .15s; white-space: nowrap;
}
.nav-link:hover { background: var(--bg-700); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--primary); color: #fff; }
.navbar-user { display: flex; align-items: center; gap: 12px; }
.user-badge { font-size: 13px; font-weight: 500; color: var(--text2); }
.nav-link.logout { color: var(--danger); }

/* ─── Topbar / Breadcrumbs ─── */
.topbar {
    margin-top: 60px; padding: 10px 24px;
    /* background: linear-gradient(135deg, #06b6d4 0%, #4f46e5 30%, #7c3aed 55%, #a855f7 75%, #d946ef 100%);  */
    background: #e4ebea; 
    font-size: 13px;
}
.topbar-breadcrumb a { color: var(--text-white); }
.topbar-breadcrumb .sep { margin: 0 6px; color: var(--border); }
.topbar-breadcrumb .current { color: var(--text-white); font-weight: 500; }

/* ─── Main Content ─── */
.main-content { padding: 24px; max-width: 1400px; margin: 0 auto; }
.app-body .main-content { margin-top: 0; }

/* ─── Page Header ─── */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.page-title { font-size: 28px; font-weight: 800; color: var(--text2); }
/* .page-subtitle { font-size: 14px; color: var(--text-white); margin-top: 2px; } */
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 12px; align-items: center; }
.filter-form { display: flex; gap: 8px; align-items: center; }

/* ─── Widgets ─── */
.widgets-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.widget {
    background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; display: flex; justify-content: space-between; align-items: center;
    box-shadow: var(--shadow); transition: transform .15s;
}
.widget:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.widget-content { display: flex; flex-direction: column; }
.widget-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.widget-value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.widget-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.widget-icon.blue { background: #dbeafe; }
.widget-icon.green { background: #dcfce7; }
.widget-icon.orange { background: #fef3c7; }
.widget-icon.purple { background: #ede9fe; }

/* ─── Info Banner ─── */
.info-banner {
    background: #dbeafe; border-left: 4px solid #3b82f6; color: #1e40af;
    padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 20px;
}

/* ─── Cards ─── */
.card {
    background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden;
}
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }

/* ─── Tables ─── */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
    background: var(--bg-700); color: var(--text-muted); font-weight: 600;
    padding: 10px 12px; text-align: left; font-size: 11px; text-transform: uppercase;
    letter-spacing: .05em; border-bottom: 2px solid var(--border); white-space: nowrap;
}
.table tbody td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--bg-700); }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-bold { font-weight: 700 !important; }
.text-red { color: var(--danger) !important; }
.text-green { color: var(--success) !important; }
.text-muted { color: var(--text-muted) !important; }
.bg-red-light { background: #fef2f2 !important; }
.bg-green-light { background: #f0fdf4 !important; }

/* ─── Badges ─── */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-orange { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; cursor: pointer;
    border: 1px solid transparent; transition: all .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, #4338ca, #6d28d9); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-700); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ─── Forms ─── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .required, span.required { color: #ef4444; font-weight: 700; margin-left: 2px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 14px; background: var(--white);
    transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-checkbox { width: 16px; height: 16px; accent-color: var(--primary); }
.form-errors { margin-top: 4px; }
.form-error { color: var(--danger); font-size: 12px; }
.has-error .form-input, .has-error .form-select { border-color: var(--danger); }
.form-help { display: block; margin-top: 6px; padding: 8px 12px; background: #f1f5f9; border-left: 3px solid var(--primary); border-radius: 4px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.form-help strong { color: var(--text); }

/* ─── Alerts ─── */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-danger, .alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ─── Login ─── */
.login-body { background: linear-gradient(135deg, #06b6d4 0%, #4f46e5 30%, #7c3aed 55%, #a855f7 75%, #d946ef 100%); min-height: 100vh; }
.login-body .main-content { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
    background: var(--white); border-radius: 16px; padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,.15); width: 100%; max-width: 400px;
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { font-size: 48px; display: block; margin-bottom: 12px; }
.login-header h1 { font-size: 24px; font-weight: 700; }
.login-header p { color: var(--text-muted); font-size: 14px; }
.login-form .form-group { margin-bottom: 18px; }

/* ─── Admin Nav ─── */
.admin-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.admin-nav-item {
    padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    text-align: center; font-weight: 600; font-size: 13px; color: var(--text);
    transition: all .15s;
}
.admin-nav-item:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); text-decoration: none; }

/* ─── Info Grid ─── */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.info-item { display: flex; align-items: center; gap: 12px; }
.info-icon { font-size: 24px; width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--bg-700); }

/* ─── Link ─── */
.link-primary { color: var(--primary); font-weight: 600; }
.link-primary:hover { color: var(--primary-dark); }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .navbar { flex-direction: column; height: auto; padding: 10px; gap: 8px; }
    .navbar-menu { flex-wrap: wrap; justify-content: center; }
    .form-grid { grid-template-columns: 1fr; }
    .widgets-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

/* ═══════════════════════════════════════════════════════
   WYSIWYG Éditeur
   ═══════════════════════════════════════════════════════ */
.wysiwyg-wrapper { border: 2px solid #d1d5db; border-radius: 8px; overflow: hidden; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.wysiwyg-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 8px 10px; background: #f1f5f9; border-bottom: 2px solid #d1d5db; }
.wysiwyg-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 28px; border: 1px solid transparent; border-radius: 4px; background: none; cursor: pointer; font-size: 13px; color: #475569; transition: all 0.15s; }
.wysiwyg-btn:hover { background: #e2e8f0; border-color: #cbd5e1; color: #1e293b; }
.wysiwyg-btn:active { background: #cbd5e1; }
.wysiwyg-sep { width: 1px; height: 20px; background: #cbd5e1; margin: 0 4px; }
.wysiwyg-format { padding: 4px 6px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 12px; color: #475569; background: #fff; cursor: pointer; margin-right: 6px; }
.wysiwyg-format:focus { outline: none; border-color: var(--primary); }
.wysiwyg-editor { min-height: 250px; padding: 16px 20px; font-size: 14px; line-height: 1.7; color: #333; outline: none; overflow-y: auto; max-height: 600px; border: none; }
.wysiwyg-editor:focus { box-shadow: inset 0 0 0 2px rgba(79,70,229,0.1); }
.wysiwyg-editor p { margin: 0 0 8px 0; }
.wysiwyg-editor h2 { font-size: 20px; font-weight: 700; margin: 12px 0 6px; color: #1e293b; }
.wysiwyg-editor h3 { font-size: 17px; font-weight: 600; margin: 10px 0 4px; color: #334155; }
.wysiwyg-editor h4 { font-size: 15px; font-weight: 600; margin: 8px 0 4px; color: #475569; }
.wysiwyg-editor blockquote { border-left: 3px solid var(--primary); margin: 8px 0; padding: 8px 16px; background: #f1f5f9; color: #475569; border-radius: 0 6px 6px 0; }
.wysiwyg-editor ul, .wysiwyg-editor ol { margin: 4px 0; padding-left: 24px; }
.wysiwyg-editor hr { border: none; border-top: 1px solid #e2e8f0; margin: 12px 0; }

/* ═══════════════════════════════════════════════════════
   Tableau Dashboard — Sticky header & colonnes figées
   ═══════════════════════════════════════════════════════ */
.sticky-table-wrap {
    max-height: calc(100vh - 380px);
    min-height: 300px;
    overflow: auto;
    position: relative;
}
.sticky-table { border-collapse: separate; border-spacing: 0; }

/* Header sticky vertical */
.sticky-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #eef2ff;
}

/* Colonnes sticky horizontal */
.sticky-table .sticky-col {
    position: sticky;
    background: var(--white);
    z-index: 1;
}
.sticky-table tbody tr:hover .sticky-col { background: var(--bg-700); }

.sticky-table .sticky-col-1 { left: 0; min-width: 140px; max-width: 180px; }
.sticky-table .sticky-col-2 { left: 140px; min-width: 140px; max-width: 180px; }
.sticky-table .sticky-col-3 { left: 280px; min-width: 220px; max-width: 280px; box-shadow: 4px 0 6px -2px rgba(0,0,0,0.08); }

/* Coins sticky (header + colonne sticky) — z-index plus élevé */
.sticky-table thead th.sticky-col { z-index: 4; background: #eef2ff; }

/* Largeurs raisonnables sur les colonnes de données */
.sticky-table tbody td:not(.sticky-col),
.sticky-table thead th:not(.sticky-col) { min-width: 90px; }
/* ═══════════════════════════════════════════════════════
   Années verrouillées dans le formulaire prévisionnel
   ═══════════════════════════════════════════════════════ */
.locked-year-input {
    background: #f1f5f9 !important;
    color: #94a3b8 !important;
    cursor: not-allowed !important;
    border-color: #e2e8f0 !important;
}
.locked-year-header {
    background: #f1f5f9 !important;
    color: #64748b !important;
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════
   Rapports d'édition (vues groupées)
   ═══════════════════════════════════════════════════════ */
.sticky-table .sticky-col-rapport { left: 0; min-width: 320px; max-width: 380px; box-shadow: 4px 0 6px -2px rgba(0,0,0,0.08); }
.sticky-table tbody tr:hover .sticky-col-rapport { background: var(--bg-700); }
.sticky-table tbody tr.rapport-group-header:hover .sticky-col-rapport { background: #dbeafe; }
.sticky-table tbody tr.rapport-subtotal:hover .sticky-col-rapport { background: #eff6ff; }
.sticky-table tbody tr.rapport-total:hover .sticky-col-rapport { background: #1e3a8a; }
