@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css");
@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css");

/* ----- 1. Global & Theme ----- */
:root {
    --color-primary-black: #121212;
    --color-secondary-black: #1a1a1a;
    --color-surface: #2a2a2a;
    --color-primary-red: #e60000;
    --color-text-primary: #f0f0f0;
    --color-text-secondary: #aaaaaa;
    --header-height-desktop: 80px; 
    --header-height-mobile: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Sansation", serif;
    font-weight: 300;
    font-style: normal;
    background-color: var(--color-primary-black);
    color: var(--color-text-primary);
    line-height: 1.6;
    position: relative;
}

body.modal-open > *:not(#signup-modal):not(#search-overlay) {
    filter: blur(5px);
    pointer-events: none;
}

a {
    color: var(--color-primary-red);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #ff4d4d;
}

img {
    max-width: 100%;
    display: block;
}

/* ----- NEW: Blur-Load for Images ----- */
img.blur-load {
    filter: blur(8px);
    opacity: 0.6;
    transition: filter 0.4s ease-out, opacity 0.4s ease-out;
}

img.blur-load.loaded {
    filter: blur(0);
    opacity: 1;
}
/* --- End New CSS --- */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ----- 2. Header (Desktop-First) ----- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
    height: var(--header-height-desktop);
    background-color: var(--color-secondary-black);
    border-bottom: 1px solid #333;
}

.logo-link {
    order: -1; 
    flex-shrink: 0;
}

.logo-img {
    height: 85px;
    width: auto;
    object-fit: contain;
}

.desktop-header-left {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-left: 35px;
}

.desktop-nav-links .nav-list {
    display: flex;
    gap: 25px;
    list-style: none;
}

.desktop-nav-links .nav-link,
#signup-open-btn-desktop {
    color: var(--color-text-primary);
    font-weight: 300;
    font-size: 1rem;
    padding: 10px 0;
    position: relative;
}

.desktop-nav-links .nav-link::after,
#signup-open-btn-desktop::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-primary-red);
    transition: width 0.3s ease;
}

.desktop-nav-links .nav-link:hover::after,
#signup-open-btn-desktop:hover::after {
    width: 100%;
}

.desktop-header-right {
     /* container for search */
}

.nav-search-btn {
    background: none;
    border: none;
    color: var(--color-text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.nav-search-btn:hover {
    color: var(--color-primary-red);
}

/* Resets button styles when it's used as a nav-link */
button.nav-link {
    background: none;
    border: none;
    cursor: pointer;
    font-family: "Sansation", serif; /* Ensures font matches */
}

.mobile-nav-btn {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-primary);
    font-size: 1.8rem;
    cursor: pointer;
}

/* ----- 3. Mobile Nav Drawer ----- */
.mobile-nav-drawer {
    position: fixed;
    top: var(--header-height-mobile);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height-mobile));
    background-color: var(--color-secondary-black);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    padding: 20px;
    overflow-y: auto;
    border-top: 1px solid #333;
}

.mobile-nav-drawer.open {
    transform: translateX(0);
}

.mobile-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.mobile-nav-list li {
    border-bottom: 1px solid #333;
}

.mobile-nav-list .nav-link {
    display: block;
    width: 100%; 
    padding: 18px 10px;
    color: var(--color-text-primary);
    font-size: 1.2rem;
    font-weight: 300;
    text-align: left; 
}

.mobile-nav-list .nav-link:hover {
    background-color: #333;
}

.mobile-nav-extras {
    padding: 20px 10px;
}

.mobile-nav-extras .nav-link {
     display: block;
    padding: 12px 0;
    color: var(--color-text-secondary);
    font-size: 1rem;
}

.mobile-nav-extras .nav-link:hover {
    color: var(--color-text-primary);
}

.mobile-social-header {
    color: var(--color-text-secondary);
    font-size: 1rem;
    font-weight: 300;
    margin-top: 20px;
    margin-bottom: 15px;
}

.mobile-social-links {
    display: flex;
    gap: 25px;
    list-style: none;
}

.mobile-social-links a {
    font-size: 1.8rem;
    color: var(--color-text-secondary);
}

.mobile-social-links a:hover {
    color: #fff;
}

/* ----- 4. Search Overlay (MODIFIED) ----- */
#search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: flex-start; /* Align to top */
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#search-overlay.visible {
    opacity: 1;
}

#search-close-btn {
    position: absolute;
    top: 30px;
    right: 40px;
    background: none;
    border: none;
    color: #aaa;
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
}

#search-close-btn:hover {
    color: var(--color-primary-red);
}

.search-container {
    width: 90%;
    max-width: 1000px; /* Wider for cards */
    height: 85vh; /* Take up most of the screen */
    display: flex;
    flex-direction: column;
    margin-top: 5vh; /* Give space from the top */
}

.search-header {
    display: flex;
    align-items: center;
    border-bottom: 2px solid var(--color-primary-red);
    flex-shrink: 0; /* Don't let this shrink */
}

#search-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 2rem;
    padding: 10px 0;
}

#search-input::placeholder {
    color: #777;
}

