/* public/assets/css/app.css */
/* Base SIGB — compléter selon la charte graphique */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary:  #2563eb;
    --color-success:  #16a34a;
    --color-danger:   #dc2626;
    --color-warning:  #d97706;
    --color-muted:    #6b7280;
    --color-border:   #e5e7eb;
    --color-bg:       #f9fafb;
    --color-surface:  #ffffff;
    --radius:         6px;
    --shadow:         0 1px 3px rgba(0,0,0,.1);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 16px; line-height: 1.5; background: var(--color-bg); color: #111827;
       display: flex; flex-direction: column; min-height: 100vh; }

/* ---- Navbar ---- */
.navbar { background: #1e293b; padding: .75rem 1.5rem;
          display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.navbar-brand a { color: #fff; font-size: 1.2rem; font-weight: 800; text-decoration: none;
                  letter-spacing: .05em; }
.navbar-menu { list-style: none; display: flex; gap: .25rem; flex-wrap: wrap; }
.navbar-item { background: var(--item-color); color: #fff; text-decoration: none;
               font-size: .9rem; font-weight: 700; padding: .45rem .9rem;
               border-radius: var(--radius); transition: filter .15s; }
.navbar-item:hover { filter: brightness(1.15); }
.navbar-item.active { background: #fff; color: var(--item-color);
                      box-shadow: 0 0 0 2px var(--item-color); }
.navbar-right { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.navbar-localisation select { font-size: .875rem; padding: .25rem .4rem; border-radius: var(--radius); }
.navbar-localisation-name { font-size: .85rem; color: #94a3b8; }
.navbar-username { font-size: .875rem; color: #94a3b8; white-space: nowrap; }
.navbar-logout { background: rgba(220,38,38,.85) !important; color: #fff !important; }
.navbar-logout:hover { background: #dc2626 !important; opacity: 1; }

/* ---- Page wrapper (sidebar secondaire + contenu) ---- */
.page-wrapper { display: flex; flex: 1; }
.app-content  { flex: 1; min-width: 0; }

/* ---- Sidebar secondaire (sous-items de la section active) ---- */
.sidebar { width: 200px; min-width: 200px; background: #f8fafc;
           border-right: 1px solid #e2e8f0; padding-top: .5rem; }
.sidebar-title { padding: .5rem 1rem .4rem; font-size: .75rem; font-weight: 700;
                 text-transform: uppercase; letter-spacing: .07em;
                 color: var(--section-color); border-bottom: 2px solid var(--section-color);
                 margin-bottom: .25rem; }
.sidebar-items { list-style: none; }
.sidebar-items li a { display: block; padding: .65rem 1rem .65rem 1.25rem; font-size: .95rem;
                      color: #374151; text-decoration: none;
                      border-left: 4px solid transparent; transition: background .1s; }
.sidebar-items li a:hover { background: #f1f5f9; color: #111;
                            border-left-color: var(--section-color); }
.sidebar-items li a.active { font-weight: 700; background: var(--section-color);
                             color: #fff; border-left-color: var(--section-color); }
.sidebar-group-label { padding: .5rem 1rem .2rem; font-size: .7rem; font-weight: 700;
                       text-transform: uppercase; letter-spacing: .07em; color: #94a3b8;
                       pointer-events: none; }
.sidebar-separator   { height: 1px; background: #e2e8f0; margin: .3rem 0; pointer-events: none; }

/* ---- Container ---- */
.container { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }

/* ---- Page header ---- */
.page-header { display: flex; justify-content: space-between; align-items: center;
               margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }

/* ---- Cards ---- */
.card { background: var(--color-surface); border: 1px solid var(--color-border);
        border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem;
        box-shadow: var(--shadow); }
.card h2 { font-size: 1rem; font-weight: 600; margin-bottom: .75rem; }

/* ---- Boutons ---- */
.btn { display: inline-block; padding: .4rem .9rem; border: none; border-radius: var(--radius);
       cursor: pointer; font-size: .875rem; text-decoration: none; line-height: 1.5; }
.btn-primary   { background: var(--color-primary); color: #fff; }
.btn-success   { background: var(--color-success); color: #fff; }
.btn-danger    { background: var(--color-danger);  color: #fff; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-link      { background: none; color: var(--color-primary); }
.btn-sm        { padding: .2rem .6rem; font-size: .8rem; }
.btn-lg        { padding: .6rem 1.4rem; font-size: 1rem; }
.btn-block     { display: block; width: 100%; text-align: center; }
.btn:hover     { opacity: .88; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; background: var(--color-surface);
         border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: .55rem .75rem; text-align: left;
                        border-bottom: 1px solid var(--color-border); }
.table th { background: #f3f4f6; font-weight: 600; font-size: .8rem; text-transform: uppercase; }
.table tbody tr:hover { background: #f9fafb; }
.table-sm td, .table-sm th { padding: .3rem .5rem; }
.row-retard { background: #fef2f2 !important; }
.row-expire { background: #fff7ed !important; }
.row-disabled { opacity: .6; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: .15rem .45rem; border-radius: 999px;
         font-size: .75rem; font-weight: 600; background: #e5e7eb; color: #374151; }
.badge-danger  { background: #fee2e2; color: var(--color-danger); }
.badge-ok      { background: #dcfce7; color: var(--color-success); }
.badge-section { background: #ede9fe; color: #6d28d9; }

/* ---- Formulaires ---- */
.form-group { margin-bottom: .75rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
input[type=text], input[type=email], input[type=number], input[type=date],
input[type=password], select, textarea {
    width: 100%; padding: .4rem .6rem; border: 1px solid #d1d5db;
    border-radius: var(--radius); font-size: .875rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--color-primary); border-color: transparent; }
.form-inline { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }
.form-actions { margin-top: 1rem; display: flex; gap: .75rem; align-items: center; }

/* ---- Filter bar ---- */
.filter-bar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
              margin-bottom: 1rem; background: var(--color-surface);
              padding: .75rem; border: 1px solid var(--color-border); border-radius: var(--radius); }
.filter-bar input, .filter-bar select { width: auto; }
.input-search { min-width: 220px; }
.input-scan   { font-size: 1.1rem; letter-spacing: .05em; }

/* ---- Alertes flash ---- */
.flash-messages { margin-bottom: 1rem; }
.alert { padding: .65rem 1rem; border-radius: var(--radius); margin-bottom: .5rem; font-size: .875rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---- Stats ---- */
.stats-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-card  { background: var(--color-surface); border: 1px solid var(--color-border);
              border-radius: var(--radius); padding: 1rem 1.5rem; text-align: center;
              box-shadow: var(--shadow); min-width: 120px; flex: 1; }
.stat-card-total { background: #eff6ff; border-color: #bfdbfe; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--color-primary); }
.stat-label { font-size: .8rem; color: var(--color-muted); margin-top: .25rem; }

/* ---- Notice grid ---- */
.notice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.notice-card { background: var(--color-surface); border: 1px solid var(--color-border);
               border-radius: var(--radius); padding: .75rem; box-shadow: var(--shadow); }
.notice-cover { width: 100%; height: 150px; object-fit: contain; border-radius: 4px; margin-bottom: .5rem; background: #f3f4f6; }
.notice-cover-placeholder { width: 100%; height: 150px; background: #e5e7eb; display: flex;
                            align-items: center; justify-content: center;
                            font-size: 2rem; color: var(--color-muted); margin-bottom: .5rem; }
.notice-titre { font-weight: 600; text-decoration: none; color: #111; display: block; margin-bottom: .3rem; }
.notice-auteurs { font-size: .8rem; color: var(--color-muted); margin-bottom: .3rem; }
.notice-meta    { display: flex; gap: .3rem; flex-wrap: wrap; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: .5rem; margin-top: 1rem; }
.pagination a { padding: .3rem .6rem; border: 1px solid var(--color-border);
                border-radius: var(--radius); text-decoration: none; color: var(--color-primary); }
.pagination a.active { background: var(--color-primary); color: #fff; border-color: transparent; }

/* ---- Login ---- */
.page-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box  { background: var(--color-surface); border: 1px solid var(--color-border);
              border-radius: var(--radius); padding: 2rem; width: 380px; box-shadow: var(--shadow); }
.login-box h1 { font-size: 1.5rem; text-align: center; margin-bottom: .25rem; color: var(--color-primary); }
.login-box h2 { font-size: 1rem; text-align: center; color: var(--color-muted); margin-bottom: 1.5rem; }

/* ---- Utilitaires ---- */
.text-center { text-align: center; }
.text-muted  { color: var(--color-muted); }
.result-count { font-size: .875rem; color: var(--color-muted); margin-bottom: .75rem; }
code { background: #f3f4f6; padding: .1rem .35rem; border-radius: 3px; font-size: .85em; }

/* ---- Print (étiquettes) ---- */
@media print {
    .sidebar, .btn, .filter-bar { display: none !important; }
    .app-layout { display: block; }
    body { background: #fff; }
}

/* ---- Grilles 2 colonnes ---- */
.grid-2col       { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-2col   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 768px) {
    .grid-2col, .form-row-2col { grid-template-columns: 1fr; }
}

/* ---- Definition lists ---- */
.definition-list { display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem; align-items: baseline; }
.definition-list dt { font-weight: 600; color: var(--color-muted); font-size: .8rem; white-space: nowrap; }
.definition-list dd { margin: 0; }
.definition-list--inline dt { white-space: normal; }

/* ---- Card header row ---- */
.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.card-header-row h2 { margin-bottom: 0; }

/* ---- Code block (modèles email) ---- */
.code-block { background: #f3f4f6; padding: .5rem .75rem; border-radius: var(--radius);
              font-family: monospace; font-size: .8rem; white-space: pre-wrap;
              display: block; margin-top: .25rem; }

/* ---- Text colors ---- */
.text-success { color: var(--color-success); }
.badge-warning { background: #fef3c7; color: var(--color-warning); }

/* ---- Required marker ---- */
.required { color: var(--color-danger); font-weight: 700; }

/* ---- Header actions ---- */
.header-actions { display: flex; gap: .5rem; align-items: center; }


/* ---- Badge warning ---- */
.badge-warning { background: #fef3c7; color: #92400e; }

/* ---- Bouton extra-petit ---- */
.btn-xs { padding: .15rem .4rem; font-size: .75rem; border-radius: .25rem; }

/* ---- Badges identifiants autorités ---- */
.badge-autorite { display: inline-block; padding: .15rem .45rem; border-radius: .25rem;
                  font-size: .78rem; font-weight: 600; text-decoration: none; }
.badge-bnf      { background: #dbeafe; color: #1e40af; }
.badge-bnf:hover{ background: #bfdbfe; }
.badge-ppn      { background: #dcfce7; color: #166534; }
.badge-ppn:hover{ background: #bbf7d0; }
.id-manquant    { color: #9ca3af; }

/* ---- Panneau de choix lors de l'enrichissement ---- */
.choix-panel    { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }

/* ---- Autocomplétion ---- */
.autocomplete-wrapper        { position: relative; }
.autocomplete-list           { display: none; position: absolute; top: 100%; left: 0; right: 0;
                               z-index: 200; background: #fff; border: 1px solid #ced4da;
                               border-top: none; border-radius: 0 0 .375rem .375rem;
                               box-shadow: 0 4px 12px rgba(0,0,0,.12);
                               max-height: 240px; overflow-y: auto; }
.autocomplete-list.visible,
.autocomplete-list:not(:empty) { display: block; }
.autocomplete-item           { padding: .45rem .75rem; cursor: pointer; font-size: .9rem;
                               border-bottom: 1px solid #f0f0f0; }
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover     { background: #e9f0fd; color: #1a56db; }
