/* ===================================
   SOMMA OK! - CSS PRINCIPALE
   Design ottimizzato per bambini
   ================================== */

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* ===================================
   PAGINA LOGIN
   ================================== */
.login-box {
    background: white;
    border-radius: 30px;
    padding: 50px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.login-box h1 {
    font-size: 3em;
    color: #667eea;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 40px;
}

.login-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 30px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 1.3em;
    color: #333;
    margin-bottom: 10px;
    font-weight: bold;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.2em;
    border: 3px solid #667eea;
    border-radius: 15px;
    outline: none;
    transition: all 0.3s;
    font-family: inherit;
}

.form-group input[type="text"]:focus {
    border-color: #764ba2;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

/* Livelli - Card */
.level-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.level-card {
    position: relative;
    cursor: pointer;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s;
    border: 4px solid transparent;
}

.level-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.level-content {
    padding: 25px 15px;
    text-align: center;
    background: #f5f5f5;
    transition: all 0.3s;
}

.level-card:hover .level-content {
    transform: translateY(-5px);
}

.level-emoji {
    font-size: 3em;
    display: block;
    margin-bottom: 10px;
}

.level-content h3 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 8px;
}

.level-content p {
    font-size: 0.95em;
    color: #666;
    margin-bottom: 8px;
}

.level-points {
    display: inline-block;
    background: #4caf50;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
}

