/**
 * Disney Player App — Styles principaux
 * Thème : Nuit féerique violet/or
 */
@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700&family=Quicksand:wght@400;500;600;700&display=swap');

/* ============================================================
   VARIABLES
   ============================================================ */
:root {
    --bg-dark: #070415;
    --bg: #0f0825;
    --bg-light: #1a0e3a;
    --bg-card: #1e1245;
    --bg-input: #130b30;
    --border: rgba(255,255,255,0.08);
    --border-hover: rgba(255,255,255,0.15);

    --primary: #7b5ea7;
    --primary-light: #a78bda;
    --accent: #f0c27a;
    --accent-light: #ffecd2;
    --magic: #c084fc;
    --magic-glow: rgba(192, 132, 252, 0.3);

    --text: #f0e6ff;
    --text-muted: #8b7fad;
    --text-dark: #1a0a3e;

    --success: #4ade80;
    --error: #f87171;
    --warning: #fbbf24;

    --player-1: #60a5fa;
    --player-2: #f472b6;
    --player-3: #4ade80;
    --player-4: #fbbf24;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 50%;

    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 24px var(--magic-glow);
    --font: 'Quicksand', system-ui, sans-serif;
    --font-display: 'Cinzel Decorative', serif;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
    font-family: var(--font);
    background: var(--bg-dark); color: var(--text);
    min-height: 100vh; min-height: 100dvh;
    overflow-x: hidden; line-height: 1.5;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; height: auto; }
.hidden { display: none !important; }

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(180deg, rgba(15,8,37,0.95), rgba(15,8,37,0.85));
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    min-height: 56px;
}
.app-header h1 {
    flex: 1; font-size: 1rem; font-weight: 700;
    letter-spacing: -0.2px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.btn-back {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: var(--text); border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.05); border: 1px solid var(--border);
    transition: all 0.2s; text-decoration: none; flex-shrink: 0;
}
.btn-back:active { transform: scale(0.9); background: rgba(255,255,255,0.08); }
.header-score {
    font-weight: 700; color: var(--accent); font-size: 0.82rem;
    background: rgba(240,194,122,0.08); padding: 6px 14px;
    border-radius: 20px; border: 1px solid rgba(240,194,122,0.15);
    white-space: nowrap; flex-shrink: 0;
}
.player-info {
    display: flex; align-items: center; gap: 10px;
}
.player-avatar-small {
    width: 34px; height: 34px; border-radius: var(--radius-full);
    object-fit: cover; border: 2px solid rgba(255,255,255,0.1);
}
.player-pseudo { font-weight: 700; font-size: 0.92rem; }

/* Logout icon */
.btn-logout-player {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); border: 1px solid rgba(248,113,113,0.15);
    background: rgba(248,113,113,0.06); color: #fca5a5;
    font-size: 1.05rem; cursor: pointer; transition: all 0.2s;
    text-decoration: none; flex-shrink: 0;
}
.btn-logout-player:active { transform: scale(0.9); background: rgba(248,113,113,0.12); }

/* Notification bell */
.notification-bell {
    position: relative; cursor: pointer; font-size: 1.15rem;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); transition: background 0.2s; flex-shrink: 0;
}
.notification-bell:active { background: rgba(255,255,255,0.05); }
.notif-count {
    position: absolute; top: 0; right: 0;
    background: var(--error); color: white;
    font-size: 0.6rem; width: 16px; height: 16px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; border: 2px solid var(--bg-dark);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 28px; border: none; border-radius: var(--radius-md);
    font-size: 0.95rem; font-weight: 700; cursor: pointer;
    font-family: var(--font); transition: all 0.25s; text-align: center;
    min-height: 48px; /* touch target */
}
.btn-magic {
    background: linear-gradient(135deg, var(--primary), var(--magic));
    color: white; box-shadow: var(--shadow-glow);
}
.btn-magic:active { transform: scale(0.96); }
.btn-secondary {
    background: rgba(255,255,255,0.05); color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:active { background: rgba(255,255,255,0.08); }
.btn-small {
    padding: 8px 16px; font-size: 0.82rem; border-radius: var(--radius-sm);
}
.btn-block { width: 100%; }
.btn-add {
    width: 38px; height: 38px; border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), #e6a04e);
    color: var(--text-dark); border: none; font-size: 1.4rem; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 12px rgba(240,194,122,0.3);
}
.btn-add:active { transform: scale(0.93); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 1px solid var(--border); overflow: hidden;
    transition: all 0.3s;
}
.card:hover { border-color: var(--border-hover); }

