/**
 * =====================================================
 * MISSIONI SEGRETE A CENA - Stile CSS
 * Tema: Capodanno Festivo (Viola/Oro/Stelle)
 * Mobile-First Bootstrap 5
 * =====================================================
 */

/* ========== CSS VARIABLES ========== */
:root {
    /* Colori principali */
    --primary: #6B4EE6;
    --primary-dark: #5038C9;
    --secondary: #FFD700;
    --accent-pink: #FF6B6B;
    --accent-teal: #4ECDC4;
    --accent-blue: #45B7D1;

    /* Gradienti */
    --gradient-main: linear-gradient(135deg, #1a0033 0%, #2d1b4e 50%, #1a0033 100%);
    --gradient-card: linear-gradient(145deg, rgba(107, 78, 230, 0.2) 0%, rgba(45, 27, 78, 0.4) 100%);
    --gradient-gold: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
    --gradient-button: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);

    /* Colori UI */
    --bg-dark: #0d0015;
    --bg-card: rgba(45, 27, 78, 0.6);
    --text-light: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --border-glow: rgba(255, 215, 0, 0.3);

    /* Categorie missioni */
    --cat-conversazione: #4ECDC4;
    --cat-azioni: #FF6B6B;
    --cat-interazioni: #A855F7;

    /* Shadows */
    --shadow-glow: 0 0 20px rgba(107, 78, 230, 0.5);
    --shadow-gold: 0 0 30px rgba(255, 215, 0, 0.3);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Transizioni */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ========== LIGHT MODE ========== */
[data-theme="light"] {
    --bg-dark: #f5f0ff;
    --bg-card: rgba(255, 255, 255, 0.95);
    --text-light: #2d1b4e;
    --text-muted: rgba(45, 27, 78, 0.7);
    --gradient-main: linear-gradient(135deg, #e8e0f0 0%, #f5f0ff 50%, #e8e0f0 100%);
    --gradient-card: linear-gradient(145deg, rgba(107, 78, 230, 0.08) 0%, rgba(255, 255, 255, 0.95) 100%);

    /* Colori principali adattati per light mode */
    --secondary: #5038C9;
    --border-glow: rgba(107, 78, 230, 0.3);

    /* Shadows per light mode */
    --shadow-glow: 0 0 20px rgba(107, 78, 230, 0.2);
    --shadow-gold: 0 0 30px rgba(107, 78, 230, 0.2);
    --shadow-card: 0 8px 32px rgba(45, 27, 78, 0.1);
}

/* Light mode specific overrides */
[data-theme="light"] .bottom-nav {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(107, 78, 230, 0.2);
}

[data-theme="light"] .nav-link {
    color: rgba(45, 27, 78, 0.6);
}

[data-theme="light"] .nav-link.active,
[data-theme="light"] .nav-link:hover {
    color: #5038C9;
}

[data-theme="light"] .btn-outline-light {
    color: #5038C9;
    border-color: rgba(107, 78, 230, 0.4);
}

[data-theme="light"] .btn-outline-light:hover {
    background: rgba(107, 78, 230, 0.1);
    border-color: #5038C9;
    color: #5038C9;
}

[data-theme="light"] .page-header {
    background: linear-gradient(135deg, rgba(107, 78, 230, 0.15) 0%, rgba(80, 56, 201, 0.1) 100%);
    border-bottom-color: rgba(107, 78, 230, 0.2);
}

[data-theme="light"] .page-title {
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: #2d1b4e;
    background-clip: unset;
    text-shadow: none;
    color: #2d1b4e;
}

[data-theme="light"] .page-title i {
    -webkit-text-fill-color: #5038C9;
    color: #5038C9;
}

[data-theme="light"] .card {
    border-color: rgba(107, 78, 230, 0.15);
}

[data-theme="light"] .card-header {
    background: rgba(107, 78, 230, 0.08);
    border-bottom-color: rgba(107, 78, 230, 0.1);
}

[data-theme="light"] .list-group-item {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(107, 78, 230, 0.15);
}

[data-theme="light"] .list-group-item:hover {
    background: rgba(107, 78, 230, 0.08);
}

[data-theme="light"] .list-group-item .btn-outline-light {
    border-color: rgba(107, 78, 230, 0.4);
    color: #5038C9;
}

[data-theme="light"] .list-group-item .btn-outline-light:hover {
    background: rgba(107, 78, 230, 0.1);
}

[data-theme="light"] .list-group-item .btn-outline-danger {
    border-color: rgba(220, 53, 69, 0.5);
}

[data-theme="light"] .list-group-item .btn-outline-warning {
    border-color: rgba(255, 193, 7, 0.6);
    color: #856404;
}

[data-theme="light"] .list-group-item .btn-outline-success {
    border-color: rgba(25, 135, 84, 0.5);
}

[data-theme="light"] .badge-gold {
    background: linear-gradient(135deg, #5038C9 0%, #6B4EE6 100%);
    color: #fff;
}

[data-theme="light"] .btn-gold {
    background: linear-gradient(135deg, #5038C9 0%, #6B4EE6 100%);
    color: #fff;
}

[data-theme="light"] .btn-gold:hover {
    background: linear-gradient(135deg, #4030A0 0%, #5038C9 100%);
    color: #fff;
}

[data-theme="light"] .text-gold {
    color: #5038C9 !important;
}

[data-theme="light"] .stat-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(107, 78, 230, 0.15);
}

[data-theme="light"] .score-item {
    background: rgba(107, 78, 230, 0.05);
}

[data-theme="light"] .score-item.first-place {
    background: linear-gradient(135deg, rgba(107, 78, 230, 0.2) 0%, rgba(80, 56, 201, 0.1) 100%);
    border-color: #5038C9;
}

[data-theme="light"] .score-item.second-place {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.3) 0%, rgba(169, 169, 169, 0.15) 100%);
    border-color: #a0a0a0;
}

[data-theme="light"] .score-item.third-place {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2) 0%, rgba(184, 115, 51, 0.1) 100%);
    border-color: #CD7F32;
}

