/* ====================================================================
   [ISS] DARK GAMING MODERNO - Foglio di stile v2 Completo
   ==================================================================== */

:root {
    --bg-base: #0f1115;
    --bg-surface: #181a1f;
    --bg-surface-hover: #1f2228;
    --border: #2a2d35;
    --border-hover: #3a3f4a;
    --text-primary: #e6e8eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #38bdf8;       /* Ciano */
    --accent-glow: rgba(56, 189, 248, 0.15);
    --green: #4ade80;
    --red: #f87171;
    --yellow: #fbbf24;
    --purple: #a78bfa;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Roboto Mono', monospace;
}

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

html { height: 100%; background: var(--bg-base); }

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    background: var(--bg-base);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   LAYOUT PRINCIPALE
   ============================================ */
.wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.logoDiv {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px 30px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}

.centerLogo {
    max-width: 220px;
    height: auto;
    margin-bottom: 24px;
    filter: drop-shadow(0 4px 20px rgba(0,0,0,0.5));
    transition: transform 0.3s ease;
}
.centerLogo:hover { transform: scale(1.05); }

.title-container {
    display: inline-block;
    padding: 16px 40px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}
.title-container:hover { 
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.title-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    animation: flash 4s infinite;
}
@keyframes flash {
    0%, 70% { left: -100%; }
    100% { left: 200%; }
}

.gradient-text-h1 {
    font-family: var(--font-sans);
    font-weight: 800;
    font-size: 1.8rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    text-transform: uppercase;
    margin: 0;
}

.bodyDiv {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 32px;
    margin-bottom: 40px;
}

/* ============================================
   CARD DASHBOARD (Stats, Mappe)
   ============================================ */
.stats-dashboard, .stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.map-header-info { margin-bottom: 24px; }

.stat-card, .stat-box {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
}
.stat-card:hover, .stat-box:hover {
    border-color: var(--border-hover);
    background: var(--bg-surface-hover);
}

.stat-icon { font-size: 1.8rem; margin-bottom: 8px; }
.stat-title, .stat-box p {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}
.stat-value, .stat-box h3 {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
    margin: 0;
}
.stat-player {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-top: 10px;
    word-break: break-word;
}
.stat-player a { color: var(--text-primary); text-decoration: none; font-weight: 600; transition: color 0.2s ease; }
.stat-player a:hover { color: var(--accent); }
.stat-detail { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono); }

/* ============================================
   INFO HEADER
   ============================================ */
.head-info {
    background: var(--bg-base);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border: 1px solid var(--border);
    text-align: center;
    font-size: 0.9rem;
}
.head-info .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    margin: 0 4px 6px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.82rem;
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.head-info .badge b { color: var(--text-primary); }
.head-info small { color: var(--text-muted); font-size: 0.8rem; }

/* ============================================
   FORM RICERCA
   ============================================ */
.search-form {
    background: var(--bg-base);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border: 1px solid var(--border);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}
.search-form .form-control {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s ease;
}
.search-form .form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-form .form-control::placeholder { color: var(--text-muted); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.88rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-sans);
    transition: all 0.2s ease;
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #0a1929; border-color: var(--accent); }
.btn-primary:hover { background: #7dd3fc; color: #0a1929; }
.btn-default { background: var(--bg-surface); color: var(--text-secondary); border-color: var(--border); }
.btn-default:hover { background: var(--bg-surface-hover); color: var(--text-primary); border-color: var(--border-hover); }
.btn-xs { padding: 4px 10px; font-size: 0.75rem; }
.btn-info { background: var(--bg-surface); color: var(--accent); border-color: rgba(56,189,248,0.3); }
.btn-info:hover { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

/* ============================================
   TABELLE GENERALI
   ============================================ */
.table {
    width: 100%;
    background: var(--bg-base);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 24px;
    border-collapse: separate;
    border-spacing: 0;
}
.table th {
    background: var(--bg-surface-hover);
    color: var(--text-muted);
    padding: 14px 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-sans);
    text-align: left;
}
.table th a { color: var(--text-muted); text-decoration: none; transition: color 0.2s ease; display: inline-flex; align-items: center; gap: 4px; }
.table th:hover a { color: var(--text-primary); }
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 0.88rem;
    color: var(--text-primary);
    transition: background 0.15s ease;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--bg-surface-hover); }