/* ============================================================
   MODALS
   ============================================================ */
.modal {
    position: fixed; inset: 0;
    background: rgba(7,4,21,0.8);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px;
}
.modal-content {
    background: var(--bg); border-radius: var(--radius-lg);
    padding: 28px; max-width: 420px; width: 100%;
    max-height: 90vh; overflow-y: auto;
    border: 1px solid var(--border); box-shadow: var(--shadow);
    animation: modalIn 0.25s ease-out;
}
.modal-content h2 {
    font-size: 1.15rem; font-weight: 700; margin-bottom: 16px;
    color: var(--accent);
}
@keyframes modalIn { from { opacity:0; transform:scale(0.95) translateY(10px); } to { opacity:1; transform:scale(1) translateY(0); } }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; margin-bottom: 6px; font-weight: 700;
    color: var(--text-muted); font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 0.8px;
}
input[type="text"], input[type="password"], input[type="number"],
textarea, select {
    width: 100%; padding: 14px 16px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-size: 16px; /* prevents iOS zoom */ font-family: var(--font); transition: all 0.2s;
    min-height: 48px;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: rgba(192,132,252,0.4);
    box-shadow: 0 0 0 3px rgba(192,132,252,0.1);
}
input[type="file"] {
    color: var(--text-muted); font-family: var(--font);
    font-size: 0.88rem;
}

/* ============================================================
   NOTIFICATIONS PANEL
   ============================================================ */
.notifications-panel {
    position: fixed; top: 62px; right: 16px;
    background: var(--bg); border-radius: var(--radius-md);
    box-shadow: var(--shadow); max-height: 320px;
    overflow-y: auto; width: 290px; z-index: 200;
    border: 1px solid var(--border);
    animation: modalIn 0.2s ease-out;
}

/* ============================================================
   PAUSE OVERLAY
   ============================================================ */
.pause-overlay {
    position: fixed; inset: 0;
    background: rgba(7,4,21,0.97);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.pause-content { text-align: center; }
.pause-icon { font-size: 4rem; margin-bottom: 16px; animation: float 3s ease-in-out infinite; }
.pause-content h2 { font-size: 1.5rem; margin-bottom: 8px; }
.pause-content p { color: var(--text-muted); }

/* ============================================================
   STREAK
   ============================================================ */
.streak-indicator {
    position: fixed; bottom: 20px; right: 20px;
    background: linear-gradient(135deg, #ff6b35, #fbbf24);
    color: white; padding: 8px 18px; border-radius: 24px;
    font-weight: 700; font-size: 0.9rem;
    box-shadow: 0 4px 18px rgba(251,191,36,0.35); z-index: 50;
    animation: fadeIn 0.3s ease-out;
}

/* ============================================================
   REACTIONS
   ============================================================ */
.reactions-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.reaction-btn {
    background: rgba(255,255,255,0.05); border: 1px solid var(--border);
    border-radius: 20px; padding: 4px 12px; cursor: pointer;
    font-size: 0.85rem; transition: all 0.2s;
}
.reaction-btn:active { transform: scale(0.93); }
.reaction-btn.active { border-color: var(--magic); background: rgba(192,132,252,0.12); }

/* ============================================================
   SHARED LEADERBOARD
   ============================================================ */
.lb-row {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-radius: var(--radius-md);
    background: var(--bg-card); margin-bottom: 8px;
    border: 1px solid var(--border); transition: all 0.2s;
}
.lb-row.lb-me {
    border-color: rgba(192,132,252,0.3);
    background: rgba(192,132,252,0.07);
    box-shadow: 0 0 16px rgba(192,132,252,0.08);
}
.lb-medal { font-size: 1.2rem; width: 30px; text-align: center; flex-shrink: 0; }
.lb-color { width: 10px; height: 10px; border-radius: var(--radius-full); flex-shrink: 0; }
.lb-name { flex: 1; font-weight: 700; font-size: 0.95rem; }
.lb-pts { font-weight: 700; color: var(--accent); font-size: 0.92rem; white-space: nowrap; }

/* ============================================================
   STATES
   ============================================================ */
.state-empty {
    text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.state-empty-icon { font-size: 3rem; display: block; margin-bottom: 12px; opacity: 0.5; }
.state-empty p { font-size: 0.95rem; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    padding: 12px 24px; border-radius: var(--radius-md);
    color: white; font-size: 0.9rem; font-weight: 600;
    box-shadow: 0 6px 24px rgba(0,0,0,0.4); z-index: 3000;
    animation: toastUp 0.3s ease-out;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.toast-success { background: rgba(34,197,94,0.9); }
.toast-error { background: rgba(248,113,113,0.9); }
.toast-info { background: rgba(123,94,167,0.9); }
@keyframes toastUp { from { opacity:0; transform:translateX(-50%) translateY(20px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }

/* ============================================================
   UTILITY
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.error-message { color: var(--error); font-size: 0.85rem; margin-top: 4px; }
.mb-sm { margin-bottom: 8px; } .mb-md { margin-bottom: 16px; } .mb-lg { margin-bottom: 24px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.08)} }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
@keyframes shimmer { 0%{background-position:-200% 0} 100%{background-position:200% 0} }
.animate-fadeIn { animation: fadeIn 0.4s ease-out; }

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex; align-items: stretch;
    background: rgba(11,4,21,0.94);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    z-index: 500;
    padding-bottom: var(--safe-bottom);
    padding-bottom: max(var(--safe-bottom), 4px);
    height: 64px;
}
.nav-tab {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    padding: 6px 4px 8px; text-decoration: none;
    color: var(--text-muted); transition: all 0.2s; position: relative;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px; /* minimum touch target */
}
.nav-tab::before {
    content: ''; position: absolute; top: 0; left: 20%; right: 20%;
    height: 3px; border-radius: 0 0 3px 3px;
    background: transparent; transition: all 0.25s;
}
.nav-tab.active { color: var(--magic); }
.nav-tab.active::before { background: var(--magic); box-shadow: 0 0 8px var(--magic-glow); }
.nav-tab.active .nav-icon { transform: scale(1.12); }
.nav-tab:active { opacity: 0.7; }
.nav-icon { font-size: 1.35rem; transition: transform 0.2s; line-height: 1; }
.nav-label { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.3px; }
.nav-badge {
    position: absolute; top: 4px; right: calc(50% - 18px);
    width: 8px; height: 8px; border-radius: var(--radius-full);
    background: var(--error); border: 2px solid rgba(11,4,21,0.94);
}

/* Body padding for bottom nav */
body.has-bottom-nav { padding-bottom: 76px; }

/* ============================================================
   FAB (Floating Action Button)
   ============================================================ */
.fab {
    position: fixed;
    bottom: calc(76px + 14px + var(--safe-bottom, 0px));
    right: 18px;
    width: 56px; height: 56px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), #e6a04e);
    color: var(--text-dark); border: none;
    font-size: 1.5rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 400;
    box-shadow: 0 4px 20px rgba(240,194,122,0.4);
    transition: all 0.25s;
    -webkit-tap-highlight-color: transparent;
}
.fab:active { transform: scale(0.9); box-shadow: 0 2px 10px rgba(240,194,122,0.3); }
.fab span { line-height: 1; }

/* ============================================================
   BOTTOM SHEET
   ============================================================ */
.bottomsheet-overlay {
    position: fixed; inset: 0;
    background: rgba(7,4,21,0.6);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 900; opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.bottomsheet-overlay.active { opacity: 1; pointer-events: auto; }

.bottomsheet {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg);
    border-radius: 20px 20px 0 0;
    z-index: 950;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.4);
    padding-bottom: var(--safe-bottom);
}
.bottomsheet.open { transform: translateY(0); }

.bottomsheet-handle {
    display: flex; justify-content: center; padding: 12px 0 4px;
    cursor: grab; flex-shrink: 0;
}
.bottomsheet-handle::after {
    content: ''; width: 36px; height: 4px;
    background: rgba(255,255,255,0.15); border-radius: 2px;
}

.bottomsheet-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 22px 14px; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.bottomsheet-header h2 {
    font-size: 1.1rem; font-weight: 700; color: var(--text);
}
.bottomsheet-close {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    border: none; background: rgba(255,255,255,0.05);
    color: var(--text-muted); font-size: 1.1rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.bottomsheet-close:active { background: rgba(255,255,255,0.1); }

.bottomsheet-body {
    padding: 20px 22px; overflow-y: auto; flex: 1;
    -webkit-overflow-scrolling: touch;
}