#search-results {
    margin-top: 20px;
    overflow-y: auto; /* Make it scrollable */
    flex-grow: 1; /* Fill remaining space */
    
    /* NEW: Grid layout for cards */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding-right: 10px; /* For the scrollbar */
}

/* NEW: Scrollbar styling */
#search-results::-webkit-scrollbar {
    width: 8px;
}
#search-results::-webkit-scrollbar-track {
    background: var(--color-secondary-black);
    border-radius: 4px;
}
#search-results::-webkit-scrollbar-thumb {
    background-color: var(--color-primary-red);
    border-radius: 4px;
}

/* NEW: Styles for the search card (based on .manga-card) */
.search-result-card {
    background-color: var(--color-surface);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
    text-decoration: none;
}
.search-result-card:hover {
    transform: translateY(-5px);
}
.search-card-image {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}
.search-card-content {
    padding: 10px;
}
.search-card-title {
    font-size: 1rem;
    font-weight: 300;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-card-chapter {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-top: 5px;
}

#search-results .no-results {
    color: var(--color-text-secondary);
    font-size: 1.2rem;
    text-align: center;
    margin-top: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    grid-column: 1 / -1; /* Span all columns */
}

.chibi-img {
    width: auto;
    height: 150px;
}


/* ----- 5. Signup / Login Modal ----- */
#signup-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
    background-color: var(--color-surface);
    margin: 10vh auto;
    padding: 25px;
    border: 1px solid #444;
    width: 90%;
    max-width: 450px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #fff;
}

#form-title {
    text-align: center;
    font-weight: 300;
    font-size: 1.8rem;
    margin-bottom: 20px;
}

#error-message {
    color: var(--color-primary-red);
    background-color: rgba(230, 0, 0, 0.1);
    border: 1px solid var(--color-primary-red);
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
    text-align: center;
    font-weight: 300;
    min-height: 1.5em;
}

#error-message:empty {
    display: none;
}

#signup-form input[type="text"],
#signup-form input[type="email"],
#signup-form input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: #1a1a1a;
    border: 1px solid #444;
    color: #fff;
    border-radius: 5px;
    font-weight: 300;
    font-size: 1rem;
}

#signup-form input[type="email"] {
    text-transform: lowercase;
}

#signup-form input[type="text"]:focus,
#signup-form input[type="email"]:focus,
#signup-form input[type="password"]:focus {
    outline: none;
    border-color: var(--color-primary-red);
}

.password-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    margin-top: -7.5px;
    color: #888;
    cursor: pointer;
}

#signup-form #submit-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--color-primary-red);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 300;
    transition: background-color 0.3s ease;
}

#signup-form #submit-btn:hover {
    background-color: #c00;
}

.form-disclaimer {
    font-weight: 300;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-top: 15px;
    text-align: center;
}

.form-disclaimer a {
    color: var(--color-primary-red);
    font-weight: 300;
}

#switch-form {
    text-align: center;
    margin-top: 20px;
    color: var(--color-text-secondary);
    cursor: pointer;
}

#switch-form span {
    color: var(--color-primary-red);
    font-weight: 300;
}

/* ----- 6. Top News Slider (MODIFIED) ----- */
.top-slider {
    max-width: 1200px; 
    height: 450px; 
    position: relative;
    overflow: hidden;
    background-color: #000;
    margin: 40px auto 0;
    border-radius: 12px; 
    mask-image: linear-gradient( to bottom, black 85%, transparent 100% );
    -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    visibility: hidden;
}

.slide.active {
    opacity: 1;
    visibility: visible;
}

.slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: brightness(0.6);
}

.slide-content {
    position: absolute;
    bottom: 40px;
    left: 40px;
    max-width: 60%;
    color: #fff;
    /* Clicks on text shouldn't trigger slide */
    pointer-events: none; 
}

.slide-title {
    font-size: 2.5rem;
    font-weight: 300;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
}

.slide-desc {
    font-size: 1.1rem;
    margin: 10px 0 20px;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.7);
}

.slide-btn {
    background-color: var(--color-primary-red);
    color: #fff;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 300;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    /* NEW: Allow clicks on the button */
    pointer-events: auto; 
}

.slide-btn:hover {
    background-color: #c00;
    color: #fff;
}

/* NEW: Invisible Click Zones */
.slider-click-zone {
    display: none; /* Hidden on mobile */
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%; /* Each takes half the space */
    z-index: 5; /* Sits above slides, below dots */
    cursor: pointer;
}
.slider-click-zone.prev {
    left: 0;
}
.slider-click-zone.next {
    right: 0;
}


/* ----- NEW: Slider Navigation Dots ----- */
.slider-nav-container {
    padding: 0 20px;
    max-width: 1200px;
    margin: 0 auto;
}
.slider-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px; 
    position: relative;
    z-index: 10;
}

.slider-dot {
    width: 25px;
    height: 4px;
    background-color: var(--color-surface);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.4s ease;
}
.slider-dot:hover {
    background-color: var(--color-text-secondary);
}
.slider-dot.active {
    background-color: var(--color-primary-red);
    width: 40px; 
}