[data-theme="light"] .score-position {
    background: linear-gradient(135deg, #5038C9 0%, #6B4EE6 100%);
    color: #fff;
}

[data-theme="light"] .player-avatar {
    background: linear-gradient(135deg, #5038C9 0%, #6B4EE6 100%);
    color: #fff;
}

[data-theme="light"] .form-control {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(107, 78, 230, 0.2);
    color: #2d1b4e;
}

[data-theme="light"] .form-control:focus {
    border-color: #5038C9;
    box-shadow: 0 0 0 3px rgba(80, 56, 201, 0.15);
}

[data-theme="light"] .form-control[type="date"] {
    color-scheme: light;
}

[data-theme="light"] .form-control[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
}

[data-theme="light"] .form-select {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(107, 78, 230, 0.2);
    color: #2d1b4e;
}

[data-theme="light"] .table {
    color: #2d1b4e;
    background: rgba(255, 255, 255, 0.9) !important;
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(107, 78, 230, 0.08);
}

[data-theme="light"] .table thead th {
    background: rgba(107, 78, 230, 0.12) !important;
    color: #5038C9 !important;
    border-bottom-color: rgba(107, 78, 230, 0.2) !important;
}

[data-theme="light"] .table tbody tr {
    background: transparent !important;
}

[data-theme="light"] .table tbody td {
    background: transparent !important;
    border-bottom-color: rgba(107, 78, 230, 0.15);
}

[data-theme="light"] .table tbody tr:hover {
    background: rgba(107, 78, 230, 0.08) !important;
}

[data-theme="light"] .table tbody td strong {
    color: #5038C9;
}

[data-theme="light"] .table tbody td.text-muted {
    color: rgba(45, 27, 78, 0.7) !important;
}

[data-theme="light"] .table .btn-outline-light {
    border-color: rgba(107, 78, 230, 0.4);
    color: #5038C9;
}

[data-theme="light"] .table .btn-outline-light:hover {
    background: rgba(107, 78, 230, 0.1);
}

[data-theme="light"] .table .btn-outline-danger {
    border-color: rgba(220, 53, 69, 0.5);
}

[data-theme="light"] .progress {
    background: rgba(107, 78, 230, 0.1);
}

[data-theme="light"] .progress-bar {
    background: linear-gradient(135deg, #5038C9 0%, #6B4EE6 100%);
}

[data-theme="light"] .card-body h5,
[data-theme="light"] .card-body h4,
[data-theme="light"] .card-body h6 {
    color: #5038C9;
}

[data-theme="light"] .card-body .text-muted,
[data-theme="light"] .card-body small {
    color: rgba(45, 27, 78, 0.7) !important;
}

/* ========== BASE STYLES ========== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overscroll-behavior: none;
}

/* Previene sfarfallio durante caricamento Font Awesome */
.fa, .fas, .far, .fab, .fa-solid, .fa-regular, .fa-brands {
    display: inline-block;
    width: 1em;
    text-align: center;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--gradient-main);
    background-attachment: fixed;
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    overscroll-behavior: none;
}

/* Stelle di sfondo animate */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20px 30px, #FFD700, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255, 215, 0, 0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(2px 2px at 160px 120px, #FFD700, transparent),
        radial-gradient(1px 1px at 230px 80px, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(2px 2px at 300px 150px, #FFD700, transparent),
        radial-gradient(1px 1px at 50px 180px, #fff, transparent),
        radial-gradient(2px 2px at 120px 220px, rgba(255, 215, 0, 0.6), transparent);
    background-size: 350px 350px;
    animation: twinkle 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

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

/* ========== CONTAINER & LAYOUT ========== */
.main-container {
    position: relative;
    z-index: 1;
    padding-bottom: 100px;
}

.page-header {
    background: var(--gradient-card);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-glow);
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-title i {
    -webkit-text-fill-color: #FFD700;
}

.page-header .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

/* ========== CARDS ========== */
.card {
    background: var(--gradient-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glow);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-medium), box-shadow var(--transition-medium);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.card-header {
    background: rgba(107, 78, 230, 0.3);
    border-bottom: 1px solid var(--border-glow);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--secondary);
}

.card-body {
    padding: 1.25rem;
}

.card-title {
    color: var(--secondary);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Card giocatore */
.player-card {
    cursor: pointer;
    transition: all var(--transition-medium);
}

.player-card:active {
    transform: scale(0.98);
}

.player-card.selected {
    border-color: var(--secondary);
    box-shadow: var(--shadow-gold);
}

.player-card.eliminated {
    opacity: 0.5;
    filter: grayscale(50%);
}

/* Titoli nelle card */
.card-body h5,
.card-body h4,
.card-body h6 {
    color: var(--secondary);
}

/* Testo muted nelle card */
.card-body .text-muted {
    color: var(--text-muted) !important;
}

/* Testo small nelle card */
.card-body small {
    color: var(--text-muted);
}

.player-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bg-dark);
    box-shadow: var(--shadow-gold);
}

.player-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* ========== BUTTONS ========== */
.btn {
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-button);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
    background: var(--gradient-button);
}

.btn-gold {
    background: var(--gradient-gold);
    color: var(--bg-dark);
    box-shadow: var(--shadow-gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.5);
    color: var(--bg-dark);
}

.btn-outline-light {
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--text-light);
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--secondary);
    color: var(--secondary);
}