.table tbody tr.player-pending td { opacity: 0.55; }

.numeric-col { text-align: right; font-family: var(--font-mono); font-size: 0.88rem; font-weight: 600; }
.color-green { color: var(--green) !important; }
.color-red { color: var(--red) !important; }
.pending-badge { display: inline-block; background: var(--bg-surface-hover); color: var(--text-muted); font-size: 0.7rem; padding: 2px 8px; border-radius: 20px; margin-left: 6px; font-weight: 500; }
.country-cell { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.flag-icon { height: 20px; width: 28px; border-radius: 3px; border: 1px solid var(--border); object-fit: cover; background: var(--bg-surface); margin-right: 8px; }

/* ============================================
   PAGINAZIONE
   ============================================ */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 24px; flex-wrap: wrap; }
.pagination a, .pagination span {
    background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-secondary);
    border-radius: var(--radius-sm); padding: 8px 14px; min-width: 40px; text-align: center;
    font-weight: 600; font-size: 0.85rem; text-decoration: none; transition: all 0.2s ease; display: inline-block;
}
.pagination a:hover { background: var(--bg-surface-hover); border-color: var(--border-hover); color: var(--text-primary); }
.pagination .active { background: var(--accent); border-color: var(--accent); color: #0a1929; }
.pagination .disabled { opacity: 0.35; pointer-events: none; }

/* ============================================
   MISC & FOOTER
   ============================================ */
a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: #7dd3fc; }
hr { border: none; height: 1px; background: var(--border); margin: 32px 0; }
.footerDiv {
    padding: 24px 20px; margin-top: 40px; text-align: center; background: var(--bg-surface);
    border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--text-muted); border-radius: var(--radius);
}
.alert-warning {
    background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--yellow); padding: 20px; border-radius: var(--radius); margin: 20px 0; text-align: center;
}

/* ============================================
   SPECIFICO: WORLD TEAMS (Nazioni e Podio)
   ============================================ */
