/* components.css */

/* --- Cards --- */
.card{
    background:var(--card-bg); border:1px solid var(--border);
    border-radius:var(--radius); box-shadow:var(--shadow);
    padding:var(--space-6);
}

/* --- Titres / textes utilitaires --- */
.fs20{ font-size:var(--fs-20); }
.fs18{ font-size:var(--fs-18); }
.muted{ color:var(--muted); }

/* --- Boutons --- */
.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    border:1px solid transparent;
    border-radius:12px;
    padding:8px 12px;
    font-weight:700;
    letter-spacing:.2px;
    cursor:pointer;
    transition: .18s background, .18s border-color, .18s box-shadow, .18s transform;
    text-decoration:none;
    line-height:1.1;
    font-size:14px;
}
.btn-sm{ padding:6px 10px; font-size:13px; }
.btn-lg{ padding:12px 16px; font-size:15px; }
.btn:active{ transform:translateY(0); }

.btn-primary{
    background:var(--brand); color:#fff; box-shadow:0 8px 16px rgba(0,115,234,.18);
}
.btn-primary:hover{ background:var(--brand-600); box-shadow:0 12px 20px rgba(0,115,234,.24); }

.btn-subtle{
    background:#fff !important;
    color:#0b1324 !important;
    border:1px solid var(--border) !important;
}
.btn-subtle:hover{
    border-color:var(--border-strong) !important;
    background:var(--brand-50) !important;
}

.btn-ghost{
    background:transparent !important; color:var(--brand) !important; border:1px dashed var(--border) !important;
}
.btn-ghost:hover{ background:var(--brand-50); border-color:var(--brand-100); }

/* Héritage de ton ancienne .btn-brand si tu veux garder la classe */
.btn-brand{ composes: btn btn-primary; }

/* --- Camera bottom sheet --- */
.camera-sheet-backdrop{
    position:fixed; inset:0; background:rgba(15,23,42,.55);
    opacity:0; visibility:hidden; pointer-events:none;
    transition:opacity .2s ease;
    z-index:1050;
}

