/* MexUni - Grid CSS */
/* Griglia, sidebar, celle, navigazione */

/* GRID 40 QUADRATI (8 colonne x 5 righe) */
.grid-layout-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 40px;
    z-index: 10;
    width: 100%;
    max-width: 1300px;
    height: 85vh;
    margin: 0 auto;
    margin-top: 80px; /* Spazio per i pulsanti in alto */
}

/* Toggle buttons container */
.toggle-buttons-container {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    gap: 10px;
}

/* ═══════════════════════════════════════════════════════════════════
   TOP BAR - Barra orizzontale in alto (presa da ChatUni)
   ═══════════════════════════════════════════════════════════════════ */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    backdrop-filter: blur(10px);
    
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-bar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Top Bar Buttons */
.top-bar-btn {
    padding: 8px 20px;
    font-weight: bold;
    letter-spacing: 0.5px;
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-radius: 6px;
    background: rgba(0, 242, 255, 0.05);
    color: #00f2ff;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 0 0 5px rgba(0, 242, 255, 0.5);
    white-space: nowrap;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
}

.top-bar-btn:hover {
    background: rgba(0, 242, 255, 0.15);
    border-color: #00f2ff;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
    transform: scale(1.05);
}

/* Timer */
.cyber-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid rgba(255, 0, 60, 0.5);
    border-radius: 6px;
    background: rgba(255, 0, 60, 0.1);
    font-size: 0.7rem;
    color: #ff003c;
    font-family: 'Orbitron', sans-serif;
    text-shadow: 0 0 5px rgba(255, 0, 60, 0.5);
}

.cyber-timer span:last-child {
    font-size: 0.9rem;
    font-weight: bold;
    color: #fff;
}

/* Home button */
.cyber-home-btn {
    writing-mode: horizontal-tb;
    padding: 8px 16px;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 1px;
    border: 1px solid rgba(0, 242, 255, 0.4);
    border-radius: 6px;
    background: rgba(0, 242, 255, 0.1);
    color: #00f2ff;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 0 0 5px rgba(0, 242, 255, 0.5);
    font-family: 'Orbitron', sans-serif;
    white-space: nowrap;
}

.cyber-home-btn:hover {
    background: rgba(0, 242, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.5);
}

/* SIDEBAR CONTROLS */
.sidebar-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 280px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 15px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 242, 255, 0.1);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

#sidebar-matrix-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.30;
    pointer-events: none;
}

.sidebar-controls > *:not(#sidebar-matrix-canvas) {
    position: relative;
    z-index: 1;
}

/* Search */
.search-bar-sidebar {
    width: 100%;
    padding: 0 5px;
}

.search-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

#sector-search-input {
    background: rgba(0, 242, 255, 0.05);
    border: 1px solid rgba(0, 242, 255, 0.2);
    border-radius: 4px;
    color: #00f2ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    padding: 8px;
    flex: 1;
    min-width: 0;
    outline: none;
    transition: 0.3s;
}

#sector-search-btn {
    flex: 0 0 auto;
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid #00f2ff;
    color: #00f2ff;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    transition: 0.3s;
}

#sector-search-btn:hover {
    background: rgba(0, 242, 255, 0.3);
    box-shadow: 0 0 10px #00f2ff;
}

.search-line {
    height: 1px;
    background: linear-gradient(to right, #00f2ff, transparent);
    width: 100%;
}

/* Sector name con frecce */
.grid-header-sidebar {
    width: 100%;
    text-align: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
}

.sector-nav-arrows {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.sector-nav-btn {
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid rgba(0, 242, 255, 0.3);
    color: #00f2ff;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-family: 'Orbitron', sans-serif;
}

.sector-nav-btn:hover {
    background: rgba(0, 242, 255, 0.25);
    border-color: #00f2ff;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
    color: #fff;
}

#sector-name {
    font-size: 1rem;
    color: #00f2ff;
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.6);
    letter-spacing: 2px;
    margin: 0;
    white-space: nowrap;
}

/* Grid container */
.grid-container {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 15px;
    flex-grow: 1;
    height: 100%;
    opacity: 0;
}