.btn-outline-danger {
    border: 1px solid rgba(220, 53, 69, 0.5);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 16px;
}

/* Bottone grande touch-friendly */
.btn-touch {
    min-height: 56px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

/* ========== FORMS ========== */
.form-control, .form-select {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text-light);
    padding: 0.875rem 1rem;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2);
    color: var(--text-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled,
.form-control[readonly] {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.8;
}

/* Date input styling per tema scuro */
.form-control[type="date"] {
    color-scheme: dark;
}

.form-control[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.form-label {
    color: var(--secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* ========== BADGE & TAGS ========== */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
}

.badge-conversazione {
    background: var(--cat-conversazione);
    color: #000;
}

.badge-azioni {
    background: var(--cat-azioni);
    color: #fff;
}

.badge-interazioni {
    background: var(--cat-interazioni);
    color: #fff;
}

.badge-gold {
    background: var(--gradient-gold);
    color: var(--bg-dark);
}

/* ========== TABLES ========== */
.table {
    color: var(--text-light);
    background: rgba(45, 27, 78, 0.4) !important;
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(107, 78, 230, 0.15);
}

.table thead th {
    background: rgba(107, 78, 230, 0.3) !important;
    border-bottom: 2px solid var(--border-glow) !important;
    color: var(--secondary) !important;
    font-weight: 600;
    padding: 1rem;
}

.table tbody tr {
    background: transparent !important;
    transition: background var(--transition-fast);
}

.table tbody td {
    background: transparent !important;
    border-bottom: 1px solid rgba(107, 78, 230, 0.2);
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
}

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

.table tbody tr:hover {
    background: rgba(107, 78, 230, 0.15) !important;
}

/* Nomi giocatori in tabella */
.table tbody td strong {
    color: var(--secondary);
}

/* Testo muted in tabella */
.table tbody td.text-muted {
    color: var(--text-muted) !important;
    opacity: 0.9;
}

/* Bottoni nella tabella */
.table .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.table .btn-outline-light {
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.table .btn-outline-danger {
    border: 1px solid rgba(220, 53, 69, 0.5);
}

.table-responsive {
    border-radius: 0;
    overflow: hidden;
}

/* Quando la tabella è dentro una card, niente border-radius */
.card .table-responsive {
    border-radius: 0;
}

.card .table {
    margin-bottom: 0;
}

.card .table thead th:first-child,
.card .table thead th:last-child {
    border-radius: 0;
}

/* ========== MODALS ========== */
.modal-content {
    background: var(--gradient-main);
    border: 1px solid var(--border-glow);
    border-radius: 20px;
    box-shadow: var(--shadow-glow);
}

.modal-header {
    border-bottom: 1px solid var(--border-glow);
    padding: 1.25rem;
}

.modal-title {
    color: var(--secondary);
    font-weight: 700;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-glow);
    padding: 1rem 1.25rem;
}

/* ========== MISSION CARDS ========== */
.mission-card {
    background: var(--gradient-card);
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
}

.mission-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    transition: width var(--transition-medium);
}

.mission-card.conversazione::before { background: var(--cat-conversazione); }
.mission-card.azioni::before { background: var(--cat-azioni); }
.mission-card.interazioni::before { background: var(--cat-interazioni); }

.mission-card:hover {
    transform: translateX(4px);
    border-color: var(--border-glow);
}

.mission-card:hover::before {
    width: 8px;
}

.mission-card.selected {
    border-color: var(--secondary);
    box-shadow: var(--shadow-gold);
}

.mission-card.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: var(--secondary);
    font-size: 1.25rem;
}

.mission-text {
    font-size: 1rem;
    line-height: 1.5;
    margin: 0;
}

/* ========== SCOREBOARD ========== */
.scoreboard {
    background: var(--gradient-card);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.score-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    transition: all var(--transition-medium);
}

.score-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.score-item.first-place {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 165, 0, 0.2) 100%);
    border: 1px solid var(--secondary);
}

.score-item.second-place {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.3) 0%, rgba(169, 169, 169, 0.2) 100%);
    border: 1px solid #C0C0C0;
}

.score-item.third-place {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.3) 0%, rgba(184, 115, 51, 0.2) 100%);
    border: 1px solid #CD7F32;
}

.score-position {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-gold);
    color: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 1rem;
}

.score-points {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
    margin-left: auto;
}

.score-item strong {
    color: var(--secondary);
}

.score-item .small {
    color: var(--text-muted) !important;
    opacity: 0.9;
}

/* ========== PROGRESS BAR ========== */
.progress {
    height: 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.progress-bar {
    background: var(--gradient-gold);
    border-radius: 6px;
    transition: width 0.5s ease-out;
}

.progress-bar.animated {
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ========== NAVIGATION ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(13, 0, 21, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-glow);
    padding: 0.5rem;
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.nav-item {
    flex: 1;
    text-align: center;
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-radius: 12px;
}

.nav-link:hover, .nav-link.active {
    color: var(--secondary);
    background: rgba(255, 215, 0, 0.1);
}

.nav-link i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.nav-link span {
    font-size: 0.7rem;
    font-weight: 600;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px var(--secondary); }
    50% { box-shadow: 0 0 20px var(--secondary), 0 0 30px var(--secondary); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-slide-in {
    animation: slideIn 0.4s ease-out forwards;
}

.animate-bounce {
    animation: bounce 1s ease infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

/* Stagger animation delay */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* ========== CONFETTI CONTAINER ========== */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9998;
}

.toast {
    background: var(--gradient-card);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    color: var(--text-light);
    backdrop-filter: blur(10px);
}

.toast.success {
    border-color: var(--cat-conversazione);
}

.toast.error {
    border-color: var(--accent-pink);
}

/* ========== LOADING SPINNER ========== */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 215, 0, 0.2);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state h4 {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ========== FIREWORKS CSS ========== */
.firework {
    position: fixed;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    animation: firework 1.5s ease-out forwards;
    pointer-events: none;
    z-index: 9999;
}

@keyframes firework {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* ========== DARK MODE TOGGLE ========== */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    background: var(--gradient-card);
    border: 1px solid var(--border-glow);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-medium);
    color: var(--secondary);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-gold);
}

/* ========== PASS PHONE SCREEN ========== */
.pass-phone-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    text-align: center;
    padding: 2rem;
}

