* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, sans-serif; }

body {
    background: #0d0d11;
    color: #e0e0e6;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ── Top bar ── */
#topbar {
    background: #14141a;
    border-bottom: 2px solid #ff0055;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    z-index: 20;
}

#topbar h1 {
    font-size: 1.1rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    white-space: nowrap;
}

#topbar h1 span { color: #ff0055; }

.stat-chip {
    background: #252530;
    border: 1px solid #333;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.75rem;
    color: #8a8a9e;
    white-space: nowrap;
}

.stat-chip strong { color: #00ffcc; }

#topbar .spacer { flex: 1; }

#view-toggle {
    display: flex;
    gap: 6px;
}

.view-btn {
    background: #252530;
    border: 1px solid #333;
    color: #8a8a9e;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.view-btn.active, .view-btn:hover {
    background: #ff0055;
    border-color: #ff0055;
    color: #fff;
}

/* ── Language selector ── */
#language-selector {
    display: flex;
    gap: 6px;
}

.lang-btn {
    background: #252530;
    border: 1px solid #333;
    color: #8a8a9e;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    min-width: 38px;
    text-align: center;
}

.lang-btn:hover {
    background: #333340;
    border-color: #555;
}

.lang-btn.active {
    background: #ff0055;
    border-color: #ff0055;
    color: #fff;
}

/* ── Main layout ── */
#main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Left sidebar ── */
#left-panel {
    width: 260px;
    background: #14141a;
    border-right: 2px solid #252530;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

#left-panel-header {
    padding: 12px 16px 10px;
    border-bottom: 1px solid #252530;
}

#panel-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.panel-tab {
    flex: 1;
    background: #1a1a24;
    border: 1px solid #252530;
    color: #555566;
    padding: 5px 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.15s;
}

