/* =============================================================================
 * admin-apple-polish.css — Phase 4
 *
 * Surcouche additive d'esthétique "Apple / macOS-like" par-dessus le Bootstrap
 * legacy. Purement visuel : pas de bouleversement de layout, pas d'override
 * des classes de grille, rien qui casse l'existant.
 *
 * Approches :
 *   - SF Pro stack + typographie raffinée
 *   - Spacing 8pt : padding/gap sur cards et forms
 *   - Ombres douces multi-couches (Apple-style drop-shadow)
 *   - Radius 10-14px généreux
 *   - Interactions : hover translate-y-1px + shadow boost
 *   - Buttons bootstrap : radius 10px, padding augmenté, focus ring 3px
 *   - Inputs : border radius 10px, focus ring primary
 *   - Tables admin : hover row, border-radius on container
 *   - Dark mode : déjà géré par admin-ergonomic-v2, on hérite des vars
 *
 * Override targeté avec .adm-scope pour limiter l'impact à l'admin.
 * ============================================================================= */

:root {
    /* Apple-like system font stack + numéric tabular */
    --adm-font-system: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --adm-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    /* Spacing 8pt */
    --adm-s-1: 4px;   --adm-s-2: 8px;
    --adm-s-3: 12px;  --adm-s-4: 16px;
    --adm-s-5: 20px;  --adm-s-6: 24px;
    --adm-s-8: 32px;  --adm-s-10: 40px;

    /* Shadows Apple-style (multi-layer doux) */
    --adm-sh-xs: 0 1px 2px rgba(15,23,42,0.04), 0 1px 1px rgba(15,23,42,0.03);
    --adm-sh-sm: 0 2px 4px rgba(15,23,42,0.05), 0 1px 2px rgba(15,23,42,0.04);
    --adm-sh-md: 0 4px 12px rgba(15,23,42,0.07), 0 2px 4px rgba(15,23,42,0.04);
    --adm-sh-lg: 0 10px 25px rgba(15,23,42,0.08), 0 4px 8px rgba(15,23,42,0.05);
    --adm-sh-xl: 0 20px 40px rgba(15,23,42,0.12), 0 8px 16px rgba(15,23,42,0.06);

    /* Radius */
    --adm-r-sm: 6px;  --adm-r-md: 10px;
    --adm-r-lg: 14px; --adm-r-xl: 18px;

    /* Transitions */
    --adm-trans: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="dark"] {
    --adm-sh-xs: 0 1px 2px rgba(0,0,0,0.3), 0 1px 1px rgba(0,0,0,0.2);
    --adm-sh-sm: 0 2px 4px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.2);
    --adm-sh-md: 0 4px 12px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.25);
    --adm-sh-lg: 0 10px 25px rgba(0,0,0,0.45), 0 4px 8px rgba(0,0,0,0.3);
}

/* === Typographie =========================================================== */
/* Fix 2026-04-19 : ne plus forcer SF Pro globalement (créait décalage avec Nunito du thème).
   On garde juste antialiasing et features OpenType, laissant le thème piloter font-family. */
body.adm-scope, body[class*="admin"] {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "tnum" 1;
}
body.adm-scope code, body.adm-scope pre { font-family: var(--adm-font-mono); }

/* Nombres en colonnes (tabular lining) pour KPI */
body.adm-scope .card .text-20, body.adm-scope .text-value,
body.adm-scope .number-lg, body.adm-scope [class*="fs-"],
body.adm-scope .stat-value, body.adm-scope td.numeric {
    font-variant-numeric: tabular-nums;
}

/* === Cards ================================================================== */
body.adm-scope .card {
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: var(--adm-r-lg);
    box-shadow: var(--adm-sh-sm);
    transition: transform var(--adm-trans), box-shadow var(--adm-trans);
}
body.adm-scope .card:hover {
    box-shadow: var(--adm-sh-md);
}
:root[data-theme="dark"] body.adm-scope .card {
    border-color: rgba(148, 163, 184, 0.12);
    background: rgba(30, 41, 59, 0.7);
}

body.adm-scope .card-header {
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    padding: var(--adm-s-4) var(--adm-s-5);
    font-weight: 600;
    letter-spacing: -0.01em;
}
body.adm-scope .card-body { padding: var(--adm-s-5); }

