
/* =========================================
   1. VARIABLES & RESET (MUST BE FIRST)
   ========================================= */
:root {
    --bg-main: #0a0a0a;
    --bg-glass: rgba(20, 20, 20, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary: #FF0057;
    --text-white: #ffffff;
    --text-gray: #b3b3b3;
    --nav-height: 70px;
    --card-width-mobile: 140px; /* Base size */
    --card-width-desktop: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-main);
    background-image: radial-gradient(circle at 10% 10%, rgba(255, 0, 87, 0.05) 0%, transparent 40%);
    color: var(--text-white);
    font-family: 'Outfit', sans-serif;
    overflow-x: hidden;
    padding-bottom: 90px;
    -webkit-tap-highlight-color: transparent;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
html { scroll-behavior: smooth; }

/* =========================================
   2. HYBRID SIDEBAR (Mobile Drawer + Desktop Capsule)
   ========================================= */
#glass-sidebar {
    position: fixed;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: rgba(15, 15, 20, 0.85);
    backdrop-filter: blur(35px) saturate(180%);
    -webkit-backdrop-filter: blur(35px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Mobile Layout */
#glass-sidebar {
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    border-radius: 0 25px 25px 0;
    box-shadow: 5px 0 30px rgba(0,0,0,0.5);
    padding-top: 20px;
    justify-content: flex-start;
}

.sidebar-open #glass-sidebar { left: 0; }

/* Desktop Layout */
@media (min-width: 992px) {
    #glass-sidebar {
        left: 20px !important;
        top: 50%;
        transform: translateY(-50%);
        width: 70px;
        height: 80vh;
        border-radius: 35px;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
        background: rgba(15, 15, 20, 0.65);
        justify-content: center;
        padding-top: 0;
    }
}

#sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 1999;
    opacity: 0; pointer-events: none;
    transition: 0.3s;
}
.sidebar-open #sidebar-backdrop { opacity: 1; pointer-events: auto; }

.sidebar-inner {
    display: flex; flex-direction: column; align-items: center; gap: 15px; width: 100%; padding: 30px 0;
}

.sidebar-item {
    width: 45px; height: 45px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #888; font-size: 1.2rem;
    transition: 0.3s; text-decoration: none; margin-bottom: 5px;
}
.sidebar-item:hover, .sidebar-item.active {
    background: var(--primary); color: white;
    box-shadow: 0 5px 15px rgba(255, 0, 87, 0.4);
}
.sidebar-divider {
    width: 30px; height: 1px;
    background: rgba(255,255,255,0.1); margin: 5px 0;
}

/* =========================================
   3. AUTO-FIT LAYOUT ADJUSTMENT
   ========================================= */
@media (min-width: 992px) { 
    #main-header { left: calc(50% + 35px); width: calc(92% - 80px); }
    body { padding-left: 90px; }
    footer { padding-left: 90px; }
}

/* =========================================
   4. IOS LIQUID HEADER
   ========================================= */
#main-header {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 1200px;
    height: 72px;
    z-index: 1000;
    border-radius: 40px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    background: rgba(15, 15, 20, 0.3);
    backdrop-filter: blur(35px) saturate(200%);
    -webkit-backdrop-filter: blur(35px) saturate(200%);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1), inset 0 -1px 1px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-area { padding-left: 15px; z-index: 2; }
.logo-area .app-icon { height: 42px; border-radius: 0; box-shadow: none; background: transparent; }

/* =========================================
   5. SEARCH BAR
   ========================================= */
.ios-search-bar {
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 18px;
    padding: 0 10px;
    height: 42px; width: 42px;
    display: flex; align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    cursor: pointer; overflow: hidden;
}

@media (min-width: 768px) {
    .ios-search-bar { width: 220px; background: rgba(0,0,0,0.4); }
}

.ios-search-bar:focus-within, .ios-search-bar.active { 
    width: 260px; background: rgba(0,0,0,0.8); 
    border-color: var(--primary); 
    box-shadow: 0 0 15px rgba(255, 0, 87, 0.2);
}