.panel-tab:hover { color: #aaa; }
.panel-tab.active { background: #252530; color: #fff; border-color: #ff0055; }

.search-box {
    width: 100%;
    background: #1a1a24;
    border: 1px solid #333;
    color: #fff;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-box:focus { border-color: #00ffcc; }
.search-box::placeholder { color: #555; }

.alphabet-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 8px 16px;
    border-bottom: 1px solid #252530;
}

.letter-btn {
    background: none;
    border: none;
    color: #555566;
    font-size: 0.65rem;
    padding: 3px 5px;
    cursor: pointer;
    border-radius: 3px;
    text-transform: uppercase;
    transition: all 0.15s;
}

.letter-btn:hover { color: #fff; background: #252530; }
.letter-btn.active { background: #ff0055; color: #fff; }

.genre-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
}

.genre-list::-webkit-scrollbar { width: 4px; }
.genre-list::-webkit-scrollbar-track { background: transparent; }
.genre-list::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.genre-item {
    padding: 7px 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #a0a0b0;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.genre-item:hover { background: #1a1a24; color: #fff; }

.genre-item.active {
    background: #252530;
    color: #00ffcc;
    border-left: 3px solid #00ffcc;
    padding-left: 7px;
}

.genre-badge {
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 600;
    flex-shrink: 0;
}

.genre-badge.classici { background: rgba(0,204,170,0.15); color: #00ccaa; }
.genre-badge.extreme  { background: rgba(255,0,85,0.15);  color: #ff0055; }
.genre-badge.fusion   { background: rgba(153,51,255,0.15); color: #9933ff; }

.genre-band-count {
    margin-left: auto;
    font-size: 0.7rem;
    color: #555;
}

/* ── Center graph ── */
#graph-area {
    flex: 1;
    position: relative;
    background: radial-gradient(ellipse at center, #1a1a24 0%, #0d0d11 100%);
}

#network { width: 100%; height: 100%; }

#legend {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(13,13,17,0.9);
    border: 1px solid #252530;
    border-radius: 6px;
    padding: 10px 14px;
    pointer-events: none;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #8a8a9e;
    margin-bottom: 5px;
}

.legend-row:last-child { margin-bottom: 0; }

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Right sidebar ── */
#right-panel {
    width: 320px;
    background: #14141a;
    border-left: 2px solid #252530;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

#right-header {
    padding: 16px 18px;
    border-bottom: 1px solid #252530;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#right-header h2 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #555566;
}

.reset-btn {
    background: none;
    border: 1px solid #333;
    color: #555566;
    padding: 3px 9px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-btn:hover { border-color: #ff0055; color: #ff0055; }

#detail-panel {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
}

#detail-panel::-webkit-scrollbar { width: 4px; }
#detail-panel::-webkit-scrollbar-track { background: transparent; }
#detail-panel::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.placeholder-msg {
    color: #444455;
    font-style: italic;
    font-size: 0.85rem;
    line-height: 1.6;
    margin-top: 20px;
    text-align: center;
}

.placeholder-msg .icon { font-size: 2rem; display: block; margin-bottom: 10px; }

/* Genre detail */
.detail-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    line-height: 1.2;
}

.detail-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.meta-tag {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.meta-tag.type-classici { background: rgba(0,204,170,0.15); color: #00ccaa; border: 1px solid rgba(0,204,170,0.3); }
.meta-tag.type-extreme  { background: rgba(255,0,85,0.15);  color: #ff0055; border: 1px solid rgba(255,0,85,0.3); }
.meta-tag.type-fusion   { background: rgba(153,51,255,0.15); color: #9933ff; border: 1px solid rgba(153,51,255,0.3); }

.detail-description {
    font-size: 0.82rem;
    color: #888;
    line-height: 1.6;
    margin-bottom: 16px;
    border-left: 2px solid #252530;
    padding-left: 10px;
}

.detail-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #1a1a24;
}

.section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #555566;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-count {
    background: #252530;
    color: #888;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 10px;
}

/* Band cards */
.band-card {
    background: #1a1a24;
    border: 1px solid #252530;
    border-radius: 5px;
    padding: 9px 11px;
    margin-bottom: 6px;
    cursor: default;
    transition: all 0.15s;
}

.band-card:hover { border-color: #333; background: #1e1e28; }

.band-card.iconic {
    border-color: rgba(255, 204, 0, 0.3);
    background: linear-gradient(135deg, #1a1a24 0%, #1e1b14 100%);
}

.band-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.band-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e0e0e6;
    flex: 1;
}

.band-card.iconic .band-name { color: #fff; }

.iconic-star { font-size: 1rem; flex-shrink: 0; filter: drop-shadow(0 0 4px rgba(255,0,85,0.6)); }

.band-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.band-country {
    font-size: 0.7rem;
    color: #555566;
    display: flex;
    align-items: center;
    gap: 4px;
}


.cross-genre {
    font-size: 0.65rem;
    color: #555566;
    font-style: italic;
    margin-top: 3px;
}

.cross-genre-link {
    color: #7755aa;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    transition: color 0.15s;
}

.cross-genre-link:hover { color: #cc99ff; }

/* Sub-genres list in detail */
.subgenre-chip {
    display: inline-block;
    background: rgba(0,255,204,0.08);
    border: 1px solid rgba(0,255,204,0.15);
    color: #00ffcc;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 12px;
    margin: 3px 3px 0 0;
    cursor: pointer;
    transition: all 0.15s;
}

.subgenre-chip:hover { background: rgba(0,255,204,0.15); }

/* Loading state */
#loading-overlay {
    position: absolute;
    inset: 0;
    background: #0d0d11;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    gap: 16px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,0,85,0.2);
    border-top-color: #ff0055;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

#loading-overlay p { color: #555566; font-size: 0.85rem; }

/* Disco button inside band card */
.disco-btn {
    margin-left: auto;
    background: none;
    border: 1px solid #333;
    color: #555566;
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.disco-btn:hover { border-color: #ff0055; color: #ff0055; }

.meta-tag.meta-neutral { background: #1a1a24; color: #888; border: 1px solid #333; }

/* Discography modal */
#disco-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.disco-modal {
    background: #14141a;
    border: 2px solid #ff0055;
    border-radius: 8px;
    padding: 24px 28px;
    width: 420px;
    max-width: 90vw;
    max-height: 75vh;
    overflow-y: auto;
    position: relative;
}
.disco-modal::-webkit-scrollbar { width: 4px; }
.disco-modal::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.disco-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #252530;
}
.disco-header h2 { color: #00ffcc; font-size: 1.2rem; }

.disco-close {
    background: none;
    border: 1px solid #333;
    color: #8a8a9e;
    width: 28px; height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
    flex-shrink: 0;
}
.disco-close:hover { border-color: #ff0055; color: #ff0055; }

.album-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid #1a1a24;
    font-size: 0.85rem;
}
.album-row:last-child { border-bottom: none; }

.album-year {
    font-family: monospace;
    font-size: 0.8rem;
    color: #ffcc00;
    min-width: 36px;
    flex-shrink: 0;
}
.album-title { color: #c5c5d2; flex: 1; }

.album-row.representative .album-title { color: #fff; font-weight: 600; }
.album-iconic { font-size: 0.9rem; filter: drop-shadow(0 0 4px rgba(255,0,85,0.7)); }

/* Legend dashed line */
.legend-row.dashed .legend-line {
    width: 20px; height: 2px;
    background: repeating-linear-gradient(90deg, #3a2a3a 0, #3a2a3a 4px, transparent 4px, transparent 8px);
    flex-shrink: 0;
}
.legend-row.solid .legend-line {
    width: 20px; height: 2px;
    background: #444466;
    flex-shrink: 0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 20px 0;
    color: #444455;
    font-size: 0.8rem;
}

/* ── Mobile bottom nav (hidden on desktop) ── */
#mobile-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #14141a;
    border-top: 2px solid #252530;
    height: 56px;
    z-index: 100;
    justify-content: space-around;
    align-items: stretch;
}

.mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #555566;
    font-size: 0.65rem;
    gap: 2px;
    cursor: pointer;
    transition: color 0.15s;
    padding: 6px 0;
}

.mobile-nav-btn:hover { color: #aaa; }
.mobile-nav-btn.active { color: #ff0055; }
.mobile-nav-btn .nav-icon { font-size: 1.2rem; line-height: 1; }
.mobile-nav-btn .nav-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Responsive: mobile (< 768px) ── */
@media (max-width: 767px) {

    /* Body: allow content to flow */
    body { overflow: hidden; }

    /* Topbar: compatto */
    #topbar {
        padding: 8px 12px;
        gap: 8px;
        flex-wrap: nowrap;
    }

    #topbar h1 {
        font-size: 0.85rem;
        letter-spacing: 1px;
    }

    .stat-chip { display: none; }

    #topbar .spacer { flex: 1; min-width: 0; }

    .lang-btn {
        padding: 6px 10px;
        min-height: 36px;
        font-size: 0.85rem;
    }

    /* Main layout: stack verticale, pannelli nascosti */
    #main {
        flex-direction: column;
        padding-bottom: 56px; /* spazio per bottom nav */
    }

    #left-panel {
        display: none;
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        z-index: 10;
        flex-direction: column;
    }

    #right-panel {
        display: none;
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        z-index: 10;
        flex-direction: column;
    }

    #graph-area {
        width: 100%;
        flex: 1;
        min-height: 0; /* necessario per flex-child con altezza 100% */
    }

    #network {
        width: 100% !important;
        height: 100% !important;
    }

    /* Vista attiva (gestita via JS) */
    #left-panel.mobile-active  { display: flex; }
    #right-panel.mobile-active { display: flex; }
    #graph-area.mobile-hidden  { display: none; }

    /* Mostra bottom nav */
    #mobile-nav { display: flex; }

    /* Left panel: header più alto per tap facile */
    #left-panel-header { padding: 14px 16px 12px; }

    .panel-tab {
        padding: 10px 0;
        font-size: 0.8rem;
        min-height: 40px;
    }

    .search-box {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    /* Filtro alfabetico: bottoni più grandi */
    .alphabet-filter { padding: 8px 12px; gap: 4px; }

    .letter-btn {
        font-size: 0.72rem;
        padding: 6px 6px;
        min-width: 24px;
        min-height: 32px;
    }

    /* Lista generi: voci più alte per tap */
    .genre-item {
        padding: 11px 10px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .genre-badge { font-size: 0.65rem; }

    /* Detail panel: padding più ampio */
    #detail-panel { padding: 16px 16px 24px; }

    #right-header { padding: 14px 16px; }

    .reset-btn {
        padding: 8px 14px;
        font-size: 0.75rem;
        min-height: 36px;
    }

    /* Band cards: più leggibili */
    .band-name { font-size: 0.9rem; }
    .band-country { font-size: 0.75rem; }

    .cross-genre { font-size: 0.72rem; }

    .disco-btn {
        font-size: 0.72rem;
        padding: 6px 10px;
        min-height: 32px;
    }

    /* Subgenre chips: più grandi */
    .subgenre-chip {
        font-size: 0.8rem;
        padding: 5px 10px;
        margin: 4px 4px 0 0;
    }

    /* Legend: nascosta su mobile (occupa spazio prezioso) */
    #legend { display: none; }

    /* Modal discografia: full-width su mobile */
    .disco-modal {
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-radius: 12px 12px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        padding: 20px 20px 32px;
        position: fixed;
        bottom: 0; left: 0; right: 0;
    }

    #disco-overlay {
        align-items: flex-end !important;
    }

    .disco-close {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .album-row { font-size: 0.9rem; padding: 10px 0; }
    .album-year { font-size: 0.85rem; }

    /* Detail name */
    .detail-name { font-size: 1.3rem; }

    .section-title { font-size: 0.75rem; }
    .meta-tag { font-size: 0.72rem; }
}
