/* =========================================
   SECTION 1: GLOBAL RESET & THEME
   ========================================= */
html {
    scroll-behavior: smooth;
}

body {
    background-color: #050505; /* Deep black */
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: #ff4d4d;
    color: white;
}

/* =========================================
   SECTION 2: PRELOADER
   ========================================= */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #050505;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.pulse-text {
    color: #ff4d4d;
    font-size: 2.5rem;
    letter-spacing: 10px;
    font-weight: 800;
    text-align: center;
    animation: pulseGlow 1.5s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.3; text-shadow: 0 0 5px #ff4d4d; }
    50% { opacity: 1; text-shadow: 0 0 30px #ff4d4d; }
}

.progress-bar-container {
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin: 20px auto 0;
    overflow: hidden;
}

.progress-bar {
    width: 0;
    height: 100%;
    background: #ff4d4d;
    animation: loadBar 2s forwards;
}

@keyframes loadBar {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* =========================================
   SECTION 3: NAVIGATION CONTROLS
   ========================================= */
.top-nav-controls {
    position: fixed;
    top: 30px;
    width: 100%;
    padding: 0 30px;
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    z-index: 1000;
}

.nav-group-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-btn-home, .nav-btn-right {
    cursor: pointer;
    color: white;
    background: rgba(255, 255, 255, 0.05);
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 77, 77, 0.2);
    text-decoration: none;
    transition: 0.3s;
}

.nav-btn-home:hover, .nav-btn-right:hover {
    background: rgba(255, 77, 77, 0.15);
    border-color: #ff4d4d;
    color: #ff4d4d;
    box-shadow: 0 0 15px rgba(255, 77, 77, 0.3);
}

/* =========================================
   SECTION 4: SEARCH BAR & DROPDOWN
   ========================================= */
.search-wrapper {
    position: relative;
}

.search-bar {
    display: flex;
    align-items: center;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 77, 77, 0.3);
    border-radius: 8px;
    height: 55px;
    width: 55px; 
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.search-wrapper.active .search-bar {
    width: 250px;
    border-color: #ff4d4d;
}

#searchInput {
    width: 100%;
    background: none;
    border: none;
    outline: none;
    color: white;
    padding: 0 15px;
    opacity: 0;
    transition: opacity 0.3s;
}

.search-wrapper.active #searchInput {
    opacity: 1;
}

.search-icon-btn {
    background: none;
    border: none;
    color: white;
    min-width: 55px;
    height: 100%;
    cursor: pointer;
}

.search-dropdown {
    position: absolute;
    top: 65px;
    left: 0;
    width: 250px;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(255, 77, 77, 0.3);
    border-radius: 8px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
}

.search-dropdown.show { display: flex; }

.search-result-item {
    padding: 12px 20px;
    color: #bbb;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result-item:hover {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
}

/* =========================================
   SECTION 5: SIDEBAR MENU
   ========================================= */
.side-nav {
    height: 100%;
    width: 0; /* Managed by JS */
    position: fixed;
    z-index: 2000;
    top: 0;
    right: 0;
    background: linear-gradient(to left, rgba(10, 0, 0, 0.95), rgba(0, 0, 0, 0.98));
    overflow-x: hidden;
    transition: 0.5s cubic-bezier(0.7, 0, 0.3, 1);
    padding-top: 60px;
    border-left: 3px solid #8B0000;
}

.side-nav .closebtn {
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 36px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

.side-nav a {
    padding: 10px 32px;
    text-decoration: none;
    font-size: 1.2rem;
    color: #818181;
    display: block;
    transition: 0.3s;
}

.side-nav a:hover { color: #ff4d4d; }

.genre-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 20px;
}

.genre-btn {
    font-family: 'Creepster', cursive;
    font-size: 1.4rem;
    color: #cc0000 !important;
    text-decoration: none;
    padding: 10px;
    transition: 0.4s;
    text-align: center;
    border: 1px solid transparent;
}

.genre-btn:hover {
    color: #ff0000 !important;
    transform: scale(1.1);
    text-shadow: 0 0 10px #ff4d4d;
}

/* =========================================
   SECTION 6: HERO & TYPEWRITER
   ========================================= */
.hero-section {
    height: 100vh;
    background: linear-gradient(rgba(0,0,0,0.85), rgba(0,0,0,0.85)), url('assets/banner.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
}

.typewriter-text {
    font-family: 'Nosifer', cursive; /* Spooky font choice */
    background: linear-gradient(90deg, #ff4d4d, #ff8c00, #ff4d4d);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 8px;
    animation: gradientFlow 3s linear infinite;
    min-height: 1.2em; /* Prevents layout jump while typing */
}

@keyframes gradientFlow {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* =========================================
   SECTION 7: RESPONSIVE DESIGN
   ========================================= */
@media (max-width: 768px) {
    .top-nav-controls { top: 15px; padding: 0 15px; }
    .pulse-text { font-size: 1.8rem; }
    .display-1 { font-size: 3rem; }
    .search-wrapper.active .search-bar { width: 180px; }
}