.ios-search-bar i { font-size: 16px; color: rgba(255,255,255,0.6); min-width: 20px; text-align: center; }
.ios-search-bar input {
    background: transparent; border: none; outline: none;
    color: white; font-size: 14px; 
    display: block; width: 0; opacity: 0; margin-left: 0;
    transition: all 0.3s ease;
}

@media (min-width: 768px) { .ios-search-bar input { width: 100%; opacity: 1; margin-left: 10px; } }
.ios-search-bar:focus-within input, .ios-search-bar.active input { width: 100%; opacity: 1; margin-left: 10px; }

/* =========================================
   6. DOCK (Mobile)
   ========================================= */
.bottom-nav {
    position: fixed; bottom: 25px; left: 0; width: 100%; z-index: 9999;
    pointer-events: none; display: flex; justify-content: center;
}
.dock-container {
    pointer-events: auto; display: flex; justify-content: space-between; align-items: center;
    width: 90%; max-width: 360px; height: 70px; padding: 0 25px;
    background: rgba(15, 15, 20, 0.6); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
    border-radius: 40px; border: 1px solid rgba(255, 255, 255, 0.1); border-top: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.dock-item {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 50px; height: 100%; color: rgba(255, 255, 255, 0.5); text-decoration: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.dock-item .icon-box { font-size: 1.4rem; transition: 0.3s; filter: drop-shadow(0 0 0 transparent); }
.dock-label {
    position: absolute; bottom: 8px; font-size: 0.65rem; font-weight: 600;
    opacity: 0; transform: translateY(10px); transition: 0.3s;
}
.dock-item.active { color: white; }
.dock-item.active .icon-box { transform: translateY(-8px); color: var(--primary); filter: drop-shadow(0 0 12px var(--primary)); }
.dock-item.active .dock-label { opacity: 1; transform: translateY(0); }

/* =========================================
 /* =========================================
   7. CARDS & GRID (MODIFIED FOR SOLUTION 2)
   ========================================= */

/* --- STANDARD VERTICAL CARDS (For New Releases/Grid) --- */
.anime-card {
    position: relative; 
    flex: 0 0 auto; 
    width: 50vw; 
    max-width: 160px; 
    min-width: 120px;
    padding: 8px; 
    border-radius: 10px; 
    transition: all 0.6s; 
    cursor: pointer;
}

@media (min-width: 768px) { 
    .anime-card { width: var(--card-width-desktop); max-width: none; } 
}

.anime-card:hover {
    background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(10px);
    transform: translateY(-5px);
}

.card-img-wrapper {
    position: relative; 
    width: 100%; 
    aspect-ratio: 2/3; /* Vertical Poster Shape */
    border-radius: 10px; 
    overflow: hidden; 
    background: #151515;
    min-height: 180px; 
}

.card-img-wrapper img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: 0.6s; 
}
.anime-card:hover .card-img-wrapper img { transform: scale(1.05); }


/* --- NEW: TRENDING WIDE CARDS (SOLUTION 2) --- */
//* =========================================
   TRENDING WIDE CARDS (Revised Fix)
   ========================================= */

.trending-card {
    position: relative;
    flex: 0 0 auto;
    width: 65vw !important; /* Force width */
    max-width: 200px;
    min-width: 220px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

/* The container shape */
.trending-card .card-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9 !important; /* Forces rectangular shape */
    border-radius: 12px;
    overflow: hidden;
    background: #151515;
}

/* The image alignment */
.trending-card .card-img-wrapper img {
    width: 150%;
    height: 140%;
    
    /* This makes sure the image fills the box without stretching */
    object-fit: cover !important; 
    
    /* 0% = Top, 50% = Center, 100% = Bottom
       "0% 20%" means: Horizontal Center, Vertical 20% down.
       This is the "Sweet Spot" for anime character faces.
    */
    object-position: 50% 20% !important; 
    
    transition: 0.4s;
}

/* --- SHARED ELEMENTS --- */
.ep-badge {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
    color: white; font-size: 10px; font-weight: 700;
    padding: 3px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.15);
    z-index: 5;
}

