/* ============================================================
   SANTE AUTH SYSTEM — CSS COMPLET
   Layout : Sidebar fixe gauche + Navbar haut + Contenu droit
   Palette : Bleu marine #1d2d5c
   ============================================================ */

:root {
    --sas-navy:        #1d2d5c;
    --sas-navy-dark:   #141a3e;
    --sas-navy-light:  #253570;
    --sas-ice:         #e8edfb;
    --sas-bg:          #f1f4f9;
    --sas-white:       #ffffff;
    --sas-text:        #1e293b;
    --sas-text-muted:  #64748b;
    --sas-border:      #e2e8f0;
    --sas-success:     #16a34a;
    --sas-error:       #dc2626;
    --sas-warning:     #d97706;
    --sas-sidebar-w:   260px;
    --sas-navbar-h:    64px;
    --sas-radius:      12px;
    --sas-shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --sas-shadow-md:   0 4px 16px rgba(0,0,0,.10);
}

/* ====== RESET DE BASE ====== */
.sas-body {
    margin: 0;
    padding: 0;
    background: var(--sas-bg);
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    color: var(--sas-text);
    min-height: 100vh;
}

/* ====== LAYOUT PRINCIPAL ====== */
.sas-layout {
    display: flex;
    min-height: 100vh;
}

/* ====== SIDEBAR ====== */
.sas-sidebar {
    width: var(--sas-sidebar-w);
    background: var(--sas-navy);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform .25s ease;
    overflow-y: auto;
}

.sas-sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sas-sidebar-logo {
    max-height: 44px;
    width: auto;
    display: block;
    filter: brightness(0) invert(1);
}

.sas-sidebar-brand-text {
    color: var(--sas-white);
    font-size: 18px;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: -.3px;
}

/* ---- Navigation ---- */
.sas-sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sas-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 8px;
    color: rgba(255,255,255,.72);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, color .15s;
    position: relative;
}

.sas-nav-item:hover {
    background: rgba(255,255,255,.08);
    color: var(--sas-white);
}

.sas-nav-item.active {
    background: rgba(255,255,255,.15);
    color: var(--sas-white);
    font-weight: 600;
}

.sas-nav-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: .8;
}

.sas-nav-item.active .sas-nav-icon {
    opacity: 1;
}

.sas-nav-badge {
    margin-left: auto;
    background: rgba(255,255,255,.2);
    color: var(--sas-white);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
}

/* ---- Sidebar footer ---- */
.sas-sidebar-footer {
    padding: 16px 12px 24px;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sas-sidebar-rdv-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255,255,255,.12);
    color: var(--sas-white);
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background .15s;
}

.sas-sidebar-rdv-btn:hover {
    background: rgba(255,255,255,.2);
}

.sas-sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: rgba(255,255,255,.55);
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.sas-sidebar-logout:hover {
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.85);
}

/* ====== MAIN ZONE ====== */
.sas-main {
    margin-left: var(--sas-sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ====== NAVBAR ====== */
.sas-navbar {
    height: var(--sas-navbar-h);
    background: var(--sas-white);
    border-bottom: 1px solid var(--sas-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--sas-shadow);
}

.sas-navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sas-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: var(--sas-text);
    transition: background .15s;
}

.sas-menu-toggle:hover {
    background: var(--sas-bg);
}

.sas-navbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--sas-navy);
    margin: 0;
}

.sas-navbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sas-navbar-role {
    background: var(--sas-ice);
    color: var(--sas-navy);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.sas-navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--sas-text);
}

/* ====== AVATAR ====== */
.sas-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--sas-navy);
    color: var(--sas-white);
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sas-avatar--green { background: #16a34a; }
.sas-avatar--sm { width: 30px; height: 30px; font-size: 12px; }

/* ====== CONTENT ====== */
.sas-content {
    flex: 1;
    padding: 28px 28px 40px;
    max-width: 1200px;
    width: 100%;
    box-sizing: border-box;
}

/* ====== STAT CARDS ====== */
.sas-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.sas-stat-card {
    background: var(--sas-white);
    border-radius: var(--sas-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--sas-shadow);
}

.sas-stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sas-stat-icon--blue   { background: #eff6ff; color: #2563eb; }
.sas-stat-icon--green  { background: #f0fdf4; color: #16a34a; }
.sas-stat-icon--orange { background: #fff7ed; color: #d97706; }
.sas-stat-icon--purple { background: #faf5ff; color: #7c3aed; }

.sas-stat-number {
    font-size: 28px;
    font-weight: 800;
    color: var(--sas-navy);
    line-height: 1.1;
}

.sas-stat-label {
    font-size: 12px;
    color: var(--sas-text-muted);
    margin-top: 2px;
}

/* ====== CARD ====== */
.sas-card {
    background: var(--sas-white);
    border-radius: var(--sas-radius);
    box-shadow: var(--sas-shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.sas-card--narrow {
    max-width: 620px;
}

.sas-card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--sas-border);
}

.sas-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--sas-navy);
    margin: 0;
}

/* ====== TABLE ====== */
.sas-table-wrap {
    overflow-x: auto;
}

.sas-table {
    width: 100%;
    border-collapse: collapse;
}

.sas-table th {
    background: #f8fafc;
    color: var(--sas-text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--sas-border);
    white-space: nowrap;
}

.sas-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--sas-border);
    font-size: 13px;
    color: var(--sas-text);
    vertical-align: middle;
}

.sas-table tr:last-child td {
    border-bottom: none;
}

.sas-table tbody tr:hover {
    background: #fafbfc;
}

/* ====== BADGES ====== */
.sas-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.sas-badge-approved  { background: #dcfce7; color: #15803d; }
.sas-badge-pending   { background: #fef9c3; color: #854d0e; }
.sas-badge-canceled  { background: #fee2e2; color: #b91c1c; }
.sas-badge-upcoming  { background: var(--sas-ice); color: var(--sas-navy); }
.sas-badge-past      { background: #f1f5f9; color: #64748b; }

/* ====== PATIENT CELL ====== */
.sas-patient-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ====== EMPTY STATE ====== */
.sas-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--sas-text-muted);
}

.sas-empty svg { margin-bottom: 12px; display: block; margin-left: auto; margin-right: auto; }
.sas-empty p { margin: 0; font-size: 14px; }

/* ====== FORMULAIRE PROFIL ====== */
.sas-form {
    padding: 24px;
}

.sas-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.sas-field {
    margin-bottom: 16px;
}

.sas-field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--sas-text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 6px;
}

.sas-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--sas-border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--sas-text);
    background: var(--sas-white);
    box-sizing: border-box;
    transition: border-color .15s;
    outline: none;
}

