/* ================================================================
   ANALYTEK CENTRE HOSPITALIER — Design System v2.0
   Compatible : .NET 10 · Blazor Web · MudBlazor 8 · VS 2026
   ================================================================ */

/* ── Variables de design ─────────────────────────────────────── */
:root {
    --ach-primary:        #1A237E;   /* Bleu profond */
    --ach-primary-light:  #3949AB;
    --ach-primary-dark:   #0D1457;
    --ach-secondary:      #00897B;   /* Vert teal médical */
    --ach-accent:         #E91E63;   /* Rose accent urgence */
    --ach-bg:             #F0F2F8;
    --ach-surface:        #FFFFFF;
    --ach-success:        #2E7D32;
    --ach-warning:        #F57F17;
    --ach-error:          #C62828;
    --ach-info:           #0277BD;
    --ach-sidebar-width:  260px;
    --ach-sidebar-bg:     #1A237E;
    --ach-appbar-height:  64px;
    --ach-radius:         12px;
    --ach-radius-sm:      8px;
    --ach-shadow:         0 2px 12px rgba(26,35,126,0.10);
    --ach-shadow-lg:      0 8px 32px rgba(26,35,126,0.15);
    --ach-transition:     all 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0; padding: 0;
    height: 100%;
    background: var(--ach-bg);
    color: #1C1F26;
    -webkit-font-smoothing: antialiased;
}

/* ── Scrollbars ──────────────────────────────────────────────── */
::-webkit-scrollbar              { width: 5px; height: 5px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: rgba(26,35,126,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover  { background: rgba(26,35,126,0.45); }

/* ── AppBar ──────────────────────────────────────────────────── */
.mud-appbar {
    backdrop-filter: blur(12px) !important;
    background: linear-gradient(135deg, var(--ach-primary) 0%, var(--ach-primary-light) 100%) !important;
    box-shadow: var(--ach-shadow) !important;
    height: var(--ach-appbar-height) !important;
}

.ach-appbar-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #fff;
}

.ach-appbar-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    font-size: 13px;
    color: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.2);
}

/* ── Sidebar / Drawer ────────────────────────────────────────── */
.mud-drawer {
    background: var(--ach-sidebar-bg) !important;
    border-right: none !important;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15) !important;
}

.mud-drawer .mud-nav-link {
    color: rgba(255,255,255,0.75) !important;
    border-radius: var(--ach-radius-sm) !important;
    margin: 2px 10px !important;
    padding: 10px 14px !important;
    transition: var(--ach-transition) !important;
    font-size: 14px;
}

.mud-drawer .mud-nav-link:hover {
    background: rgba(255,255,255,0.12) !important;
    color: #fff !important;
}

.mud-drawer .mud-nav-link.active {
    background: rgba(255,255,255,0.18) !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: inset 3px 0 0 rgba(255,255,255,0.7) !important;
}

.mud-nav-group .mud-nav-group-title {
    color: rgba(255,255,255,0.45) !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 1.2px !important;
    text-transform: uppercase !important;
    padding: 12px 24px 4px !important;
}

.mud-nav-group-toggle-icon {
    color: rgba(255,255,255,0.5) !important;
}

/* Logo sidebar */
.ach-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 8px;
}

.ach-sidebar-logo-icon {
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}

.ach-sidebar-logo-text {
    flex: 1;
    min-width: 0;
}

.ach-sidebar-logo-title {
    font-size: 14px; font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.ach-sidebar-logo-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

/* Séparateur de section sidebar */
.ach-nav-section {
    padding: 8px 16px 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    margin-top: 6px;
}

/* ── Main Content ────────────────────────────────────────────── */
.mud-main-content {
    background: var(--ach-bg) !important;
    overflow-y: auto !important;
}

/* ── Cards & Papers ──────────────────────────────────────────── */
.mud-paper {
    border-radius: var(--ach-radius) !important;
    box-shadow: var(--ach-shadow) !important;
    transition: var(--ach-transition) !important;
}

.mud-paper:hover { box-shadow: var(--ach-shadow-lg) !important; }

/* Card KPI */
.ach-kpi-card {
    background: var(--ach-surface);
    border-radius: var(--ach-radius);
    padding: 20px;
    box-shadow: var(--ach-shadow);
    transition: var(--ach-transition);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.ach-kpi-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
}

.ach-kpi-card.kpi-blue::before   { background: var(--ach-primary); }
.ach-kpi-card.kpi-teal::before   { background: var(--ach-secondary); }
.ach-kpi-card.kpi-orange::before { background: var(--ach-warning); }
.ach-kpi-card.kpi-red::before    { background: var(--ach-error); }
.ach-kpi-card.kpi-green::before  { background: var(--ach-success); }

.ach-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ach-shadow-lg);
}

.ach-kpi-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--ach-primary);
}

.ach-kpi-label {
    font-size: 12px;
    color: #6B7280;
    margin-top: 4px;
    font-weight: 500;
}

.ach-kpi-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}

/* ── Boutons ─────────────────────────────────────────────────── */
.mud-button-filled-primary {
    background: linear-gradient(135deg, var(--ach-primary-light) 0%, var(--ach-primary) 100%) !important;
    box-shadow: 0 4px 12px rgba(26,35,126,0.3) !important;
    border-radius: var(--ach-radius-sm) !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
}