.card-title {
    font-size: 0.95rem; color: #ddd; margin-top: 10px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; font-weight: 500; padding: 0 4px;
}

/* =========================================
   10. SLIDER & VISUAL FIXES (Added)
   ========================================= */

/* 1. Force Slider Height (Stops jumping) */
.carousel-item {
    height: 65vh !important;       /* Occupy 65% of screen height */
    min-height: 450px;             /* Never get smaller than this */
    position: relative;
    background-color: #000;
}

/* 2. Fix Image Sizing (Stops squishing) */
.hero-bg {
    width: 100%;
    height: 100%;
    object-fit: cover !important;  /* CRITICAL: Cuts edges instead of stretching */
    opacity: 0.6;                  /* Darken slightly for text readability */
    mask-image: none !important;   /* Remove old mask that might look bad */
}

/* 3. Text Overlay Gradient */
.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Gradient from bottom (dark) to top (transparent) */
    background: linear-gradient(to top, #0a0a0a 15%, rgba(0,0,0,0.5) 50%, transparent 100%) !important;
    display: flex;
    align-items: flex-end;         /* Push text to bottom */
    padding-bottom: 60px;          /* Space from bottom */
    padding-left: 5%;              /* Space from left */
    pointer-events: none;          /* Let clicks pass through to buttons */
}

/* 4. Content & Title Styling */
.hero-content {
    max-width: 800px;
    z-index: 10;
    pointer-events: auto;          /* Re-enable clicks for buttons */
    text-align: left;              /* Ensure text aligns left */
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    color: white;
    text-shadow: 2px 2px 15px rgba(0,0,0,0.9); /* Strong shadow for readability */
    margin-bottom: 15px;
    line-height: 1.1;
}

/* 5. Mobile Adjustments */
@media (max-width: 768px) {
    .carousel-item { height: 55vh !important; min-height: 350px; }
    .hero-title { font-size: 1.8rem; }
    .hero-overlay { padding-bottom: 90px; padding-left: 20px; } /* Move text up for mobile nav */
}

/* =========================================
   9. DETAILS, COMMENTS & MISC
   ========================================= */
.details-hero { position: relative; min-height: 100vh; padding-top: 100px; padding-bottom: 50px; }
.details-bg { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background-size: cover; background-position: center; opacity: 0.15; z-index: -1; filter: blur(20px); }
.details-overlay-gradient { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: linear-gradient(to top, var(--bg-main) 20%, transparent 100%); z-index: -1; }
.poster-card { border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1); }
.anime-title-large { font-size: 2.5rem; font-weight: 800; margin-bottom: 15px; line-height: 1.1; }
.meta-badge { background: rgba(255,255,255,0.1); padding: 5px 12px; border-radius: 6px; font-size: 0.8rem; border: 1px solid rgba(255,255,255,0.1); }
.glass-panel { background: rgba(255, 255, 255, 0.03); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 20px; }
.btn-watch { background: var(--primary); color: white; padding: 12px 35px; border-radius: 50px; font-weight: 600; box-shadow: 0 5px 20px rgba(255, 0, 87, 0.4); display: flex; align-items: center; border: none; transition: 0.3s; }
.btn-watch:hover { transform: scale(1.05); box-shadow: 0 10px 30px rgba(255, 0, 87, 0.6); }

