/* ANIME//NEXUS - Protocol v24.0 (TACTICAL_RESILIENT) */
:root {
    --bg: #08080a;
    --surface: #121217;
    --accent: #00ff9f;
    --secondary: #ff0055;
    --text: #ffffff;
    --text-dim: #888891;
    --font-main: 'Syne', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: var(--font-mono); overflow-x: hidden; }

/* Responsive Navigation */
.nexus-nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 5%; background: var(--surface);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: sticky; top: 0; z-index: 1000;
    gap: 1rem;
}

.back-btn {
    background: var(--accent); color: var(--bg); 
    border: none; padding: 0.6rem 1rem; 
    font-family: var(--font-mono); font-weight: 700; 
    cursor: pointer; border-radius: 4px; font-size: 0.8rem;
    transition: all 0.2s;
}
.back-btn:hover {
    background: #00cc7f; transform: translateX(-3px);
}

.logo { font-family: var(--font-main); font-weight: 800; color: var(--accent); letter-spacing: -1px; }

.search-bar {
    display: flex; background: var(--bg); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px; width: 100%; max-width: 400px;
}
.search-bar input { flex: 1; background: transparent; border: none; color: #fff; padding: 0.6rem 1rem; font-family: var(--font-mono); outline: none; font-size: 0.8rem; }
.search-bar button { background: var(--accent); color: var(--bg); border: none; padding: 0 1.2rem; font-weight: 700; cursor: pointer; }

/* Home Grid */
.anime-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem; padding: 2rem 5%;
}
.anime-card { cursor: pointer; transition: transform 0.2s ease; }
.anime-card:hover { transform: translateY(-5px); }
.card-media { aspect-ratio: 2/3; background: var(--surface); border-radius: 4px; overflow: hidden; position: relative; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-info h3 { font-size: 0.75rem; margin-top: 0.8rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* PLAYER OVERLAY */
.player-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg); z-index: 2000; display: none; overflow-y: auto;
}
.player-overlay.active { display: block; }
.player-content { max-width: 1600px; margin: 0 auto; padding: 1.5rem; }
.player-main { display: grid; grid-template-columns: 1fr 350px; gap: 1.5rem; }

@media (max-width: 1100px) {
    .player-main { grid-template-columns: 1fr; }
    .control-panel { height: auto !important; position: relative !important; }
}

.video-container { aspect-ratio: 16/9; background: #000; border: 1px solid rgba(255,255,255,0.05); }
.video-container iframe { width: 100%; height: 100%; border: none; }

/* Tactical Control Panel */
.control-panel {
    background: var(--surface); padding: 1.5rem; border-radius: 4px;
    display: flex; flex-direction: column; gap: 1.2rem; height: calc(100vh - 100px);
    position: sticky; top: 1rem; border: 1px solid rgba(255,255,255,0.03);
}
.panel-section h4 { font-size: 0.6rem; color: var(--accent); margin-bottom: 0.8rem; letter-spacing: 2px; }

/* Custom Selectors */
.cyber-select {
    width: 100%; background: var(--bg); border: 1px solid rgba(255,255,255,0.1);
    color: #fff; padding: 0.8rem; font-family: var(--font-mono); font-size: 0.75rem;
    outline: none; cursor: pointer; border-left: 3px solid var(--accent);
}

/* Episode Terminal - Scrollable with many episodes */
.ep-terminal { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 200px; }
.ep-grid {
    flex: 1; display: grid; grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem; overflow-y: auto; padding-right: 8px; align-content: flex-start;
    max-height: 400px;
}
.ep-grid::-webkit-scrollbar { width: 4px; }
.ep-grid::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }

.ep-btn {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05);
    color: var(--text-dim); padding: 0.5rem 0; font-size: 0.65rem; cursor: pointer; text-align: center;
    min-width: 0;
}
.ep-btn:hover, .ep-btn.active { background: var(--accent); color: var(--bg); font-weight: 700; }

/* Station Buttons */
.station-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.station-btn, .server-btn {
    background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-dim); font-size: 0.7rem; padding: 0.7rem; cursor: pointer;
    font-family: var(--font-mono); transition: all 0.2s;
}
.station-btn:hover, .server-btn:hover { border-color: var(--accent); color: var(--accent); }
.station-btn.active, .server-btn.active { 
    border-color: var(--accent); color: var(--bg); 
    background: var(--accent); font-weight: 700;
}

.close-btn {
    position: absolute; top: 1.5rem; right: 2rem; background: var(--secondary);
    color: #fff; border: none; padding: 0.5rem 1rem; font-size: 0.7rem; cursor: pointer; z-index: 2100;
}

.details-title { font-family: var(--font-main); font-size: 2rem; font-weight: 800; color: #fff; margin: 1rem 0 0.5rem; }
.details-desc { font-size: 0.9rem; color: var(--text-dim); line-height: 1.6; max-height: 200px; overflow-y: auto; }

.loading { color: var(--accent); text-align: center; padding: 2rem; font-size: 0.8rem; }

/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 0.5rem 0;
    z-index: 1500;
}
.nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: var(--font-mono);
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.2s;
}
.nav-tab:hover, .nav-tab.active {
    color: var(--accent);
}
.nav-tab.active .nav-icon {
    text-shadow: 0 0 10px var(--accent);
}
.nav-icon { font-size: 1.2rem; }
.nav-label { font-size: 0.55rem; letter-spacing: 1px; }

/* Favorites Button on Cards */
.fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: #666;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}
.fav-btn:hover { background: rgba(0,0,0,0.9); color: var(--secondary); border-color: var(--secondary); }
.fav-btn.favorited { color: var(--secondary); border-color: var(--secondary); }

/* Section title styling */
.section-title {
    font-family: var(--font-main);
    font-size: 1.2rem;
    color: var(--accent);
    padding: 1rem 5%;
    letter-spacing: 2px;
}

/* Empty state message */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-dim);
}
.empty-state h3 { color: var(--accent); margin-bottom: 0.5rem; }

/* Add padding at bottom for nav bar */
main { padding-bottom: 80px; }

/* Progress badge for Continue Watching */
.progress-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: var(--accent);
    color: var(--bg);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 2px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nexus-nav {
        flex-wrap: wrap;
        padding: 0.8rem 3%;
        gap: 0.5rem;
    }
    
    .back-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.7rem;
    }
    
    .logo {
        font-size: 0.9rem;
    }
    
    .search-bar {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin-top: 0.5rem;
    }
    
    .search-bar input {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
    }
    
    .search-bar button {
        padding: 0 1rem;
        font-size: 0.75rem;
    }
    
    .anime-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.8rem;
        padding: 1rem 3%;
    }
    
    .player-overlay {
        padding: 1rem;
    }
    
    .player-content {
        max-width: 100%;
        padding: 1rem;
    }
    
    .details-title {
        font-size: 1.5rem;
    }
    
    .details-desc {
        font-size: 0.8rem;
    }
    
    .close-btn {
        top: 1rem;
        right: 1rem;
        padding: 0.4rem 0.8rem;
        font-size: 0.65rem;
    }
}
