/* ==========================================
   CITIZEN — MOOD CHECK
   Moderne & fun : bulles flottantes, glassmorphism,
   teinte selon l'humeur, animations pop-in.
   ========================================== */

:root {
    --bg-1: #1b1240;
    --bg-2: #2a1d5e;
    --bg-3: #0f0a26;

    --glass: rgba(255, 255, 255, 0.08);
    --glass-strong: rgba(255, 255, 255, 0.16);
    --glass-border: rgba(255, 255, 255, 0.18);

    --text: #f4f1ff;
    --text-muted: #c7bee9;

    --accent: #ffd166;
    --accent-soft: #ffe9a8;
    --danger: #ff6b8b;
    --ok: #8ef0b0;

    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;

    --radius: 18px;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-pop: 0 18px 48px rgba(0, 0, 0, 0.45);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    color: var(--text);
    min-height: 100vh;
    background: var(--bg-3);
    overflow-x: hidden;
    padding-bottom: 130px; /* place pour le bandeau d'ajout sticky */
}

/* Fond dégradé via pseudo-élément fixe (plus performant que background-attachment) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(255, 209, 102, 0.18), transparent 45%),
        radial-gradient(ellipse at 90% 10%, rgba(142, 240, 176, 0.15), transparent 40%),
        radial-gradient(ellipse at 50% 100%, rgba(255, 107, 139, 0.18), transparent 50%),
        linear-gradient(160deg, var(--bg-1), var(--bg-2) 45%, var(--bg-3));
    pointer-events: none;
}

/* ==========================================
   FOCUS VISIBLE (accessibilité clavier)
   ========================================== */
.avatar:focus-visible,
.mood:focus-visible,
.btn:focus-visible,
.seance-name:focus-visible,
.modal-close:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.avatar:focus-visible {
    /* l'avatar est en transform translate, on garde l'outline lisible */
    outline-offset: 4px;
}

/* ==========================================
   BULLES FLOTTANTES (décor)
   ========================================== */
.bubble-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.25), rgba(255, 209, 102, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.12);
    animation: driftBubble linear infinite;
    opacity: 0.35;
}

@keyframes driftBubble {
    0%   { transform: translateY(0) scale(0.9); opacity: 0; }
    15%  { opacity: 0.35; }
    85%  { opacity: 0.3; }
    100% { transform: translateY(-40vh) scale(1.05); opacity: 0; }
}

/* ==========================================
   HEADER
   ========================================== */
.topbar {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem clamp(1rem, 4vw, 2.5rem);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.brand-mark {
    font-size: 1.9rem;
    filter: drop-shadow(0 4px 10px rgba(255, 209, 102, 0.5));
    display: inline-block;
    transition: transform 0.4s ease;
}

.brand:hover .brand-mark {
    animation: wiggle 0.6s ease-in-out;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    25%      { transform: rotate(-18deg); }
    50%      { transform: rotate(14deg); }
    75%      { transform: rotate(-8deg); }
}

@keyframes spin {
    from { transform: rotate(0); }
    to   { transform: rotate(360deg); }
}

.brand-text h1 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;
}

