/* ===========================================================
   BASE — Variables CSS, reset, typographie, animations
   Design tokens Psychologue.fr — Espace Psychologue
   Meme charte que le patient, fond plus neutre/pro
   =========================================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Couleurs principales */
    --primary: #132055;
    --accent: #5B65DE;
    --accent-hover: #4A54CD;
    --accent-light: #ECEFFE;
    --accent-glow: rgba(91,101,222,0.15);

    /* Surfaces */
    --bg: #F5F6FA;
    --bg-gradient: linear-gradient(135deg, #ECEFFE 0%, #F3F4FF 40%, #F5F6FA 100%);
    --card: #FFFFFF;
    --card-glass: rgba(255,255,255,0.75);
    --border: #E2E4ED;

    /* Texte */
    --text: #132055;
    --text-muted: #6B7294;
    --text-light: #9BA1BF;

    /* Statuts patients */
    --status-active: #16a34a;
    --status-active-bg: rgba(22,163,74,0.08);
    --status-pending: #F59E0B;
    --status-pending-bg: rgba(245,158,11,0.08);
    --status-ghost: #9BA1BF;
    --status-ghost-bg: rgba(155,161,191,0.08);
    --status-old: #6B7294;
    --status-old-bg: rgba(107,114,148,0.08);
    --status-new: #0EA5E9;
    --status-new-bg: rgba(14,165,233,0.08);
    --status-todo: #5B65DE;
    --status-todo-bg: rgba(91,101,222,0.08);

    /* Etats */
    --success: #16a34a;
    --success-bg: rgba(22,163,74,0.08);
    --error: #E5484D;
    --error-bg: #FFF1F0;
    --warning: #F59E0B;
    --warning-bg: rgba(245,158,11,0.08);

    /* Rayons */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-pill: 100px;

    /* Ombres */
    --shadow-sm: 0 1px 3px rgba(19,32,85,0.04), 0 1px 2px rgba(19,32,85,0.06);
    --shadow-md: 0 4px 16px rgba(19,32,85,0.06), 0 2px 6px rgba(19,32,85,0.04);

    /* Typo */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset HTML + body ---- */
html { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    height: 100%;
    display: flex;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ===========================================================
   ANIMATIONS
   =========================================================== */

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

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* ===========================================================
   ACCESSIBILITÉ — Réduction des animations
   =========================================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===========================================================
   PAGES — Affichage SPA (une seule page visible à la fois)
   =========================================================== */

.page { display: none; }
.page.active { display: block; }

/* La messagerie utilise flex quand active */
#page-messages.active { display: flex; }

/* App main container */
.app-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Profile page responsive */
@media (max-width: 900px) {
    #profileContent > div[style*="width:50%"] {
        width: 100% !important;
    }
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-family: var(--font, 'Inter', sans-serif);
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    z-index: 9999;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.toast-success { background: #16a34a; }
.toast-error { background: #E5484D; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }
