/* ==========================================================================
   SOULSPECTRE - GLOBAL NAVIGATION STYLESHEET
   ========================================================================== */

/* --- GLOBAL NAVIGATION BAR --- */
.global-nav {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 60px;
    background: rgba(5, 5, 5, 0.95); 
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex; 
    align-items: center; 
    padding: 0 20px; 
    z-index: 1000;
    box-sizing: border-box; 
    backdrop-filter: blur(5px);
}

.menu-toggle {
    background: none; 
    border: none; 
    color: #fff; 
    font-size: 1.5rem;
    cursor: pointer; 
    margin-right: 20px; 
    transition: color 0.3s;
}

.menu-toggle:hover { 
    color: var(--accent-color, #ab47bc); 
}

.nav-logo-container { 
    height: 40px; 
    display: flex; 
    align-items: center; 
}

.nav-logo-container img { 
    height: 100%; 
    object-fit: contain; 
}

/* --- SIDEBAR DRAWER (ACCORDION) --- */
.sidebar {
    position: fixed; 
    top: 0; 
    left: -320px; 
    width: 300px; 
    height: 100vh;
    background: rgba(10, 10, 15, 0.98); 
    border-right: 1px solid rgba(255,255,255,0.05);
    z-index: 1001; 
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; 
    flex-direction: column; 
    padding: 0;
    box-shadow: 20px 0 50px rgba(0,0,0,0.8);
    overflow: hidden;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 14px 0 40px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

.sidebar.active { 
    left: 0; 
}

.close-sidebar {
    position: absolute; 
    top: 15px; 
    right: 20px; 
    background: none; 
    border: none;
    color: #888; 
    font-size: 1.5rem; 
    cursor: pointer; 
    transition: 0.3s;
}

.close-sidebar:hover { 
    color: #fff; 
}

/* Stile Pulsanti Macro-Categoria */
.accordion-btn {
    background: transparent; 
    color: #ccc; 
    border: none; 
    width: 100%;
    text-align: left; 
    padding: 18px 30px; 
    font-size: 0.95rem;
    text-transform: uppercase; 
    letter-spacing: 2px; 
    font-weight: bold;
    cursor: pointer; 
    transition: all 0.3s ease; 
    border-left: 3px solid transparent;
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}

.accordion-btn:hover { 
    background: rgba(255,255,255,0.03); 
    color: #fff; 
}

.accordion-btn.active { 
    background: rgba(255,255,255,0.05); 
    color: #fff; 
    border-left-color: var(--accent-color, #ab47bc); 
}

.chevron { 
    font-size: 0.8rem; 
    transition: transform 0.3s ease; 
}

.accordion-btn.active .chevron { 
    transform: rotate(180deg); 
    color: var(--accent-color, #ab47bc); 
}

/* Sottomenu */
.accordion-content {
    max-height: 0; 
    overflow: hidden; 
    transition: max-height 0.3s ease-out;
    background: rgba(0, 0, 0, 0.5);
}
.direct-link,
.inner-link,
.branch-unit-link,
.menu-link,
.unit-link {
    display: block;
    text-decoration: none;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.unit-link {
    padding: 7px 30px 7px 95px;
    color: #3a3a3a;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    border-left: 1px solid rgba(255,255,255,0.02);
}

.branch-unit-link {
    padding: 9px 30px 9px 80px;
    color: #555;
    font-size: 0.78rem;
    letter-spacing: 1px;
    border-left: 1px solid rgba(255,255,255,0.03);
}

.inner-link {
    padding: 12px 30px 12px 50px; 
    color: #888;
    font-size: 0.85rem; 
    letter-spacing: 1px; 
    border-left: 1px solid rgba(255,255,255,0.05);
}

.menu-link {
    padding: 9px 30px 9px 65px;
    font-size: 0.78rem;
    letter-spacing: 1px;
    border-left: 1px solid rgba(255,255,255,0.03);
}




/* Link Diretti */
.direct-link {
    padding: 18px 30px; 
    color: #ccc; 
    letter-spacing: 2px; 
    font-weight: bold;
    border-left: 3px solid transparent; 
}
.inner-link:hover { 
    color: var(--accent-color, #ab47bc); 
    padding-left: 55px; 
    background: rgba(255,255,255,0.03); 
}

.inner-link.locked { 
    color: #444; 
    cursor: not-allowed; 
}

.inner-link.locked:hover { 
    color: #555; 
    padding-left: 50px; 
    background: none; 
}

.inner-link.locked::after { 
    content: " [LOCKED]"; 
    font-size: 0.65rem; 
    letter-spacing: 0; 
}

/* Sub-faction row (faction link + expand toggle) */
.sub-faction-row {
    display: flex;
    align-items: stretch;
}

.sub-faction-row .inner-link {
    flex: 1;
}

.sub-toggle {
    background: none;
    border: none;
    color: #444;
    font-size: 0.65rem;
    cursor: pointer;
    padding: 0 18px 0 8px;
    transition: color 0.3s, transform 0.3s ease;
    flex-shrink: 0;
}

.sub-toggle:hover {
    color: #aaa;
}

.sub-toggle.active {
    transform: rotate(90deg);
    color: #888;
}

/* Nested branches panel */
.sub-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0, 0, 0, 0.3);
}

.branch-row {
    display: flex;
    align-items: stretch;
}

.branch-row .branch-unit-link, .branch-row .menu-link {
    flex: 1;
}

.branch-toggle {
    background: none;
    border: none;
    color: #333;
    font-size: 0.55rem;
    cursor: pointer;
    padding: 0 16px 0 6px;
    transition: color 0.3s, transform 0.3s ease;
    flex-shrink: 0;
}

.branch-toggle:hover {
    color: #888;
}

.branch-toggle.active {
    transform: rotate(90deg);
    color: #666;
}

/* Unit list panel */
.unit-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0, 0, 0, 0.2);
}

.branch-unit-link:hover {
    color: #bbb;
    padding-left: 70px;
    background: rgba(255,255,255,0.02);
}

.unit-link:hover {
    color: #999;
    padding-left: 85px;
    background: rgba(255,255,255,0.02);
}

.direct-link:hover { 
    background: rgba(255,255,255,0.05); 
    color: #fff; 
    border-left-color: var(--accent-color, #ab47bc); 
}

/* Overlay Sfondo */
.sidebar-overlay {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh;
    background: rgba(0,0,0,0.7); 
    z-index: 1000; 
    opacity: 0; 
    visibility: hidden;
    transition: all 0.3s ease; 
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active { 
    opacity: 1; 
    visibility: visible; 
}

/* --- BREADCRUMBS --- */
.breadcrumbs {
    width: 100%; 
    max-width: 1000px; 
    margin: 20px auto 0 auto; 
    padding: 0 20px;
    font-size: 0.8rem; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    color: #666;
}

.breadcrumbs a { 
    color: #888; 
    text-decoration: none; 
    transition: color 0.3s; 
}

.breadcrumbs a:hover { 
    color: #fff; 
}

.breadcrumbs span { 
    color: var(--accent-color, #ab47bc); 
    font-weight: bold; 
}

/* ─── SEARCH BAR ─── */
.nav-search-wrap {
    padding: 52px 18px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
    background: rgba(10,10,15,0.98);
}

.nav-search-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    color: #bbb;
    padding: 9px 12px 9px 34px;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    outline: none;
    font-family: inherit;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23444' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
    transition: border-color 0.2s, background-color 0.2s;
}

.nav-search-input:focus {
    border-color: rgba(255,255,255,0.18);
    background-color: rgba(255,255,255,0.06);
}

.nav-search-input::placeholder {
    color: #333;
    text-transform: none;
    letter-spacing: 0;
}

/* Force-open all panels while searching */
.sidebar.nav-searching .accordion-content,
.sidebar.nav-searching .sub-accordion-content,
.sidebar.nav-searching .unit-accordion-content {
    max-height: none !important;
    overflow: visible !important;
}

/* Hide non-matching elements */
.search-hidden { display: none !important; }

/* ─── BRANCH ROLE BADGES ─── */
.branch-role {
    display: inline-block;
    font-size: 0.48rem;
    letter-spacing: 1.5px;
    padding: 2px 5px;
    margin-left: 7px;
    text-transform: uppercase;
    vertical-align: middle;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%);
    white-space: nowrap;
    font-weight: 700;
    pointer-events: none;
}

.role-melee   { background: rgba(239,83,80,0.1);  color: #ef5350; border: 1px solid rgba(239,83,80,0.22); }
.role-support { background: rgba(77,182,172,0.1); color: #4db6ac; border: 1px solid rgba(77,182,172,0.22); }
.role-mage    { background: rgba(171,71,188,0.1); color: #ab47bc; border: 1px solid rgba(171,71,188,0.22); }
.role-ranged  { background: rgba(255,183,77,0.1); color: #ffb74d; border: 1px solid rgba(255,183,77,0.22); }
