/* ============================================================
   AUTHENTIK — Styles globaux
   Complément à Tailwind CSS
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --violet:        #534AB7;
    --violet-dark:   #26215C;
    --violet-mid:    #7F77DD;
    --violet-light:  #EEEDFE;
    --violet-border: #AFA9EC;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: #F5F5F7;
    color: #1A1A2E;
}

/* ── Sidebar ── */
.sidebar {
    width: 220px;
    min-height: 100vh;
    background: var(--violet-dark);
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

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

.sidebar-logo-text {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
}

.sidebar-logo-sub {
    font-size: 11px;
    color: #AFA9EC;
    margin-top: 2px;
}

.nav-group-label {
    font-size: 10px;
    font-weight: 500;
    color: #7F77DD;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 12px;
    margin: 14px 0 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin: 1px 8px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.nav-item i { font-size: 17px; color: #AFA9EC; flex-shrink: 0; }
.nav-item span { font-size: 13px; color: #AFA9EC; white-space: nowrap; }

.nav-item:hover { background: rgba(255,255,255,0.06); }
.nav-item:hover i,
.nav-item:hover span { color: #fff; }

.nav-item.active { background: rgba(83,74,183,0.4); }
.nav-item.active i,
.nav-item.active span { color: #fff; }

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--violet-mid);
    border-radius: 0 4px 4px 0;
}

/* ── Contenu principal ── */
.main-content {
    margin-left: 220px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ── */
.topbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

/* ── Cartes statistiques ── */
.stat-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    padding: 16px 18px;
    transition: box-shadow 0.2s;
}

.stat-card:hover { box-shadow: 0 4px 16px rgba(83,74,183,0.08); }

.stat-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 10px;
}

/* ── Tables ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 500;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
    white-space: nowrap;
}

.data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #F3F4F6;
    color: #1F2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #F9FAFB; }

/* ── Badges statut ── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 500;
    padding: 3px 9px; border-radius: 20px;
    white-space: nowrap;
}

.badge-attente   { background: #FFF3E0; color: #92400E; }
.badge-transit   { background: #EFF6FF; color: #1D4ED8; }
.badge-arrive    { background: #F0FDF4; color: #166534; }
.badge-recupere  { background: var(--violet-light); color: var(--violet-dark); }

/* ── Formulaires ── */
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 5px;
}

.form-label .required { color: #EF4444; margin-left: 2px; }

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #1F2937;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: 'Inter', sans-serif;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(83,74,183,0.1);
}

.form-input.error { border-color: #EF4444; }
.form-error { font-size: 11px; color: #EF4444; margin-top: 4px; }

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

/* ── Boutons ── */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--violet);
    color: #fff;
}
.btn-primary:hover { background: #4640A3; }

.btn-secondary {
    background: #fff;
    color: #374151;
    border: 1px solid #D1D5DB;
}
.btn-secondary:hover { background: #F9FAFB; }

.btn-danger {
    background: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FECACA;
}
.btn-danger:hover { background: #FEE2E2; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Stepper ── */
.stepper {
    display: flex; align-items: center;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    padding: 16px 24px;
}

.step { display: flex; align-items: center; gap: 10px; flex: 1; }

.step-circle {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 500; flex-shrink: 0;
    border: 2px solid #E5E7EB;
    color: #9CA3AF;
    background: #fff;
    transition: all 0.2s;
}

.step.active .step-circle {
    background: var(--violet); border-color: var(--violet); color: #fff;
}
.step.done .step-circle {
    background: #F0FDF4; border-color: #22C55E; color: #16A34A;
}

.step-label { font-size: 13px; font-weight: 500; color: #9CA3AF; }
.step.active .step-label { color: var(--violet); }
.step.done .step-label { color: #16A34A; }
.step-sub { font-size: 11px; color: #D1D5DB; margin-top: 1px; }
.step.active .step-sub { color: #AFA9EC; }

.step-connector {
    flex: 1; height: 2px;
    background: #E5E7EB; margin: 0 12px; flex-shrink: 0;
    max-width: 60px;
    transition: background 0.2s;
}
.step-connector.done { background: #22C55E; }

/* ── Cards ── */
.card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    overflow: hidden;
}

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #F3F4F6;
}

.card-title { font-size: 14px; font-weight: 600; color: #111827; }

/* ── Alertes ── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    display: flex; align-items: flex-start; gap: 10px;
    margin-bottom: 16px;
}

.alert-info    { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.alert-success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.alert-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* ── Auto fields ── */
.auto-field {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 10px 14px;
}
.auto-field-label { font-size: 11px; color: #6B7280; margin-bottom: 3px; }
.auto-field-value { font-size: 13px; font-weight: 500; color: #111827; }
.auto-badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: #F0FDF4; color: #166534;
    font-size: 10px; font-weight: 500;
    padding: 2px 7px; border-radius: 20px; margin-top: 4px;
}

/* ── Pagination ── */
.pagination {
    display: flex; align-items: center; gap: 4px;
}
.page-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 7px; font-size: 13px; cursor: pointer;
    border: 1px solid #E5E7EB; background: #fff; color: #374151;
}
.page-btn.active { background: var(--violet); color: #fff; border-color: var(--violet); }
.page-btn:hover:not(.active) { background: #F3F4F6; }

/* ── Graphique barres ── */
.bar-chart {
    display: flex; align-items: flex-end; gap: 6px;
    height: 120px; padding: 0 4px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-fill {
    width: 100%; border-radius: 4px 4px 0 0;
    background: var(--violet); opacity: 0.8;
    transition: opacity 0.15s;
    min-height: 4px;
}
.bar-fill:hover { opacity: 1; }
.bar-lbl { font-size: 9px; color: #9CA3AF; }

/* ── Mobile sidebar toggle ── */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 90;
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-content { margin-left: 0; }
}

/* ── Loader ── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(83,74,183,0.2);
    border-top-color: var(--violet);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast notifications ── */
.toast-container {
    position: fixed; top: 20px; right: 20px;
    z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    background: #fff; border-radius: 10px;
    padding: 12px 16px; min-width: 280px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    border-left: 4px solid var(--violet);
    animation: slideIn 0.3s ease;
}
.toast.success { border-left-color: #22C55E; }
.toast.error   { border-left-color: #EF4444; }
.toast.warning { border-left-color: #F59E0B; }
.toast-message { font-size: 13px; color: #111827; flex: 1; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