/* === Buttons ================================================================ */
body.adm-scope .btn {
    border-radius: var(--adm-r-md);
    padding: 0.5rem 1rem;
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: transform var(--adm-trans), box-shadow var(--adm-trans), background-color var(--adm-trans);
    box-shadow: var(--adm-sh-xs);
    border-width: 1px;
}
body.adm-scope .btn:hover { transform: translateY(-1px); box-shadow: var(--adm-sh-sm); }
body.adm-scope .btn:active { transform: translateY(0); }
body.adm-scope .btn:focus-visible {
    outline: 3px solid rgba(99, 102, 241, 0.35);
    outline-offset: 2px;
    box-shadow: var(--adm-sh-sm);
}
body.adm-scope .btn-primary {
    background: linear-gradient(180deg, #6366f1, #4f46e5);
    border-color: #4f46e5;
}
body.adm-scope .btn-primary:hover { background: linear-gradient(180deg, #7377ff, #5a51e6); border-color: #5a51e6; }
body.adm-scope .btn-success { background: linear-gradient(180deg, #10b981, #059669); border-color: #059669; }
body.adm-scope .btn-danger  { background: linear-gradient(180deg, #f43f5e, #e11d48); border-color: #e11d48; }
body.adm-scope .btn-sm { padding: 0.3rem 0.7rem; font-size: 0.825rem; }
body.adm-scope .btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* === Form inputs ============================================================ */
body.adm-scope .form-control, body.adm-scope .form-select,
body.adm-scope input[type="text"], body.adm-scope input[type="email"],
body.adm-scope input[type="password"], body.adm-scope input[type="search"],
body.adm-scope input[type="number"], body.adm-scope input[type="tel"],
body.adm-scope input[type="url"], body.adm-scope textarea, body.adm-scope select {
    border-radius: var(--adm-r-md);
    border: 1px solid rgba(15, 23, 42, 0.12);
    padding: 0.55rem 0.85rem;
    transition: border-color var(--adm-trans), box-shadow var(--adm-trans);
    background-clip: padding-box;
}
body.adm-scope .form-control:focus, body.adm-scope .form-select:focus,
body.adm-scope input:focus, body.adm-scope textarea:focus, body.adm-scope select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
:root[data-theme="dark"] body.adm-scope .form-control,
:root[data-theme="dark"] body.adm-scope input, :root[data-theme="dark"] body.adm-scope textarea,
:root[data-theme="dark"] body.adm-scope select {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(148, 163, 184, 0.25);
    color: #e2e8f0;
}

body.adm-scope label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #475569;
    margin-bottom: 0.35rem;
    letter-spacing: -0.003em;
}
:root[data-theme="dark"] body.adm-scope label { color: #cbd5e1; }

/* === Tables ================================================================= */
body.adm-scope .table {
    border-radius: var(--adm-r-md);
    overflow: hidden;
}
body.adm-scope .table thead th {
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    background: rgba(248, 250, 252, 0.7);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    padding: 0.75rem 1rem;
}
:root[data-theme="dark"] body.adm-scope .table thead th {
    background: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    border-bottom-color: rgba(148, 163, 184, 0.15);
}
body.adm-scope .table tbody td {
    padding: 0.72rem 1rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    vertical-align: middle;
}
:root[data-theme="dark"] body.adm-scope .table tbody td { border-bottom-color: rgba(148, 163, 184, 0.08); }
body.adm-scope .table tbody tr { transition: background-color 80ms; }
body.adm-scope .table tbody tr:hover { background: rgba(99, 102, 241, 0.04); }
:root[data-theme="dark"] body.adm-scope .table tbody tr:hover { background: rgba(99, 102, 241, 0.12); }

/* === Badges ================================================================= */
body.adm-scope .badge {
    font-weight: 500;
    letter-spacing: 0.01em;
    border-radius: 999px;
    padding: 0.3rem 0.65rem;
    font-size: 0.72rem;
}

/* === Sidebar ================================================================ */
body.adm-scope .sidebar-left .nav-item a,
body.adm-scope .sidebar-left-secondary .sub-menu a {
    border-radius: var(--adm-r-md);
    margin: 2px 8px;
    padding: 0.55rem 0.85rem;
    transition: background-color var(--adm-trans), color var(--adm-trans);
}
body.adm-scope .sidebar-left .nav-item a:hover,
body.adm-scope .sidebar-left-secondary .sub-menu a:hover {
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
}
body.adm-scope .sidebar-left .nav-item.active > a,
body.adm-scope .sidebar-left .nav-item a.active {
    background: rgba(99, 102, 241, 0.18);
    color: #6366f1;
    font-weight: 500;
}

/* === Alerts =================================================================  */
body.adm-scope .alert {
    border-radius: var(--adm-r-md);
    border-left: 4px solid;
    padding: 0.75rem 1rem;
    box-shadow: var(--adm-sh-xs);
}
body.adm-scope .alert-success { background: rgba(16, 185, 129, 0.08); border-left-color: #10b981; color: #065f46; }
body.adm-scope .alert-danger  { background: rgba(239, 68, 68, 0.08);  border-left-color: #ef4444; color: #991b1b; }
body.adm-scope .alert-warning { background: rgba(245, 158, 11, 0.08); border-left-color: #f59e0b; color: #92400e; }
body.adm-scope .alert-info    { background: rgba(59, 130, 246, 0.08); border-left-color: #3b82f6; color: #1e40af; }
:root[data-theme="dark"] body.adm-scope .alert-success { color: #6ee7b7; }
:root[data-theme="dark"] body.adm-scope .alert-danger  { color: #fca5a5; }
:root[data-theme="dark"] body.adm-scope .alert-warning { color: #fcd34d; }
:root[data-theme="dark"] body.adm-scope .alert-info    { color: #93c5fd; }

/* === Modals ================================================================= */
body.adm-scope .modal-content {
    border-radius: var(--adm-r-xl);
    border: none;
    box-shadow: var(--adm-sh-xl);
    overflow: hidden;
}
body.adm-scope .modal-header {
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    padding: 1.1rem 1.4rem;
}
body.adm-scope .modal-body { padding: 1.2rem 1.4rem; }
body.adm-scope .modal-footer {
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    padding: 1rem 1.4rem;
    background: rgba(248, 250, 252, 0.5);
}

/* === Dropdowns ============================================================== */
body.adm-scope .dropdown-menu {
    border-radius: var(--adm-r-md);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: var(--adm-sh-lg);
    padding: 0.35rem;
    margin-top: 0.4rem !important;
}
body.adm-scope .dropdown-item {
    border-radius: var(--adm-r-sm);
    padding: 0.45rem 0.75rem;
    font-size: 0.88rem;
    transition: background-color 80ms;
}
body.adm-scope .dropdown-item:hover,
body.adm-scope .dropdown-item:focus {
    background: rgba(99, 102, 241, 0.08);
    color: #6366f1;
}

/* === Scrollbar douce ======================================================== */
body.adm-scope *::-webkit-scrollbar { width: 10px; height: 10px; }
body.adm-scope *::-webkit-scrollbar-track { background: transparent; }
body.adm-scope *::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.3); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
body.adm-scope *::-webkit-scrollbar-thumb:hover { background-color: rgba(100,116,139,0.5); background-clip: content-box; }

/* === Animations subtiles ==================================================== */
body.adm-scope .card, body.adm-scope .badge, body.adm-scope .btn,
body.adm-scope .table-responsive, body.adm-scope .dropdown-menu {
    will-change: transform;
}

/* Réduction du motion pour accessibilité */
@media (prefers-reduced-motion: reduce) {
    body.adm-scope * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    body.adm-scope .btn:hover, body.adm-scope .card:hover { transform: none; }
}

/* === Compat classes iframe / header ========================================= */
.main-header { box-shadow: var(--adm-sh-sm) !important; }
.breadcrumb { background: transparent; padding-left: 0; }
.breadcrumb-item + .breadcrumb-item::before { color: #94a3b8; }

/* === Print mode ============================================================= */
@media print {
    body.adm-scope .card, body.adm-scope .table { box-shadow: none !important; border: 1px solid #ccc; }
    body.adm-scope .btn { display: none; }
}
