/* ============================================
   CLIENTE MISTERIOSO - STILI COMPLETI
   ============================================ */

/* ============================================
   VARIABILI CSS
   ============================================ */
:root {
    /* Colori Principali */
    --primary: #2196F3;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #F44336;
    --info: #00BCD4;

    /* Neutri */
    --bg-light: #F5F7FA;
    --bg-card: #FFFFFF;
    --bg-dark: #263238;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border: #E0E0E0;

    /* Speech Bubbles */
    --bubble-cliente: #E3F2FD;
    --bubble-venditore: #C8E6C9;

    /* Font */
    --font-title: 'Poppins', sans-serif;
    --font-body: 'Roboto', sans-serif;

    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.2);
}

/* ============================================
   RESET E BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}

/* ============================================
   ANIMAZIONI
   ============================================ */

/* Speech bubble animazione */
@keyframes bubbleIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Animazione stelle */
@keyframes starPop {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* Feedback icon */
@keyframes iconBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Cliente entra da sinistra */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Risposta selezionata corretta */
@keyframes highlightCorrect {
    0% { background: white; border-color: var(--border); }
    100% { background: var(--success); color: white; border-color: var(--success); }
}

/* Risposta selezionata sbagliata */
@keyframes highlightWrong {
    0% { background: white; border-color: var(--border); }
    100% { background: var(--danger); color: white; border-color: var(--danger); }
}

/* Shake errore */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
}

/* Fade In */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Pulse */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Slide Up */
@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================
   SCHERMATA INTRO
   ============================================ */
.intro-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.intro-content {
    background: white;
    border-radius: 24px;
    padding: var(--spacing-xl);
    max-width: 600px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.6s;
}

.intro-title {
    font-family: var(--font-title);
    font-size: 48px;
    font-weight: 700;
    text-align: center;
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
}