.mud-button-filled-primary:hover {
    box-shadow: 0 6px 16px rgba(26,35,126,0.4) !important;
    transform: translateY(-1px) !important;
}

.mud-button-outlined {
    border-radius: var(--ach-radius-sm) !important;
}

/* ── Formulaires ─────────────────────────────────────────────── */
.mud-input-outlined .mud-input-outlined-border {
    border-radius: var(--ach-radius-sm) !important;
    border-color: #E5E7EB !important;
    transition: var(--ach-transition) !important;
}

.mud-input-outlined:focus-within .mud-input-outlined-border {
    border-color: var(--ach-primary) !important;
    box-shadow: 0 0 0 3px rgba(26,35,126,0.08) !important;
}

.mud-input-label { font-weight: 500 !important; }

/* ── Tables ──────────────────────────────────────────────────── */
.mud-table {
    border-radius: var(--ach-radius) !important;
    overflow: hidden !important;
}

.mud-table-head .mud-table-cell {
    background: #F8FAFF !important;
    color: #374151 !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
    padding: 12px 16px !important;
    border-bottom: 2px solid #E5E7EB !important;
}

.mud-table-row:hover { background: #F0F4FF !important; }
.mud-table-cell { padding: 11px 16px !important; vertical-align: middle !important; font-size: 14px; }
.mud-table-striped .mud-table-row:nth-child(even) { background: #F9FAFC !important; }

/* ── Chips & Badges ──────────────────────────────────────────── */
.mud-chip {
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 2px 10px !important;
    height: auto !important;
}

/* ── Alertes MudAlert ────────────────────────────────────────── */
.mud-alert {
    border-radius: var(--ach-radius-sm) !important;
    border: none !important;
}

/* ── Tabs ────────────────────────────────────────────────────── */
.mud-tabs-tabbar {
    background: #F8FAFF !important;
    border-bottom: 2px solid #E5E7EB !important;
    border-radius: var(--ach-radius) var(--ach-radius) 0 0 !important;
}

.mud-tab-slider {
    background: var(--ach-primary) !important;
    height: 3px !important;
    border-radius: 3px !important;
}

/* ── Page Header ─────────────────────────────────────────────── */
.ach-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.ach-page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ach-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ach-page-subtitle {
    font-size: 13px;
    color: #6B7280;
    margin-top: 2px;
}

/* ── Patient Banner ──────────────────────────────────────────── */
.ach-patient-banner {
    background: linear-gradient(135deg, var(--ach-primary) 0%, var(--ach-primary-light) 60%, #5C6BC0 100%);
    border-radius: var(--ach-radius);
    padding: 20px 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

.ach-patient-banner::after {
    content: '';
    position: absolute;
    right: -30px; top: -30px;
    width: 160px; height: 160px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}

.ach-patient-avatar {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800; color: #fff;
    border: 2px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}

/* ── Statut chips colorés ────────────────────────────────────── */
.chip-actif     { background: #DCFCE7 !important; color: #15803D !important; }
.chip-inactif   { background: #FEE2E2 !important; color: #DC2626 !important; }
.chip-attente   { background: #FEF3C7 !important; color: #D97706 !important; }
.chip-complete  { background: #DCFCE7 !important; color: #15803D !important; }
.chip-urgent    { background: #FEE2E2 !important; color: #DC2626 !important; animation: pulse 1.5s infinite; }
.chip-info      { background: #DBEAFE !important; color: #1D4ED8 !important; }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ach-animate { animation: fadeInUp 0.35s ease both; }
.ach-animate-delay-1 { animation-delay: 0.05s; }
.ach-animate-delay-2 { animation-delay: 0.10s; }
.ach-animate-delay-3 { animation-delay: 0.15s; }
.ach-animate-delay-4 { animation-delay: 0.20s; }

/* ── Login page ──────────────────────────────────────────────── */
.ach-login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--ach-primary-dark) 0%, var(--ach-primary) 45%, var(--ach-primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.ach-login-bg::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    top: -200px; right: -150px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.ach-login-bg::after {
    content: '';
    position: absolute;
    width: 350px; height: 350px;
    bottom: -120px; left: -100px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
}

.ach-login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.25);
    position: relative;
    z-index: 1;
}

.ach-login-icon-wrap {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--ach-primary-light), var(--ach-primary));
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(26,35,126,0.3);
}

/* ── Impression ──────────────────────────────────────────────── */
@media print {
    .mud-drawer, .mud-appbar, .no-print,
    .ach-page-header .mud-button,
    .nav-btn { display: none !important; }
    .mud-main-content { margin: 0 !important; padding: 0 !important; }
    .mud-paper { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
    .ach-kpi-value { font-size: 1.6rem; }
    .ach-page-title { font-size: 1.2rem; }
    .ach-login-card { padding: 28px 20px; margin: 16px; }
}

/* ── Blazor error UI ─────────────────────────────────────────── */
#blazor-error-ui {
    background: var(--ach-error);
    color: white;
    bottom: 0; left: 0; right: 0;
    display: none;
    padding: 10px 20px;
    position: fixed;
    z-index: 9999;
    font-size: 14px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 16px; top: 8px;
    font-size: 18px;
}