/* ----- 7. Magazine News Banner (UNCHANGED) ----- */
.magazine-news {
    background-color: var(--color-secondary-black);
    padding: 30px;
    margin: 30px 0;
    text-align: center;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
}

.magazine-news h2 {
    font-weight: 300;
    font-size: 2rem;
    margin-bottom: 10px;
}

.magazine-news p {
    font-weight: 20;
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
}

.magazine-news .magazine-btn {
    background-color: transparent;
    color: var(--color-primary-red);
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 300;
    border: 2px solid var(--color-primary-red);
    border-radius: 5px;
    transition: all 0.3s ease;
}

.magazine-news .magazine-btn:hover {
    background-color: var(--color-primary-red);
    color: #fff;
}

/* ----- 8. Manga Grid (UNCHANGED) ----- */
.manga-grid {
    padding: 20px 0;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 300;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary-red);
    display: inline-block;
}

.manga-card {
    background-color: var(--color-surface);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.manga-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.5);
}

.new-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--color-primary-red);
    color: #fff;
    padding: 3px 8px;
    font-size: 0.8rem;
    font-weight: 300;
    border-radius: 5px;
    z-index: 2;
}

.card-image-link {
    display: block;
    position: relative;
}

.card-image {
    width: 100%;
    aspect-ratio: 2 / 3; 
    object-fit: cover;
}

.card-image-link::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 40%);
}

.card-content {
    padding: 15px;
}

.card-title {
    font-weight: 300;
    font-size: 1.1rem;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-info {
    font-weight: 300;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
}

/* ----- 9. Scroll Reveal Animation (UNCHANGED) ----- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    filter: blur(5px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out, filter 0.8s ease-out;
}

.reveal-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* ----- 10. Footer (UNCHANGED) ----- */
.main-footer {
    background-color: var(--color-secondary-black);
    border-top: 1px solid #333;
    padding: 40px 20px;
    margin-top: 40px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    text-align: left;
}

.footer-logo {
    width: 150px;
    margin-bottom: 20px;
}

.footer-column {
    display: flex;
    flex-direction: column;
}

.footer-column h4 {
    font-weight: 300;
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #fff;
}

.footer-column a,
.footer-column p {
    color: var(--color-text-secondary);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.footer-column a:hover {
    color: #fff;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    font-size: 1.5rem;
    color: var(--color-text-secondary);
}

.footer-bottom {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #444;
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--color-text-secondary);
}

/* ----- 11. Media Queries (Mobile Responsive) ----- */
@media (max-width: 768px) {
    .main-header {
        height: var(--header-height-mobile);
        display: grid;
        grid-template-columns: 50px 1fr 50px;
        padding: 0 15px;
        align-items: center;
    }
    
    .desktop-header-left,
    .desktop-header-right {
        display: none;
    }
    
    .mobile-nav-btn {
        display: block;
        font-size: 1.6rem;
    }
    
    #hamburger-btn {
        grid-column: 1;
        justify-self: start;
    }
    
    .logo-link {
        order: 0;
        grid-column: 2;
        justify-self: center;
    }
    
    .logo-img {
        height: 70px;
    }
    
    #search-btn-mobile {
        grid-column: 3;
        justify-self: end;
    }

    .search-container {
        height: 90vh; 
    }
    #search-results {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    .search-card-title {
        font-size: 0.9rem;
    }
    #search-input {
        font-size: 1.5rem;
    }
    #search-close-btn {
        top: 20px;
        right: 20px;
    }

    /* MODIFIED: Banner mobile styles */
    .top-slider {
        height: 350px;
        margin-left: 20px;
        margin-right: 20px;
    }
    .slide-content {
        left: 20px;
        bottom: 20px;
        max-width: 90%;
    }
    .slide-title {
        font-weight: 300;
        font-size: 1.8rem;
    }
    .slide-desc {
        font-weight: 300;
        font-size: 0.9rem;
        margin: 5px 0 15px;
    }
    .slide-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    .card-title {
        font-weight: 300;
        font-size: 1rem;
    }
    .card-info {
        font-weight: 300;
        font-size: 0.8rem;
    }
    
    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .footer-logo {
        margin: 0 auto 20px;
    }
    .social-links {
        justify-content: center;
    }
}

/* NEW: Media query for showing click zones on desktop */
@media (min-width: 769px) {
    .slider-click-zone {
        display: block;
    }
}

/* ===== 12. Background Scroller (UNCHANGED) ===== */
.background-scroller {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 800px; 
    z-index: -1;
    overflow: hidden;
    
    filter: blur(5px) opacity(0.3);
    
    mask-image: linear-gradient(
        to bottom, 
        black 50%,
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

.scroller-track {
    display: flex;
    width: calc(20 * 400px);
    animation: scrollHorizontal 120s linear infinite;
}

.scroller-track img {
    width: 400px;
    height: 800px;
    object-fit: cover;
    flex-shrink: 0;
}

@keyframes scrollHorizontal {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-10 * 400px));
    }
}