.intro-subtitle {
    font-size: 20px;
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

.intro-rules {
    background: var(--bg-light);
    padding: var(--spacing-md);
    border-radius: 16px;
    margin-bottom: var(--spacing-lg);
}

.intro-rules h3 {
    font-family: var(--font-title);
    font-size: 20px;
    margin-bottom: var(--spacing-sm);
    color: var(--primary);
}

.intro-rules ul {
    list-style: none;
    padding: 0;
}

.intro-rules li {
    font-size: 16px;
    padding: var(--spacing-xs) 0;
    color: var(--text-primary);
}

.btn-start {
    width: 100%;
    padding: 18px 32px;
    background: linear-gradient(135deg, var(--success) 0%, #45a049 100%);
    color: white;
    font-size: 20px;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-start:active {
    transform: translateY(0);
}

/* ============================================
   GAME SCREEN
   ============================================ */
.game-screen {
    min-height: 100vh;
    background: var(--bg-light);
    position: relative;
    display: none; /* Nascosto all'inizio */
}

/* ============================================
   HEADER E PROGRESS
   ============================================ */
.game-header {
    background: white;
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.cliente-counter {
    font-family: var(--font-title);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.stars-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-title);
    font-size: 18px;
    font-weight: 600;
    color: var(--warning);
}

.stars-icon {
    font-size: 24px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--info) 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ============================================
   FARMACIA BACKGROUND
   ============================================ */
.farmacia-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #e8f4f8 0%, #f5f7fa 100%);
    z-index: -1;
    opacity: 0.3;
}

.scaffali-bg {
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 150px,
            rgba(100, 100, 100, 0.05) 150px,
            rgba(100, 100, 100, 0.05) 160px
        );
}

/* ============================================
   CLIENTE CONTAINER
   ============================================ */
.cliente-container {
    max-width: 900px;
    margin: var(--spacing-lg) auto;
    padding: var(--spacing-md);
}

.cliente-avatar-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    background: white;
    padding: var(--spacing-md);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.cliente-avatar {
    width: 120px;
    height: 120px;
    font-size: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.cliente-info {
    flex: 1;
}

.cliente-nome {
    font-family: var(--font-title);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.cliente-tipo {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.cliente-mood {
    display: inline-block;
    background: var(--bg-light);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-primary);
}

/* ============================================
   DIALOGO E SPEECH BUBBLES
   ============================================ */
.dialogo-container {
    background: white;
    border-radius: 16px;
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

.speech-bubble {
    background: var(--bubble-cliente);
    padding: 24px;
    border-radius: 20px;
    position: relative;
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
}

.speech-bubble::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 20px;
    width: 0;
    height: 0;
    border: 12px solid transparent;
    border-right-color: var(--bubble-cliente);
}

.speech-bubble p {
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
}

.speech-bubble.small {
    padding: 16px;
    font-size: 16px;
}

/* ============================================
   STEP INDICATOR
   ============================================ */
.step-indicator {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.step-label {
    font-family: var(--font-title);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   RISPOSTE
   ============================================ */
.risposte-container {
    margin-top: var(--spacing-lg);
}

.risposte-title {
    font-family: var(--font-title);
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: var(--spacing-md);
}

.risposte-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.risposta-option {
    background: white;
    border: 2px solid var(--border);
    padding: 20px;
    border-radius: 12px;
    text-align: left;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.risposta-option:hover {
    border-color: var(--primary);
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
    background: #f8fbff;
}

.risposta-option:active {
    transform: scale(0.98);
}

/* ============================================
   MODAL OVERLAY
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    padding: 20px;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 24px;
    padding: var(--spacing-xl);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
    animation: slideUp 0.5s;
}

/* ============================================
   FEEDBACK STEP MODAL
   ============================================ */
.feedback-step-content {
    text-align: center;
}

.feedback-icon {
    font-size: 80px;
    margin-bottom: var(--spacing-md);
    animation: iconBounce 0.6s;
}

.feedback-title {
    font-family: var(--font-title);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

.cliente-response {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.cliente-avatar-small {
    width: 50px;
    height: 50px;
    font-size: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feedback-points {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
}

.btn-continue {
    width: 100%;
    padding: 16px 32px;
    background: var(--primary);
    color: white;
    font-size: 18px;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
}

.btn-continue:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   RECENSIONE MODAL
   ============================================ */
.recensione-content {
    text-align: center;
}

.recensione-title {
    font-family: var(--font-title);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    color: var(--primary);
}

.cliente-recap {
    margin-bottom: var(--spacing-lg);
}

.cliente-avatar-large {
    width: 100px;
    height: 100px;
    font-size: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-sm);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
}

.cliente-recap h3 {
    font-family: var(--font-title);
    font-size: 24px;
    color: var(--text-primary);
}

.stelle-container {
    margin-bottom: var(--spacing-lg);
}

.stelle-display {
    font-size: 48px;
    letter-spacing: 5px;
    margin-bottom: var(--spacing-sm);
}

.stelle-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
}

.recensione-text {
    background: var(--bg-light);
    padding: var(--spacing-md);
    border-radius: 12px;
    margin-bottom: var(--spacing-lg);
}

.recensione-text p {
    font-size: 18px;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.6;
}

.btn-next-cliente {
    width: 100%;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--success) 0%, #45a049 100%);
    color: white;
    font-size: 18px;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
}

.btn-next-cliente:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   FINAL SCREEN
   ============================================ */
.final-screen {
    min-height: 100vh;
    display: none; /* Nascosto all'inizio, poi diventa flex */
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.final-content {
    background: white;
    border-radius: 24px;
    padding: var(--spacing-xl);
    max-width: 800px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.6s;
}

.final-title {
    font-family: var(--font-title);
    font-size: 42px;
    font-weight: 700;
    text-align: center;
    color: var(--primary);
    margin-bottom: var(--spacing-lg);
}

.final-stars {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, #FFF8E1 0%, #FFE082 100%);
    border-radius: 16px;
}

.final-stars-big {
    font-family: var(--font-title);
    font-size: 64px;
    font-weight: 700;
    color: var(--warning);
    margin-bottom: var(--spacing-xs);
}

.final-stars-label {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 600;
}

.final-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: var(--bg-light);
    padding: var(--spacing-md);
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    font-size: 40px;
    display: block;
    margin-bottom: var(--spacing-xs);
}

.stat-value {
    font-family: var(--font-title);
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    display: block;
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    display: block;
}

.final-badge {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    border-radius: 16px;
}

.final-badge h3 {
    font-family: var(--font-title);
    font-size: 20px;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.badge-display {
    font-family: var(--font-title);
    font-size: 28px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.badge-message {
    font-size: 16px;
    color: var(--text-secondary);
}

.final-details {
    margin-bottom: var(--spacing-lg);
}

.final-details h4 {
    font-family: var(--font-title);
    font-size: 20px;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.clienti-recap-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.cliente-recap-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--bg-light);
    padding: var(--spacing-sm);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.recap-avatar {
    width: 50px;
    height: 50px;
    font-size: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.recap-info {
    flex: 1;
}

.recap-info h4 {
    font-family: var(--font-title);
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.recap-stelle {
    font-size: 16px;
    letter-spacing: 2px;
}

.btn-restart {
    width: 100%;
    padding: 18px 32px;
    background: linear-gradient(135deg, var(--primary) 0%, #1976D2 100%);
    color: white;
    font-size: 20px;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
}

.btn-restart:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   SCROLLBAR PERSONALIZZATA
   ============================================ */
.clienti-recap-list::-webkit-scrollbar {
    width: 8px;
}

.clienti-recap-list::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

.clienti-recap-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.clienti-recap-list::-webkit-scrollbar-thumb:hover {
    background: #1976D2;
}

/* ============================================
   RESPONSIVE - MOBILE < 768px
   ============================================ */
@media (max-width: 767px) {
    .intro-title {
        font-size: 36px;
    }

    .intro-subtitle {
        font-size: 16px;
    }

    .intro-rules li {
        font-size: 14px;
    }

    .btn-start {
        font-size: 18px;
        padding: 16px 24px;
    }

    .cliente-avatar-container {
        flex-direction: column;
        text-align: center;
    }

    .cliente-avatar {
        width: 80px;
        height: 80px;
        font-size: 50px;
    }

    .cliente-nome {
        font-size: 24px;
    }

    .cliente-tipo {
        font-size: 14px;
    }

    .speech-bubble p {
        font-size: 16px;
    }

    .risposte-option {
        padding: 15px;
        font-size: 14px;
    }

    .feedback-icon {
        font-size: 60px;
    }

    .feedback-title {
        font-size: 24px;
    }

    .recensione-title {
        font-size: 24px;
    }

    .stelle-display {
        font-size: 36px;
    }

    .final-title {
        font-size: 32px;
    }

    .final-stars-big {
        font-size: 48px;
    }

    .stat-value {
        font-size: 28px;
    }

    .badge-display {
        font-size: 22px;
    }
}

/* ============================================
   RESPONSIVE - TABLET 768px - 1024px
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
    .cliente-avatar {
        width: 100px;
        height: 100px;
        font-size: 60px;
    }

    .cliente-nome {
        font-size: 26px;
    }

    .risposta-option {
        padding: 18px;
        font-size: 15px;
    }
}

/* ============================================
   RESPONSIVE - DESKTOP > 1024px
   ============================================ */
@media (min-width: 1024px) {
    .game-screen {
        max-width: 1200px;
        margin: 0 auto;
    }

    .cliente-container {
        padding: var(--spacing-lg);
    }

    .risposta-option {
        padding: 20px;
        font-size: 16px;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center {
    text-align: center;
}

.mb-sm {
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

.hidden {
    display: none !important;
}