.watch-container { padding-top: 110px !important; min-height: 100vh; }
.player-wrapper { position: relative; width: 100%; padding-top: 56.25%; background: #000; border-radius: 24px; overflow: hidden; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8); border: 1px solid rgba(255, 255, 255, 0.1); margin-bottom: 25px; }
.player-iframe, .video-js { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; border: none; }
.controls-glass { background: rgba(20, 20, 20, 0.6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 20px; padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.server-btn { background: rgba(255, 255, 255, 0.05); color: #aaa; border: 1px solid rgba(255, 255, 255, 0.05); padding: 8px 16px; border-radius: 12px; font-size: 0.85rem; font-weight: 500; transition: 0.3s; }
.server-btn:hover, .server-btn.active { background: var(--primary); color: white; box-shadow: 0 5px 15px rgba(255, 0, 87, 0.4); border-color: transparent; }

.comments-glass {
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin-top: 25px;
}

#ep-grid, #ep-list { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)) !important; gap: 10px !important; padding: 10px; max-height: 500px; overflow-y: auto; }
#ep-grid a, #ep-grid .ep-btn, #ep-list a, #ep-list .ep-btn, #ep-list .ep-item { display: flex !important; align-items: center; justify-content: center; width: 100%; height: 45px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; color: #ddd; text-decoration: none; font-weight: 600; font-size: 0.9rem; transition: 0.2s; cursor: pointer; }
#ep-grid a:hover, #ep-list a:hover { background: rgba(255, 255, 255, 0.15); color: white; transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.3); }
#ep-list a.active, #ep-list .ep-btn.active { background: var(--primary) !important; color: white !important; border-color: transparent; box-shadow: 0 0 10px rgba(255, 0, 87, 0.4); }
#ep-grid::-webkit-scrollbar, #ep-list::-webkit-scrollbar { width: 6px; }
#ep-grid::-webkit-scrollbar-thumb, #ep-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }

/* =========================================
   11. NETFLIX RAIL & SCROLL FIXES
   ========================================= */

/* 1. The Rail Container (Netflix Style) */
.rail-wrapper { 
    display: flex !important;       /* Force Flexbox */
    flex-wrap: nowrap !important;   /* NEVER wrap to next line */
    overflow-x: auto !important;    /* Allow horizontal scrolling */
    gap: 15px;                      /* Space between cards */
    padding: 10px 4% 20px 4%;       /* Padding for shadows */
    
    /* HIDE SCROLLBARS (The "White Line" Fix) */
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* IE/Edge */
}

/* Hide scrollbar for Chrome/Safari/Opera */
.rail-wrapper::-webkit-scrollbar { 
    display: none !important; 
    width: 0 !important;
    height: 0 !important;
    background: transparent !important; /* Ensure no white background */
}

/* 2. The Cards (Stop Squishing) */
.anime-card {
    flex: 0 0 auto !important;      /* Don't grow, don't shrink */
    width: 140px;                   /* Fixed width for mobile */
    margin: 0 !important;           /* Remove messy margins */
}

@media (min-width: 768px) {
    .anime-card { width: 200px; }   /* Wider on PC */
}

/* 3. Global Background Fix (Kills any white lines) */
html, body {
    background-color: #0a0a0a !important; /* Force dark background everywhere */
    overscroll-behavior-y: none;          /* Stop rubber-banding on Mac/iOS */
}

/* 4. Remove potential white borders from sections */
section, .content-rail {
    border: none !important;
    outline: none !important;
    background: transparent !important;
}

/* PC Scroll Fixes */
.rail-wrapper {
    cursor: grab; /* Shows 'hand' icon */
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE */
    user-select: none; /* Stop text highlighting while dragging */
}

/* Hide scrollbar for Chrome/Edge */
.rail-wrapper::-webkit-scrollbar {
    display: none;
}

.rail-wrapper.active {
    cursor: grabbing; /* Closes hand when clicking */
    transform: scale(1); /* Prevents jitter */
}

/* =========================================
   WINDOWS COMPATIBILITY & SCROLLBAR FIXES
   ========================================= */

/* 1. Prevent Layout Shifting when scrollbars appear */
html {
    scrollbar-gutter: stable; 
    background-color: var(--bg-main);
}

/* 2. Custom Modern Scrollbar (Replaces thick grey Windows bars) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
    border: 2px solid #0a0a0a;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* 3. Rail Wrapper Windows Optimization */
.rail-wrapper {
    /* Prevents horizontal overflow lines sometimes seen in Chrome Windows */
    -webkit-overflow-scrolling: touch;
    padding-bottom: 25px !important; 
    margin-bottom: -10px;
    overflow-y: hidden;
}

/* 4. Fix for Desktop Search Bar on Windows */
@media (min-width: 992px) {
    .ios-search-bar:hover {
        background: rgba(255, 255, 255, 0.05);
    }
}
