/* ══════════════════════════════════════════════════════════════
   CRP Psychotraumatologie — Feuille de style (portage Streamlit)
   ══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=DM+Mono:wght@400;500&family=DM+Serif+Display&family=Inter:wght@300;400;500;600;700&display=swap');

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    min-height: 100vh;
}

body {
    background-color: #f1f5f9;
    /* L'image de fond est optionnelle : si assets/background.jpg existe, elle est utilisée */
    background-image: url("../assets/background.jpg"), linear-gradient(135deg, #e0f2fe 0%, #f0fdfa 100%);
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2, h3, h4 { font-family: 'Inter', sans-serif; letter-spacing: -0.01em; }

/* ── Rainbow divider ─────────────────────────────────────── */
.rainbow-divider {
    height: 3px;
    background: linear-gradient(to right, #cc0000, #ff7700, #ffcc00, #007481, #00578a, #6a0dad);
    border-radius: 2px;
    margin: 14px 0;
}

/* ── Titre principal CRP ────────────────────────────────── */
.title-banner {
    text-align: center;
    background-color: #007481;
    border-radius: 15px;
    padding: 6px 16px;
}
.title-banner h1 {
    color: white;
    font-size: 22px;
    margin: 0;
}

/* ── Hero banner d'auth ──────────────────────────────────── */
.hero-banner {
    text-align: center;
    background: linear-gradient(135deg, #007481 0%, #00578a 100%);
    border-radius: 16px;
    padding: 28px 20px 22px;
    margin-bottom: 10px;
    box-shadow: 0 4px 24px rgba(0,87,138,0.18);
}
.hero-banner h1 {
    color: white;
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: 1px;
}
.hero-banner .date-line {
    color: rgba(255,255,255,0.85);
    font-size: 15px;
    margin: 0;
}

/* ── Image héros ────────────────────────────────────────── */
.hero-image {
    height: 300px;
    overflow: hidden;
    border-radius: 10px;
    width: 100%;
    margin: 10px 0;
}
.hero-image img {
    width: 100%;
    height: 300px;
    object-fit: fill;
    display: block;
}

.date-string {
    text-align: center;
    color: #007481;
    font-size: 18px;
    margin: 8px 0;
}

/* ── Carte d'authentification ──────────────────────────── */
.auth-card {
    background: white;
    border-radius: 14px;
    padding: 28px 30px;
    box-shadow: 0 2px 18px rgba(0,87,138,0.10);
    margin: 10px auto;
    max-width: 550px;
}
.auth-card h2 {
    color: #1d4ed8;
    margin-top: 0;
}
.auth-warning {
    color: #cc0000;
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 12px;
}

/* ── Boutons ───────────────────────────────────────────── */
button.btn-primary,
.btn-primary {
    background: linear-gradient(90deg, #007481, #00578a);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    padding: 0.7rem 2rem;
    width: 100%;
    cursor: pointer;
    transition: opacity 0.2s;
    font-family: inherit;
}
button.btn-primary:hover,
.btn-primary:hover { opacity: 0.88; }

button.btn-secondary {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #7dd3fc;
    border-radius: 8px;
    font-weight: 500;
    padding: 0.55rem 1.4rem;
    cursor: pointer;
    font-family: inherit;
}
button.btn-secondary:hover { background: #bae6fd; }

button.btn-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    font-family: inherit;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Formulaires ────────────────────────────────────────── */
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    font-family: inherit;
    color: #0f172a;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #007481;
    box-shadow: 0 0 0 3px rgba(0,116,129,0.15);
}
textarea { resize: vertical; min-height: 60px; }
label {
    display: block;
    font-size: 0.85rem;
    color: #334155;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

/* ── Grille de colonnes ─────────────────────────────────── */
.row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.col { flex: 1 1 200px; }
.col-2 { flex: 2 1 400px; }

/* ── Sections ────────────────────────────────────────────── */
section.main-section {
    background: rgba(255,255,255,0.92);
    padding: 20px 24px;
    border-radius: 12px;
    margin: 16px 0;
    box-shadow: 0 1px 3px rgba(15,23,42,0.05);
}

.section-title {
    color: #1d4ed8;
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0.8rem 0 0.6rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(to right, #cc0000, #ff7700, #ffcc00, #007481, #00578a, #6a0dad) 1;
}

.sec-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.15em;
    color: #64748b;
    text-transform: uppercase;
    margin: 0.6rem 0 0.4rem 0;
    border-left: 3px solid #4a9eff;
    padding-left: 0.6rem;
}

/* ── Cartes colorées ────────────────────────────────────── */
.card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.6rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.card-blue   { border-left: 4px solid #3b82f6; background: #eff6ff; }
.card-teal   { border-left: 4px solid #14b8a6; background: #f0fdfa; }
.card-green  { border-left: 4px solid #22c55e; background: #f0fdf4; }
.card-orange { border-left: 4px solid #f97316; background: #fff7ed; }
.card-red    { border-left: 4px solid #ef4444; background: #fef2f2; }
.card-purple { border-left: 4px solid #a855f7; background: #faf5ff; }
.card-indigo { border-left: 4px solid #6366f1; background: #eef2ff; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}
.badge-none   { background: #e2e8f0; color: #475569; }
.badge-low    { background: #dcfce7; color: #166534; }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-high   { background: #fee2e2; color: #991b1b; }

/* ── Barre de risque ────────────────────────────────────── */
.risk-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin: 0.35rem 0;
}
.risk-fill { height: 100%; border-radius: 6px; transition: width .5s ease; }

/* ── Alerte ─────────────────────────────────────────────── */
.alert-banner {
    background: linear-gradient(90deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #ef4444;
    color: #7f1d1d;
    padding: 0.9rem 1.2rem;
    border-radius: 10px;
    margin: 1rem 0;
    font-weight: 500;
}

/* ── Tag langue ─────────────────────────────────────────── */
.tag-langue {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    background: #e0f2fe;
    color: #075985;
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    margin: 4px 6px 4px 0;
}

/* ── Narratif ───────────────────────────────────────────── */
.narrative {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.4rem 1.8rem;
    line-height: 1.75;
    color: #0f172a;
    font-size: 0.95rem;
}
.narrative h2, .narrative h3 { color: #1d4ed8; margin-top: 1rem; }

/* ── Onglets ────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1rem;
    overflow-x: auto;
}
.tab {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-weight: 500;
    color: #64748b;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    font-size: 0.88rem;
    background: transparent;
    border: none;
    font-family: inherit;
}
.tab.active { color: #007481; border-bottom-color: #007481; }
.tab-content { display: none; padding: 1rem 0; }
.tab-content.active { display: block; }

/* ── Expanders ──────────────────────────────────────────── */
details.expander {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    margin: 0.6rem 0;
}
details.expander summary {
    font-weight: 600;
    cursor: pointer;
    color: #0f172a;
    user-select: none;
}
details.expander[open] summary { margin-bottom: 0.6rem; }

/* ── Slider range ───────────────────────────────────────── */
input[type="range"] {
    width: 100%;
    accent-color: #007481;
}
.slider-row { display: flex; align-items: center; gap: 1rem; }
.slider-value {
    font-family: 'DM Mono', monospace;
    color: #1d4ed8;
    font-weight: 600;
    min-width: 180px;
    font-size: 0.85rem;
}

/* ── Grille de scores ───────────────────────────────────── */
.scale-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.8rem;
    margin: 0.8rem 0;
}

/* ── Barre de progression ───────────────────────────────── */
.progress {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin: 0.5rem 0;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007481, #00578a);
    border-radius: 6px;
    transition: width 0.3s ease;
}
.progress-msg {
    color: #4a9eff;
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
}

/* ── Blinking warning ───────────────────────────────────── */
@keyframes blink {
    0%   { opacity: 1; }
    50%  { opacity: 0; }
    100% { opacity: 1; }
}
.blinking-text {
    animation: blink 1.2s ease-in-out infinite;
    color: #8B0000;
    font-size: 1.1em;
    font-weight: bold;
    text-align: center;
    margin: 10px 0;
}

/* ── Radios horizontaux ─────────────────────────────────── */
.radio-group {
    display: flex;
    gap: 1.2rem;
    margin: 0.4rem 0;
    flex-wrap: wrap;
}
.radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #0f172a;
    margin: 0;
    font-weight: normal;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
    text-align: center;
    color: #64748b;
    font-size: 0.78rem;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* ── Utilitaires ────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.small { font-size: 0.82rem; color: #475569; }

/* ── Tableaux ───────────────────────────────────────────── */
table.clinic-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}
table.clinic-table th,
table.clinic-table td {
    padding: 0.5rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.88rem;
}
table.clinic-table th {
    background: #1e2a3e;
    color: white;
    font-weight: 600;
}
table.clinic-table tr:nth-child(even) td { background: #f8fafc; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .row { flex-direction: column; }
    .col { flex: 1 1 100%; }
    .hero-banner h1 { font-size: 20px; }
    .title-banner h1 { font-size: 17px; }
}

.stars {
    font-family: arial;
    font-weight: bold;
    color: #b8860b;
    font-size: 20px;
    text-align: center;
    margin: 10px 0;
}