.camera-sheet{
    position:fixed; left:0; right:0; bottom:0;
    max-width:560px; margin:0 auto;
    background:var(--card-bg, #fff);
    border-radius:20px 20px 0 0;
    box-shadow:0 -10px 30px rgba(0,0,0,.2);
    transform:translateY(100%);
    transition:transform .25s ease;
    z-index:1051;
    display:flex; flex-direction:column;
    max-height:92vh;
}

.camera-sheet-open .camera-sheet-backdrop{ opacity:1; visibility:visible; pointer-events:auto; }
.camera-sheet-open .camera-sheet{ transform:translateY(0); }

body.camera-sheet-locked{ overflow:hidden; }

.camera-sheet-handle{
    width:44px; height:5px; border-radius:999px;
    background:var(--border-strong, #cbd5e1);
    margin:10px auto 0;
}

.camera-sheet-header{
    display:flex; align-items:center; justify-content:space-between;
    padding:10px 16px;
}

.camera-sheet-title{ font-size:15px; font-weight:700; margin:0; }

.camera-sheet-close{
    border:none; background:transparent; font-size:22px; line-height:1;
    cursor:pointer; color:var(--muted, #64748b);
}

.camera-sheet-body{
    position:relative; background:#000;
    aspect-ratio:3 / 4; max-height:60vh; overflow:hidden;
}

.camera-sheet-video, .camera-sheet-preview-image{
    width:100%; height:100%; object-fit:cover; display:block;
}

.camera-sheet-error{
    position:absolute; inset:0;
    display:flex; align-items:center; justify-content:center;
    padding:16px; color:#fff; text-align:center;
    background:rgba(15,23,42,.85);
}

.camera-sheet-controls{
    display:flex; align-items:center; justify-content:space-between; gap:12px;
    padding:14px 16px calc(14px + env(safe-area-inset-bottom));
}

.camera-sheet-shutter{
    width:56px; height:56px; border-radius:50%; padding:0; font-size:20px;
}

/* --- Vehicle document cards --- */
.document-card{
    display:flex; flex-direction:column; gap:8px;
    height:100%;
    padding:14px;
    border:1.5px solid var(--border);
    border-radius:14px;
    background:var(--card-bg, #fff);
    transition:border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.document-card.has-document{
    border-color:#16a34a;
    background:#f0fdf4;
    box-shadow:0 0 0 1px rgba(22,163,74,.15);
}

.document-card-header{
    display:flex; align-items:flex-start; gap:8px;
}

.document-card-icon{ font-size:16px; line-height:1.3; flex-shrink:0; }

.document-card-name{
    font-size:13px; font-weight:700; flex:1;
    line-height:1.3;
}

.document-status-badge{
    flex-shrink:0;
    font-size:11px; font-weight:700;
    padding:3px 8px;
    border-radius:999px;
    background:#f1f5f9; color:var(--muted, #64748b);
    white-space:nowrap;
}

.document-card.has-document .document-status-badge{
    background:#dcfce7; color:#15803d;
}

.document-card-link{
    font-size:12px;
    text-decoration:none;
    color:var(--brand, #0073ea);
}
.document-card-link:hover{ text-decoration:underline; }

.document-card-actions{
    display:flex; flex-wrap:wrap; gap:8px;
    margin-top:auto;
}

.document-upload-filename:empty{ display:none; }

.file-dropzone.has-document{
    border-color:#16a34a !important;
    background:#f0fdf4;
}

/* --- Badges --- */
.badge{
    display:inline-flex;
    align-items:center;
    gap:6px;
    font-size:12px;
    padding:6px 10px;
    border-radius:999px;
    background:#f3f4f6 !important;
    color:#374151 !important;
    border:1px solid #e5e7eb !important;
}
.badge-success {
    background:var(--success-100) !important;
    color:#065f46 !important;
    border-color:#a7f3d0 !important;
}
.badge-danger{
    background:var(--danger-100);
    color:#991b1b;
    border-color:#fecdd3;
}
.badge-warning{
    background:var(--warning-100) !important;
    color:#854d0e !important;
    border-color:#fde68a !important;
}

/* --- Inputs / Select / Search --- */
.input, input[type="text"], input[type="email"], input[type="search"], input[type="number"], input[type="password"], input[type="tel"], input[type="url"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"], select, textarea{
    width:100%;
    box-sizing:border-box;
    border:1px solid var(--input-border);
    background:var(--input-bg);
    border-radius:12px;
    padding:12px 14px;
    font-size:var(--fs-15); color:var(--text);
    transition:.18s border, .18s box-shadow, .18s background;
    outline:none;
}
/* Les inputs natifs (dont type="date") ont une hauteur de rendu interne
   qui leur est propre ; on fige une hauteur commune pour qu'ils s'alignent
   avec les autres champs au lieu de paraître plus grands. */
.input, input[type="text"], input[type="email"], input[type="search"], input[type="number"], input[type="password"], input[type="tel"], input[type="url"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"], select{
    height:46px;
}
textarea{ min-height:96px; }
.input:focus, input:focus, select:focus, textarea:focus{
    border-color:var(--brand); box-shadow:0 0 0 3px var(--input-focus);
}
input::placeholder{ color:#9aa7bf; }
select{ background-image: none; }

/* Les widgets date/heure natifs héritent sinon d'une police et d'un interlignage
   propres au navigateur, qui décalent le texte dans la hauteur fixée ci-dessus. */
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"]{
    line-height:1.2; font-family:inherit;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator{
    cursor:pointer; opacity:.5; transition:.18s opacity;
}
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="time"]:hover::-webkit-calendar-picker-indicator,
input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator,
input[type="month"]:hover::-webkit-calendar-picker-indicator{
    opacity:1;
}

/* --- Case à cocher mise en avant --- */
.check-highlight{
    display:flex; gap:14px; align-items:flex-start;
    padding:14px 16px; border-radius:12px;
    background:var(--brand-50); border:1px solid var(--brand-100);
    cursor:pointer;
}
.check-highlight:hover{ border-color:var(--brand); }
.check-highlight input[type="checkbox"]{
    width:22px; height:22px; min-width:22px; margin:2px 0 0;
    accent-color:var(--brand); cursor:pointer;
}
.check-highlight > span{
    font-weight:600; font-size:var(--fs-15); line-height:1.35;
}
.check-highlight .check-hint{ margin:4px 0 0; font-size:13px; font-weight:400; }

/* --- Tables --- */
.table{
    width:100%; border-collapse:separate; border-spacing:0;
}
.table thead th{
    font-weight:700; color:var(--muted); text-transform:uppercase; font-size:12px;
    padding:.65rem .75rem; background:#f8fafc; border-bottom:1px solid var(--border);
}
.table td{
    padding:.75rem .8rem; border-bottom:1px solid var(--border);
}
.table tr:hover td{ background:#fbfdff; }

/* --- KPI tuiles --- */
.kpi-row{
    display:grid; grid-template-columns:repeat(4,1fr); gap:12px;
}
@media (max-width: 900px){ .kpi-row{ grid-template-columns:repeat(2,1fr); } }
.kpi{
    background: #fff;
    border:1px solid var(--border);
    border-radius:14px; padding:16px;
    width: 45%;
}
.kpi .kpi-label{ font-size:12px; color:var(--muted); }
.kpi .kpi-value{ font-size:26px; font-weight:800; }
.kpi .kpi-note{ margin-top:6px; }

/* --- Quickbar (barre de recherche/filtre) --- */
.quickbar{
    display:flex; gap:10px; flex-wrap:wrap; align-items:center;
}
.quickbar .input{ min-width:260px; flex:1; }


.form-grid {
    display: grid;
    gap: 1rem;
}
.form-grid label {
    font-weight: 500;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: .5rem .75rem;
    width: 100%;
}


/* @layer components { ... } si tu segmentes par layer */

.topbar{
    position:sticky; top:0; z-index:1000;
    display:flex; align-items:center; justify-content:space-between;
    padding: var(--space-3) var(--space-6);
    background:#fff; border-bottom:1px solid var(--border);
}

.topbar .brand{
    font-weight:800; letter-spacing:.2px;
    color:var(--brand); text-decoration:none; font-size:var(--fs-18);
}

.topnav{ display:flex; align-items:center; gap: var(--space-4); }

.toplink{
    text-decoration:none; color:var(--text); font-weight:600;
    padding:8px 10px; border-radius:10px; transition:.18s background;
}
.toplink:hover{ background:var(--brand-50); }

.account{ position:relative; }
.account-btn{
    list-style:none; display:flex; align-items:center; gap:8px; cursor:pointer;
    border:1px solid var(--border); border-radius:999px; padding:6px 10px; background:#fff;
    font-weight:600;
}
.account[open] .account-btn{ background:var(--brand-50); border-color:var(--brand-100); }

.account .menu{
    position:absolute; right:0; margin-top:8px; min-width:220px;
    background:#fff; border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow);
    padding:6px; display:grid; gap:4px;
}
.account .menu a{
    display:block; padding:10px 12px; border-radius:8px;
    text-decoration:none; color:var(--text); font-weight:500;
}
.account .menu a:hover{ background:#f5f7fb; }

.btn {
    border-radius: var(--radius-bootstrap) !important;
}

.btn-primary {
    background: var(--brand) !important;
    color: #fff !important;
    border-color: var(--brand) !important;
}

/* --- Auto-complétion collaborateurs (planning) --- */
.ac-field{ position:relative; }

.ac-results{
    position:absolute; left:0; right:0; top:calc(100% + 4px); z-index:20;
    max-height:260px; overflow:auto;
    background:#fff; border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow);
    padding:6px; display:grid; gap:2px;
}
.ac-results[hidden]{ display:none; }
.ac-option{
    display:grid; gap:2px; width:100%; text-align:left;
    padding:8px 10px; border:0; border-radius:8px; background:transparent; cursor:pointer;
}
.ac-option:hover{ background:var(--brand-50); }
.ac-option-name{ font-weight:600; font-size:14px; }
.ac-option-meta{ font-size:12px; }
.ac-empty{ padding:8px 10px; font-size:13px; }

.ac-selected{
    list-style:none; margin:12px 0 0; padding:0;
    display:flex; flex-wrap:wrap; gap:8px;
}
.ac-chip{
    display:inline-flex; align-items:center; gap:8px;
    padding:6px 10px; border-radius:999px;
    background:var(--brand-50); border:1px solid var(--brand-100);
    font-size:13px; font-weight:500;
}
.ac-chip-remove{
    border:0; background:transparent; cursor:pointer; line-height:1;
    font-size:16px; color:var(--muted); padding:0;
}
.ac-chip-remove:hover{ color:var(--text); }
.ac-empty-list{ font-size:13px; }