.brand-text p {
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ==========================================
   BOUTONS
   ========================================== */
.btn {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    color: var(--text);
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.btn:hover { transform: translateY(-2px); background: var(--glass-strong); box-shadow: var(--shadow-soft); }
.btn:active { transform: translateY(0); }

.btn-reset {
    background: var(--glass);
    border-color: var(--glass-border);
}

.btn-add {
    background: linear-gradient(135deg, var(--accent), #ff9f6b);
    color: #2a1d5e;
    border: none;
    font-weight: 700;
    box-shadow: 0 8px 22px rgba(255, 159, 107, 0.35);
}

.btn-add:hover { box-shadow: 0 12px 28px rgba(255, 159, 107, 0.5); }

.btn-delete {
    background: rgba(255, 107, 139, 0.18);
    border-color: rgba(255, 107, 139, 0.4);
    color: #ffd0dc;
}

.btn-ghost {
    background: transparent;
}

/* ==========================================
   STAGE & ROSACE
   ========================================== */
.stage {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    min-height: calc(100vh - 220px);
}

.circle {
    position: relative;
    width: min(82vmin, 620px);
    height: min(82vmin, 620px);
}

/* Anneau décoratif */
.circle::before {
    content: "";
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    border: 1.5px dashed rgba(255, 255, 255, 0.1);
    animation: spin 180s linear infinite;
}

.circle::after {
    content: "";
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Centre */
.center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 42%;
    text-align: center;
    padding: 1rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-pop);
}

.center-label {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.8;
    margin-bottom: 0.4rem;
}

.seance-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1rem, 2.4vmin, 1.4rem);
    line-height: 1.15;
    color: var(--accent-soft);
    outline: none;
    padding: 0.3rem 0.6rem;
    border: 1px dashed transparent;
    border-radius: 8px;
    cursor: text;
    word-break: break-word;
    max-width: 100%;
    min-width: 60%;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.seance-name:hover {
    border-color: rgba(255, 209, 102, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.seance-name:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    box-shadow: inset 0 0 0 2px var(--accent);
}

.counter {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Avatar participant */
.avatar {
    position: absolute;
    width: 14%;
    aspect-ratio: 1;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--glass-strong);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
    animation: popIn 0.45s cubic-bezier(.34,1.56,.64,1) both;
}

.avatar:hover {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: var(--shadow-pop);
    z-index: 4;
}

.avatar .emoji {
    font-size: clamp(1.1rem, 3vmin, 1.8rem);
    line-height: 1;
}

.avatar .name {
    margin-top: 0.2rem;
    font-size: clamp(0.62rem, 1.5vmin, 0.85rem);
    font-weight: 600;
    max-width: 110%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 0.3rem;
}

.avatar.recent { animation: popIn 0.45s cubic-bezier(.34,1.56,.64,1) both, pulse 1.2s ease-out 0.45s 2; }

@keyframes popIn {
    0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

@keyframes pulse {
    0%, 100% { box-shadow: var(--shadow-soft); }
    50%      { box-shadow: 0 0 0 8px rgba(255, 209, 102, 0.25), var(--shadow-pop); }
}

/* Teintes selon l'humeur */
.mood-joy   { background: linear-gradient(135deg, rgba(255, 209, 102, 0.45), rgba(255, 159, 107, 0.3)); border-color: rgba(255, 209, 102, 0.6); }
.mood-calm  { background: linear-gradient(135deg, rgba(142, 240, 176, 0.35), rgba(80, 200, 230, 0.25)); border-color: rgba(142, 240, 176, 0.5); }
.mood-neutral { background: linear-gradient(135deg, rgba(200, 200, 220, 0.3), rgba(160, 160, 200, 0.2)); border-color: rgba(200, 200, 220, 0.4); }
.mood-worry { background: linear-gradient(135deg, rgba(180, 160, 255, 0.32), rgba(120, 100, 220, 0.22)); border-color: rgba(180, 160, 255, 0.45); }
.mood-sad   { background: linear-gradient(135deg, rgba(120, 160, 220, 0.32), rgba(80, 110, 180, 0.22)); border-color: rgba(120, 160, 220, 0.4); }
.mood-tired { background: linear-gradient(135deg, rgba(150, 140, 200, 0.3), rgba(110, 100, 170, 0.22)); }
.mood-blast { background: linear-gradient(135deg, rgba(255, 107, 139, 0.4), rgba(255, 159, 107, 0.28)); border-color: rgba(255, 107, 139, 0.5); }

/* Etat vide */
.empty-hint {
    position: absolute;
    bottom: 6%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: var(--glass);
    padding: 0.7rem 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.empty-hint .empty-emoji { font-size: 1.2rem; }
.empty-hint.hidden { display: none; }

/* ==========================================
   BANDEAU D'AJOUT
   ========================================== */
.addbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 1rem clamp(1rem, 4vw, 2.5rem) 1.2rem;
    background: linear-gradient(to top, rgba(15, 10, 38, 0.92), rgba(15, 10, 38, 0.6) 70%, transparent);
}

.add-form {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    justify-content: center;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 0.6rem 0.7rem;
    box-shadow: var(--shadow-pop);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.add-form input[type="text"] {
    flex: 1 1 200px;
    min-width: 0;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.5rem 0.9rem;
    outline: none;
}

.add-form input[type="text"]::placeholder { color: var(--text-muted); }

/* Sélecteur d'humeur */
.mood-picker {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.mood {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    line-height: 1;
}

.mood:hover { transform: scale(1.18); background: var(--glass); }

.mood[aria-checked="true"],
.mood.selected {
    background: rgba(255, 209, 102, 0.25);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.3);
    transform: scale(1.1);
}

/* ==========================================
   MODALES
   ========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(15, 10, 38, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

/* L'attribut [hidden] doit l'emporter sur display:flex */
.modal-overlay[hidden] {
    display: none !important;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    position: relative;
    width: min(92vw, 420px);
    background: linear-gradient(160deg, rgba(42, 29, 94, 0.95), rgba(27, 18, 64, 0.95));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    padding: 1.6rem 1.4rem 1.4rem;
    animation: popModal 0.25s cubic-bezier(.34,1.56,.64,1);
}

@keyframes popModal {
    from { transform: scale(0.85) translateY(10px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin-bottom: 0.4rem;
}

.modal-help {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1.1rem;
}

.modal-form { display: flex; flex-direction: column; gap: 0.6rem; }

.field-label {
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.modal-form input[type="text"] {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.6rem 0.85rem;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.modal-form input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.2);
}

.modal-form .mood-picker { margin: 0.2rem 0 0.4rem; }

.modal-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    margin-top: 1rem;
}

.modal-close {
    position: absolute;
    top: 0.7rem;
    right: 0.9rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    transition: background 0.18s ease, color 0.18s ease;
}

.modal-close:hover { background: var(--glass); color: var(--text); }

/* ==========================================
   FOOTER (powered by)
   ========================================== */
.footer {
    position: fixed;
    bottom: calc(130px + 0.7rem);
    right: 1rem;
    z-index: 8;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.footer:hover { opacity: 1; }

.powered {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.powered:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
    transform: translateY(-1px);
}

.powered-label {
    font-family: var(--font-body);
    font-weight: 500;
}

.powered-logo {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .footer { bottom: calc(180px + 0.4rem); right: 0.6rem; }
    .powered { font-size: 0.66rem; padding: 0.2rem 0.4rem; }
    .powered-logo { width: 18px; height: 18px; }
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 640px) {
    .topbar { padding: 0.8rem 1rem; }
    .brand-text h1 { font-size: 1.1rem; }
    .btn-reset { padding: 0.5rem 0.8rem; font-size: 0.85rem; }

    .stage { min-height: calc(100vh - 240px); padding: 0.5rem; }
    .circle { width: 92vmin; height: 92vmin; }

    .add-form { border-radius: 24px; padding: 0.8rem; gap: 0.6rem; }
    .add-form input[type="text"] { flex: 1 1 100%; text-align: center; }
    .mood { width: 2.6rem; height: 2.6rem; font-size: 1.4rem; }
    .btn-add { width: 100%; justify-content: center; }

    .empty-hint { font-size: 0.78rem; padding: 0.5rem 0.8rem; }
}

@media (max-width: 420px) {
    .center { width: 44%; }
}

/* Accessibilité : respect du mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.05ms !important;
    }
}