.sas-field input:focus {
    border-color: var(--sas-navy);
}

.sas-field input:disabled {
    background: #f8fafc;
    color: var(--sas-text-muted);
    cursor: not-allowed;
}

/* ====== BOUTONS ====== */
.sas-btn-primary {
    padding: 11px 22px;
    background: var(--sas-navy);
    color: var(--sas-white);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
    display: inline-block;
}

.sas-btn-primary:hover {
    background: var(--sas-navy-light);
    color: var(--sas-white);
}

/* ====== ALERTES ====== */
.sas-alert {
    margin: 0 24px 0;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 0;
}

.sas-alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; margin: 16px 24px; }
.sas-alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; margin: 16px 24px; }

/* ====== INFO BOX ====== */
.sas-info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--sas-ice);
    border-radius: 8px;
    padding: 16px;
    margin: 24px 24px 20px;
    color: var(--sas-navy);
    font-size: 13px;
    line-height: 1.6;
}

.sas-info-box svg { flex-shrink: 0; margin-top: 1px; }
.sas-info-box p { margin: 0; }

.sas-info-box + .sas-btn-primary {
    margin: 0 24px 24px;
}

/* ====== PAGE CONNEXION (inchangée) ====== */
.sas-auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    background: var(--sas-bg);
    box-sizing: border-box;
}

.sas-auth-card {
    background: var(--sas-white);
    border-radius: 16px;
    padding: 40px 36px;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--sas-shadow-md);
}

.sas-auth-card .sas-sidebar-logo {
    filter: none;
    max-height: 48px;
    margin-bottom: 24px;
}

.sas-auth-card h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--sas-navy);
    margin: 0 0 6px;
}

.sas-subtitle {
    color: var(--sas-text-muted);
    font-size: 14px;
    margin: 0 0 24px;
}

/* Tabs dans la page connexion */
.sas-auth-card .sas-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--sas-bg);
    padding: 4px;
    border-radius: 8px;
}

.sas-auth-card .sas-tab {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sas-text-muted);
    text-decoration: none;
    transition: background .15s, color .15s;
}

.sas-auth-card .sas-tab.active {
    background: var(--sas-white);
    color: var(--sas-navy);
    box-shadow: var(--sas-shadow);
}

.sas-auth-card .sas-tab-content { display: none; }
.sas-auth-card .sas-tab-content.active { display: block; }

.sas-auth-card .sas-form .sas-field label {
    font-size: 13px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--sas-navy);
}

.sas-auth-card .sas-btn-primary {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-size: 15px;
    margin-top: 4px;
}

.sas-link {
    display: inline-block;
    margin-top: 16px;
    font-size: 13px;
    color: var(--sas-navy);
    text-decoration: none;
}

.sas-link:hover { text-decoration: underline; }

/* ====== PAGE CHANGER MOT DE PASSE ====== */
.sas-auth-page .sas-auth-card .sas-field input {
    width: 100%;
}

/* ====== MINIMAL HEADER (connexion / changer mdp) ====== */
.sas-minimal-header {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 20px 0;
    box-sizing: border-box;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sas-minimal-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.sas-minimal-logo img {
    max-height: 44px;
    width: auto;
}

.sas-minimal-logo span {
    font-size: 18px;
    font-weight: 800;
    color: var(--sas-navy);
}

.sas-minimal-header .sas-btn-logout {
    position: absolute;
    right: 20px;
    top: 24px;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--sas-bg);
    color: var(--sas-navy);
    border: 1px solid var(--sas-border);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}

.sas-minimal-header .sas-btn-logout:hover {
    background: var(--sas-ice);
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
    .sas-sidebar {
        transform: translateX(-100%);
    }

    .sas-sidebar--open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,.15);
    }

    .sas-main {
        margin-left: 0;
    }

    .sas-menu-toggle {
        display: flex;
    }

    .sas-content {
        padding: 20px 16px 32px;
    }

    .sas-form-row {
        grid-template-columns: 1fr;
    }

    .sas-stat-row {
        grid-template-columns: 1fr 1fr;
    }

    .sas-navbar {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .sas-stat-row {
        grid-template-columns: 1fr;
    }
}