.top5-dashboard {
    background: var(--bg-surface-hover); border-radius: var(--radius-lg); padding: 25px;
    margin-bottom: 30px; border: 1px solid var(--border); text-align: center;
}
.top5-title {
    font-family: var(--font-sans); font-weight: 800; font-size: 1.2rem; color: var(--text-primary);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 20px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.top5-flags { display: flex; justify-content: center; align-items: flex-end; gap: 30px; flex-wrap: wrap; }
.flag-podium { text-align: center; transition: all 0.3s ease; cursor: pointer; text-decoration: none; }
.flag-podium:hover { transform: translateY(-5px); }
.flag-podium .medal { font-size: 2rem; margin-bottom: 5px; }
.flag-podium .flag-large {
    width: 80px; height: 60px; border-radius: 10px; border: 3px solid var(--border);
    object-fit: cover; box-shadow: 0 5px 20px rgba(0,0,0,0.4); transition: all 0.3s ease; background: var(--bg-base);
}
.flag-podium .nation-name { margin-top: 10px; font-size: 0.85rem; font-weight: bold; color: var(--text-primary); }
.flag-podium .ratio-value { font-size: 0.75rem; color: var(--accent); font-family: var(--font-mono); font-weight: 600; }
.flag-podium.first .flag-large { border-color: var(--yellow); }
.flag-podium.second .flag-large { border-color: #c0c0c0; }
.flag-podium.third .flag-large { border-color: #cd7f32; }

.legend-box { background: var(--bg-base); border-radius: var(--radius); padding: 15px 20px; margin-bottom: 24px; border-left: 4px solid var(--accent); border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.legend-title { color: var(--text-primary); font-weight: bold; margin-bottom: 10px; font-size: 0.9rem; }
.legend-text { color: var(--text-secondary); font-size: 0.8rem; line-height: 1.6; }

.country-header {
    background: var(--bg-base); border-radius: var(--radius-lg); padding: 30px 35px; margin-bottom: 35px;
    display: flex; align-items: center; gap: 30px; flex-wrap: wrap;
    border: 1px solid var(--border); position: relative;
}
.country-header::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.country-header-flag { width: 100px; height: 75px; border-radius: 12px; border: 2px solid var(--border); object-fit: cover; background: var(--bg-surface); }
.country-header-info { flex: 1; }
.country-header-info h2 { margin: 0 0 20px 0; font-family: var(--font-sans); font-size: 2rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; display: flex; align-items: center; gap: 15px; }
.country-stats-main { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.stat-card-sm { background: var(--bg-surface); padding: 12px 20px; border-radius: var(--radius); text-align: center; min-width: 110px; border: 1px solid var(--border); }
.stat-label-sm { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); display: block; margin-bottom: 5px; font-weight: 600; }
.stat-value-sm { font-size: 1.5rem; font-weight: bold; color: var(--accent); font-family: var(--font-mono); }

.back-button {
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 10px 20px; color: var(--text-primary); font-size: 0.9rem; font-weight: 600;
    transition: all 0.3s ease; display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
}
.back-button:hover { background: var(--bg-surface-hover); border-color: var(--border-hover); color: var(--text-primary); }

.country-name { font-weight: bold; font-size: 0.95rem; color: var(--text-primary); }
.player-badge { font-size: 0.8rem; line-height: 1.4; color: var(--text-secondary); }
.player-badge strong { color: var(--text-primary); }
.pending-table td { padding: 12px 10px; }
.pending-progress { min-width: 180px; }
.progress-bar-container { width: 100%; background: var(--bg-surface-hover); height: 6px; border-radius: 3px; overflow: hidden; margin-top: 4px;}
.progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s ease; }
.progress-label { font-size: 0.7rem; color: var(--text-muted); display: block; font-family: var(--font-mono); margin-top: 2px;}

/* ============================================
   SPECIFICO: MAPPE
   ============================================ */
.map-name-cell { font-family: var(--font-mono); font-size: 0.9rem; font-weight: 600; color: var(--text-primary); text-align: left; }
.map-name-cell::before { content: '🗺️'; margin-right: 10px; font-size: 1rem; opacity: 0.7; }
.screenshot-cell { text-align: center; }
.screenshot-link {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    background: var(--bg-surface-hover); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-primary); text-decoration: none; transition: all 0.3s ease;
}
.screenshot-link:hover { background: var(--accent); border-color: var(--accent); color: #0a1929; transform: scale(1.05); }
.percentage-cell { position: relative; font-family: var(--font-mono); font-weight: 600; }
.percentage-bar { position: absolute; left: 0; top: 0; height: 100%; background: rgba(56, 189, 248, 0.1); border-radius: 0 4px 4px 0; z-index: -1; transition: width 0.5s ease; }
.percentage-text { position: relative; z-index: 1; }
.popularity-high { color: var(--green) !important; }
.popularity-medium { color: var(--yellow) !important; }
.popularity-low { color: #fb923c !important; }
.popularity-very-low { color: var(--red) !important; }

/* ============================================
   SCROLLBAR E ANIMAZIONI
   ============================================ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 10px; border: 2px solid var(--bg-base); }
::-webkit-scrollbar-thumb:hover { background: #4b5563; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.bodyDiv { animation: fadeIn 0.4s ease-out; }
.table tbody tr { animation: fadeIn 0.4s ease-out forwards; opacity: 0; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .gradient-text-h1 { font-size: 1.4rem; }
    .stat-value, .stat-box h3 { font-size: 1.5rem; }
    .bodyDiv { padding: 20px; }
    .country-header { flex-direction: column; text-align: center; gap: 15px; padding: 20px; }
    .country-header-info h2 { justify-content: center; }
    .country-stats-main { justify-content: center; }
}
@media (max-width: 768px) {
    .gradient-text-h1 { font-size: 1.1rem; letter-spacing: 0; }
    .title-container { padding: 12px 20px; }
    .table { display: block; overflow-x: auto; }
    .table th, .table td { padding: 10px 12px; font-size: 0.8rem; }
    .search-form { flex-direction: column; }
    .search-form .form-control { max-width: 100%; width: 100%; }
    .stats-dashboard, .stats-container { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card, .stat-box { padding: 14px; }
    .country-cell { min-width: 100px; }
    .flag-podium .flag-large { width: 60px; height: 45px; }
    .top5-flags { gap: 15px; }
}
@media (max-width: 480px) {
    .wrapper { padding: 0 12px; }
    .bodyDiv { padding: 16px; }
    .stats-dashboard, .stats-container { grid-template-columns: 1fr; }
    .top5-flags { gap: 10px; }
    .flag-podium .flag-large { width: 50px; height: 38px; }
    .pending-progress { min-width: 120px; }
}