/* Livelli - Colori */
.level-card.base .level-content {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.level-card.intermedio .level-content {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}

.level-card.avanzato .level-content {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

/* Stato Selezionato */
.level-card input[type="radio"]:checked ~ .level-content {
    border: 4px solid #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    transform: scale(1.05);
}

.btn-play {
    width: 100%;
    padding: 20px;
    font-size: 1.5em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 30px;
    transition: all 0.3s;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-play:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.6);
}

.footer-links {
    margin-top: 30px;
}

.footer-links a {
    color: #667eea;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: bold;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #764ba2;
}

/* ===================================
   PAGINA GIOCO
   ================================== */
.game-page {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.game-container {
    background: white;
    border-radius: 30px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 15px;
}

.player-info {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.player-name {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
}

.level-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    color: white;
    font-size: 1em;
}

.level-badge.base {
    background: linear-gradient(135deg, #56ccf2, #2f80ed);
}

.level-badge.intermedio {
    background: linear-gradient(135deg, #f2994a, #f2c94c);
}

.level-badge.avanzato {
    background: linear-gradient(135deg, #eb5757, #f093fb);
}

.game-stats {
    display: flex;
    gap: 20px;
}

.stat-box {
    text-align: center;
    padding: 15px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    color: white;
    min-width: 120px;
}

.stat-box.timer.warning {
    background: linear-gradient(135deg, #eb5757 0%, #ff6b6b 100%);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.stat-label {
    display: block;
    font-size: 0.9em;
    margin-bottom: 5px;
    opacity: 0.9;
}

.stat-value {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
}

/* Messaggi di feedback */
.message {
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: bold;
    text-align: center;
    transition: opacity 0.3s;
}

.message.success {
    background: #4caf50;
    color: white;
}

.message.error {
    background: #f44336;
    color: white;
}

/* Area domanda */
.game-content {
    text-align: center;
    padding: 40px 20px;
}

.question-box {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 50px 30px;
    border-radius: 25px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.operation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: 3.5em;
    font-weight: bold;
    color: #333;
    flex-wrap: wrap;
}

.number {
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    text-align: center;
}

.operator, .equals {
    color: #667eea;
}

.question-mark {
    color: #f2994a;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Form risposta */
.answer-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.answer-form input[type="number"] {
    flex: 1;
    padding: 20px;
    font-size: 2em;
    border: 4px solid #667eea;
    border-radius: 15px;
    text-align: center;
    outline: none;
    font-family: inherit;
    font-weight: bold;
}

.answer-form input[type="number"]:focus {
    border-color: #764ba2;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

.btn-submit {
    padding: 20px 40px;
    font-size: 1.5em;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.6);
}

.game-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 3px solid #f0f0f0;
}

.btn-quit {
    display: inline-block;
    padding: 12px 30px;
    background: #f44336;
    color: white;
    text-decoration: none;
    border-radius: 15px;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-quit:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

/* ===================================
   PAGINA RISULTATI
   ================================== */
.result-page {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.result-box {
    background: white;
    border-radius: 30px;
    padding: 50px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.result-icon {
    font-size: 5em;
    margin-bottom: 20px;
    display: block;
}

.result-box h1 {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 10px;
}

.final-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.stat-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 25px;
    border-radius: 20px;
    text-align: center;
}

.stat-item.highlight {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stat-label {
    display: block;
    font-size: 1em;
    color: #666;
    margin-bottom: 10px;
}

.stat-value-large {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
    color: #333;
}

.stat-value-huge {
    display: block;
    font-size: 3.5em;
    font-weight: bold;
    color: #667eea;
}

.result-message {
    margin: 30px 0;
    font-size: 1.3em;
}

.result-message p {
    padding: 15px 25px;
    border-radius: 15px;
    display: inline-block;
}

.excellence {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #333;
}

.great {
    background: linear-gradient(135deg, #56ccf2 0%, #2f80ed 100%);
    color: white;
}

.good {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
}

.keep-trying {
    background: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%);
    color: white;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

.btn-primary {
    padding: 18px 35px;
    font-size: 1.2em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 15px;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    display: inline-block;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    padding: 18px 35px;
    font-size: 1.2em;
    background: white;
    color: #667eea;
    text-decoration: none;
    border: 3px solid #667eea;
    border-radius: 15px;
    font-weight: bold;
    transition: all 0.3s;
    display: inline-block;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
    transform: translateY(-3px);
}

/* ===================================
   PAGINA CLASSIFICA
   ================================== */
.classifica-page {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.classifica-box {
    background: white;
    border-radius: 30px;
    padding: 40px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.classifica-box h1 {
    text-align: center;
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

.level-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.tab-link {
    padding: 15px 25px;
    border-radius: 15px;
    text-decoration: none;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 130px;
    border: 3px solid transparent;
}

.tab-link.base {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.tab-link.intermedio {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}

.tab-link.avanzato {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.tab-link.active {
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    transform: scale(1.05);
}

.tab-emoji {
    font-size: 2em;
}

.tab-name {
    font-weight: bold;
    color: #333;
    font-size: 1.1em;
}

.tab-range {
    font-size: 0.85em;
    color: #666;
}

.classifica-content {
    margin-top: 30px;
}

.classifica-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.classifica-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.classifica-table th {
    padding: 15px;
    text-align: left;
    font-size: 1.1em;
}

.classifica-table td {
    padding: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.classifica-table tr:hover {
    background: #f9f9f9;
}

.classifica-table tr.top-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    font-weight: bold;
}

.classifica-table tr.top-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    font-weight: bold;
}

.classifica-table tr.top-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #e8ba94 100%);
    font-weight: bold;
}

.pos-col {
    width: 80px;
    text-align: center;
    font-size: 1.5em;
}

.nickname-col {
    font-size: 1.1em;
}

.punteggio-col {
    width: 120px;
    text-align: center;
    font-size: 1.2em;
    color: #667eea;
}

.data-col {
    width: 180px;
    font-size: 0.9em;
    color: #666;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 4em;
    display: block;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 1.3em;
    color: #666;
}

.empty-subtitle {
    font-size: 1em;
    color: #999;
    margin-top: 10px;
}

/* ===================================
   PAGINA ADMIN
   ================================== */
.admin-page {
    background: linear-gradient(135deg, #434343 0%, #000000 100%);
}

.admin-login {
    max-width: 500px;
}

.admin-panel {
    background: white;
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 15px;
}

.admin-header h1 {
    color: #333;
    font-size: 2em;
}

.admin-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-logout {
    padding: 10px 20px;
    background: #f44336;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #d32f2f;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    font-size: 2.5em;
    display: block;
    margin-bottom: 10px;
}

.stat-number {
    display: block;
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 5px;
}

.admin-actions-panel {
    margin: 30px 0;
}

.admin-actions-panel h2 {
    color: #333;
    margin-bottom: 20px;
}

.quick-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-warning {
    padding: 12px 25px;
    background: #ff9800;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: bold;
    transition: all 0.3s;
    display: inline-block;
}

.btn-warning:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

.admin-table-section {
    margin-top: 40px;
}

.admin-table-section h2 {
    color: #333;
    margin-bottom: 20px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.admin-table thead {
    background: #333;
    color: white;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
}

.admin-table tr:nth-child(even) {
    background: #f9f9f9;
}

.admin-table tr:hover {
    background: #f0f0f0;
}

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 12px;
    color: white;
    font-size: 0.85em;
    font-weight: bold;
}

.badge.base {
    background: linear-gradient(135deg, #56ccf2, #2f80ed);
}

.badge.intermedio {
    background: linear-gradient(135deg, #f2994a, #f2c94c);
}

.badge.avanzato {
    background: linear-gradient(135deg, #eb5757, #f093fb);
}

.btn-delete {
    padding: 6px 12px;
    background: #f44336;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9em;
    transition: all 0.3s;
    display: inline-block;
}

.btn-delete:hover {
    background: #d32f2f;
}

.btn-link {
    padding: 12px 25px;
    background: transparent;
    color: #667eea;
    text-decoration: none;
    border: 2px solid #667eea;
    border-radius: 10px;
    font-weight: bold;
    transition: all 0.3s;
    display: inline-block;
}

.btn-link:hover {
    background: #667eea;
    color: white;
}

/* ===================================
   RESPONSIVE
   ================================== */
@media (max-width: 768px) {
    .login-box, .result-box, .classifica-box, .admin-panel {
        padding: 30px 20px;
    }

    .login-box h1, .result-box h1, .classifica-box h1 {
        font-size: 2em;
    }

    .operation {
        font-size: 2.5em;
        gap: 10px;
    }

    .number {
        padding: 15px 20px;
        min-width: 80px;
    }



    .game-header {
        flex-direction: column;
        text-align: center;
    }

    .level-options {
        grid-template-columns: 1fr;
    }

    .stats-grid, .final-stats {
        grid-template-columns: 1fr;
    }

    .classifica-table {
        font-size: 0.9em;
    }

    .data-col {
        display: none;
    }
}
