/* style.css - Stili per Quiz 2 Cavalli */

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

:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --bg-primary: #ecf0f1;
    --bg-secondary: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Schermate */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5em;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1em;
}

/* Schermata iniziale */
.start-form {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button.primary {
    background-color: var(--primary-color);
    color: white;
}

.button.primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.button.secondary {
    background-color: var(--secondary-color);
    color: white;
}

.button.secondary:hover {
    background-color: #34495e;
}

.button.large {
    width: 100%;
    padding: 18px;
    font-size: 1.2em;
    margin-bottom: 20px;
}

.instructions {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin: 30px 0;
}

.instructions h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

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

.instructions li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.instructions li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.tip {
    background-color: #e3f2fd;
    color: #1565c0;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid var(--primary-color);
}

.coordinates-reminder {
    background-color: #fff3e0;
    color: #e65100;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border-left: 4px solid var(--warning-color);
    font-size: 0.9em;
}

/* Quiz header */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.progress-bar {
    flex: 1;
    height: 30px;
    background-color: #e0e0e0;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
    margin-right: 20px;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
    width: 5%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: var(--text-primary);
}

.timer {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
    min-width: 80px;
}

/* Domanda */
.question-container {
    text-align: center;
    margin-bottom: 30px;
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.question-container h2 {
    font-size: 1.4em;
    line-height: 1.6;
}

.mental-note {
    margin-top: 10px;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.highlight-blue {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2em;
}

.highlight-red {
    color: var(--danger-color);
    font-weight: bold;
    font-size: 1.2em;
}

/* Visualizzazione caselle */
.visualization-container {
    background: var(--bg-secondary);
    padding: 30px 15px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.big-squares {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.big-square {
    width: 150px;
    height: 150px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.big-square:hover {
    transform: translateY(-5px);
}

.start-square {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.end-square {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.square-label {
    font-size: 0.9em;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.square-name {
    font-size: 3em;
    font-weight: bold;
    text-transform: uppercase;
}

.arrow {
    font-size: 3em;
    color: var(--text-secondary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* Bottoni risposta */
.answer-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.answer-btn {
    padding: 30px;
    border-radius: 15px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.answer-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.answer-btn.yes {
    border-color: var(--success-color);
}

.answer-btn.yes:hover {
    background-color: var(--success-color);
    color: white;
}

.answer-btn.no {
    border-color: var(--danger-color);
}

.answer-btn.no:hover {
    background-color: var(--danger-color);
    color: white;
}

.answer-btn .big {
    display: block;
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.answer-btn .small {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Statistiche quiz */
.quiz-stats {
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
}

.quiz-stats .correct {
    color: var(--success-color);
    margin-right: 30px;
}

.quiz-stats .wrong {
    color: var(--danger-color);
}

/* Schermata risultati */
.results-box {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.final-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (min-width: 600px) {
    .final-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-box {
    text-align: center;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 10px;
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-secondary);
}

.performance-message {
    text-align: center;
    font-size: 1.3em;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 10px;
}

.performance-message.excellent {
    background-color: #d4edda;
    color: #155724;
}

.performance-message.good {
    background-color: #cfe2ff;
    color: #084298;
}

.performance-message.average {
    background-color: #fff3cd;
    color: #664d03;
}

.performance-message.poor {
    background-color: #f8d7da;
    color: #721c24;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

/* Review section */
.review-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.review-list {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.review-item {
    display: grid;
    grid-template-columns: 30px 1fr auto auto;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.review-item.correct {
    border-left: 4px solid var(--success-color);
}

.review-item.wrong {
    border-left: 4px solid var(--danger-color);
}

.review-number {
    font-weight: bold;
    color: var(--text-secondary);
}

.review-squares {
    font-weight: 500;
}

.review-answer {
    font-weight: bold;
}

.review-result {
    font-size: 1.2em;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s;
}

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

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2em;
    cursor: pointer;
    color: var(--text-secondary);
}

.close:hover {
    color: var(--text-primary);
}

/* Classifica */
.leaderboard-content {
    margin-top: 20px;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin-bottom: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.leaderboard-entry.current-user {
    background-color: #e3f2fd;
    border: 2px solid var(--primary-color);
}

.leaderboard-position {
    font-weight: bold;
    font-size: 1.2em;
    color: var(--text-secondary);
}

.leaderboard-position.gold {
    color: #ffd700;
}

.leaderboard-position.silver {
    color: #c0c0c0;
}

.leaderboard-position.bronze {
    color: #cd7f32;
}

.leaderboard-name {
    font-weight: 600;
}

.leaderboard-score {
    font-weight: bold;
    color: var(--primary-color);
}

.leaderboard-time {
    color: var(--text-secondary);
}

/* Mobile */
@media (max-width: 600px) {
    h1 {
        font-size: 2em;
    }
    
    .big-squares {
        flex-direction: row;
        gap: 15px;
        padding: 0 10px;
    }
    
    .big-square {
        width: 90px;
        height: 90px;
    }
    
    .square-label {
        font-size: 0.8em;
        margin-bottom: 5px;
    }
    
    .square-name {
        font-size: 1.8em;
    }
    
    .arrow {
        font-size: 1.5em;
    }
    
    .question-container {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .question-container h2 {
        font-size: 1.2em;
    }
    
    .answer-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .answer-btn {
        padding: 15px;
    }
    
    .answer-btn .big {
        font-size: 1.3em;
    }
    
    .answer-btn .small {
        font-size: 0.8em;
    }
    
    .leaderboard-entry {
        grid-template-columns: 30px 1fr auto;
    }
    
    .leaderboard-time {
        display: none;
    }
}