.pass-phone-screen h2 {
    color: var(--secondary);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.pass-phone-screen .player-name {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
}

.pass-phone-screen .icon-large {
    font-size: 5rem;
    color: var(--secondary);
    margin-bottom: 2rem;
    animation: bounce 2s ease-in-out infinite;
}

/* ========== SECRET MISSION REVEAL ========== */
.mission-reveal {
    background: var(--gradient-card);
    border: 2px solid var(--secondary);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-gold);
    max-width: 400px;
    margin: 0 auto;
}

.mission-reveal .mission-category {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
}

.mission-reveal .mission-text {
    font-size: 1.25rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* ========== STATS CARDS ========== */
.stat-card {
    background: var(--gradient-card);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    border: 1px solid var(--border-glow);
}

.stat-card .stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--secondary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========== ALERT MESSAGES ========== */
.alert {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.25rem;
}

.alert-success {
    background: rgba(78, 205, 196, 0.2);
    color: var(--cat-conversazione);
    border: 1px solid var(--cat-conversazione);
}

.alert-danger {
    background: rgba(255, 107, 107, 0.2);
    color: var(--accent-pink);
    border: 1px solid var(--accent-pink);
}

.alert-warning {
    background: rgba(255, 215, 0, 0.2);
    color: var(--secondary);
    border: 1px solid var(--secondary);
}

.alert-info {
    background: rgba(69, 183, 209, 0.2);
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
}

/* ========== LIST GROUP ========== */
.list-group-item {
    background: rgba(45, 27, 78, 0.4);
    border-color: rgba(107, 78, 230, 0.2);
    color: var(--text-light);
    padding: 0.65rem 1rem;
    transition: all var(--transition-fast);
}

.list-group-item:hover {
    background: rgba(107, 78, 230, 0.15);
}

.list-group-item.active {
    background: rgba(107, 78, 230, 0.3);
    border-color: var(--primary);
}

.list-group-item strong {
    color: var(--secondary);
}

.list-group-item .small {
    color: var(--text-muted) !important;
    opacity: 0.9;
}

.list-group-item .small .text-muted,
.list-group-item .text-muted {
    color: var(--text-muted) !important;
    opacity: 1;
}

/* Bottoni nei list-group-item */
.list-group-item .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.list-group-item .btn-outline-light {
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.list-group-item .btn-outline-danger {
    border: 1px solid rgba(220, 53, 69, 0.5);
}

.list-group-item .btn-outline-warning {
    border: 1px solid rgba(255, 193, 7, 0.5);
}

.list-group-item .btn-outline-success {
    border: 1px solid rgba(25, 135, 84, 0.5);
}

/* ========== UTILITY CLASSES ========== */
.text-gold { color: var(--secondary) !important; }
.text-pink { color: var(--accent-pink) !important; }
.text-teal { color: var(--cat-conversazione) !important; }
.text-blue { color: var(--accent-blue) !important; }

.bg-glass {
    background: var(--gradient-card);
    backdrop-filter: blur(10px);
}

.border-glow {
    border: 1px solid var(--border-glow);
}

.shadow-glow {
    box-shadow: var(--shadow-glow);
}

.shadow-gold {
    box-shadow: var(--shadow-gold);
}

/* ========== RESPONSIVE ========== */
@media (min-width: 576px) {
    .page-title {
        font-size: 1.75rem;
    }

    .bottom-nav {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 20px 20px 0 0;
    }
}

@media (min-width: 768px) {
    .main-container {
        max-width: 720px;
        margin: 0 auto;
    }

    .page-title {
        font-size: 2rem;
    }
}

@media (min-width: 992px) {
    .main-container {
        max-width: 960px;
    }
}

/* ========== SAFE AREA (iPhone X+) ========== */
@supports (padding: env(safe-area-inset-top)) {
    /* Body background per safe area top/bottom */
    body {
        background-color: #1a0033;
    }

    /* Page header con safe area top */
    .page-header {
        padding-top: calc(1rem + env(safe-area-inset-top));
    }

    /* Bottom nav con safe area bottom */
    .bottom-nav {
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    }

    /* Main container padding */
    .main-container {
        padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }

    /* Per pagine senza header (es. login) */
    .min-vh-100 {
        min-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
        padding-top: env(safe-area-inset-top);
    }
}

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