.grid-item {
    background: rgba(0, 255, 65, 0.05);
    border: 1px solid rgba(0, 255, 65, 0.2);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.square-number {
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 0.6rem;
    color: rgba(0, 255, 65, 0.5);
    pointer-events: none;
}

.grid-item:hover {
    background: #000000 !important;
    border-color: #00ff41 !important;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.4);
    transform: scale(1.05);
}

.grid-item:hover .square-number {
    color: #00ff41 !important;
    font-size: 0.85rem;
    font-weight: bold;
    text-shadow: 0 0 10px #00ff41;
}

/* Occupied state */
.grid-item.occupied {
    background: rgba(255, 0, 255, 0.1);
    border: 2px solid #ff00ff;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.4);
    position: relative;
}

.grid-item.locked {
    background: rgba(255, 0, 0, 0.1);
    border-color: #ff0000;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
}

.occupied-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.locked-label {
    font-size: 0.75rem;
    font-weight: bold;
    color: #00ff41;
    letter-spacing: 2px;
    text-shadow: 0 0 8px rgba(0, 255, 65, 0.6);
}

.locked-date {
    display: none;
}

/* Exit button in alto a destra */
.exit-wrapper-top {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cyber-exit-btn {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 242, 255, 0.4);
    color: #00f2ff;
    padding: 10px 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 3px;
    cursor: pointer;
    transition: 0.3s;
    text-shadow: 0 0 10px #00f2ff;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.1);
    text-align: center;
    border-radius: 8px;
    z-index: 100;
}

.cyber-exit-btn:hover {
    background: rgba(0, 242, 255, 0.2);
    border-color: #00f2ff;
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.4);
    color: #fff;
}

/* Timer - Exit wrapper top (old position) */
.exit-wrapper-top .cyber-timer {
    display: none;
    flex-direction: column;
    align-items: center;
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    backdrop-filter: none;
    border: none;
    color: #00f2ff;
    padding: 5px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: bold;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 0 10px #00f2ff;
    box-shadow: none;
    min-width: 180px;
    z-index: 110;
    pointer-events: none;
}

/* Navigation arrows */
.nav-arrow {
    position: fixed;
    bottom: 20px;
    font-size: 3rem;
    color: #00f2ff;
    cursor: pointer;
    z-index: 1000;
    text-shadow: 0 0 15px #00f2ff;
    transition: 0.3s;
    padding: 20px;
    user-select: none;
}

.nav-arrow:hover {
    color: #ff00ff;
    text-shadow: 0 0 15px #ff00ff;
    transform: scale(1.2);
}

.nav-arrow.left { left: 20px; }
.nav-arrow.right { right: 20px; }


/* 🔹 NUOVA SIDEBAR CONTROLS DA CHATUNI 🔹 */

/* Frecce navigazione settore */
.sector-nav-arrows {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.sector-nav-btn {
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid rgba(0, 242, 255, 0.3);
    color: #00f2ff;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-family: 'Orbitron', sans-serif;
}

.sector-nav-btn:hover {
    background: rgba(0, 242, 255, 0.25);
    border-color: #00f2ff;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
    color: #fff;
}


/* Griglia pulsanti sidebar 2x2 */
.sidebar-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
    padding: 10px 0;
}

.sidebar-btn {
    padding: 8px 6px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-radius: 6px;
    background: rgba(0, 242, 255, 0.05);
    color: #00f2ff;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 0 0 5px rgba(0, 242, 255, 0.5);
    white-space: nowrap;
    text-align: center;
}

.sidebar-btn:hover {
    background: rgba(0, 242, 255, 0.15);
    border-color: #00f2ff;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
    transform: scale(1.05);
}

/* Stile speciale pulsante TCG BANK */
.tcg-bank-btn {
    background: rgba(255, 215, 0, 0.1);
    border-color: #ffd700;
    color: #ffd700;
}

.tcg-bank-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

/* Hamburger Button - Hidden by default, shown only on mobile */
.hamburger-btn {
    display: none;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    height: 35px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 242, 255, 0.4);
    border-radius: 6px;
    cursor: pointer;
    padding: 5px 12px;
    z-index: 1100;
    position: relative;
}

.hamburger-icon-wrap {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 22px;
    height: 16px;
}

.hamburger-btn span.hamburger-label {
    color: #00f2ff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(0, 242, 255, 0.5);
    display: block;
    width: auto;
    height: auto;
    border-radius: 0;
    background: none;
    transform: none !important;
    opacity: 1 !important;
}

.hamburger-btn .hamburger-icon-wrap span {
    display: block;
    width: 100%;
    height: 3px;
    background: #00f2ff;
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger-btn.active .hamburger-icon-wrap span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-btn.active .hamburger-icon-wrap span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-icon-wrap span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1040;
}



/* Mobile Menu - Staircase dropdown for mobile */
.mobile-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(0, 242, 255, 0.3);
    padding: 15px 10px;
    z-index: 1050;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.mobile-menu.active {
    display: flex;
    transform: translateY(0);
}

.mobile-menu-btn {
    width: 100%;
    padding: 15px 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 1px;
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 242, 255, 0.05);
    color: #00f2ff;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 0 0 5px rgba(0, 242, 255, 0.5);
    text-align: left;
    white-space: nowrap;
    /* Staircase effect - each button slightly indented */
    margin-left: calc(var(--menu-index, 0) * 10px);
}

.mobile-menu-btn:hover {
    background: rgba(0, 242, 255, 0.15);
    border-color: #00f2ff;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
}
