@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    /* ARMY GREEN THEME OVERRIDES */
    --primary-gradient: #4B5320;
    /* Army Green */
    --card-hover-shadow: 0 4px 12px rgba(107, 142, 35, 0.2);
    --glass-bg: rgba(20, 24, 18, 0.95);
    /* Heavy Dark Green Tint */
    --glass-border: 1px solid #333;
    --neon-accent: #9CAF88;
    /* Sage Green */
    --deep-bg: #000000;

    /* Override Global Colors to Army Green Palette */
    --color-blue-400: #9CAF88;
    --color-blue-500: #5F7146;
    --color-blue-600: #4B5320;
    --color-blue-700: #3A4518;
    --color-sky-500: #5F7146;
    --color-indigo-500: #4B5320;
    --color-violet-500: #4B5320;

    /* Theme Maps */
    --color-primary: #5F7146;
    --color-accent: #9CAF88;
    --color-action: #4B5320;
}

/* NUCLEAR OPTION FOR BLUE BACKGROUNDS -> NOW FORCE BLACK */
.bg-primary,
.bg-blue-500,
.bg-blue-600,
.bg-sky-500,
.bg-cyan-500,
.bg-blue,
.bg-dark {
    background-color: #000000 !important;
    background: #000000 !important;
}

div[class*="bg-blue-"],
div[class*="bg-sky-"],
section[class*="bg-blue-"] {
    background-color: var(--deep-bg) !important;
}


/* Link Overrides */
a {
    color: var(--neon-accent) !important;
    /* Sage Green */
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #ffffff !important;
    text-decoration: underline;
}

body,
html {
    font-family: 'Poppins', sans-serif !important;
    background-color: var(--deep-bg) !important;
    background-image: none !important;
    background: #000000 !important;
    /* ULTRA FORCE BLACK */
    color: #e2e8f0;
    min-height: 100vh;
}

/* Modern Header */
.header-manga {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(10px);
    border-bottom: var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0 !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

/* Logo Styling */
.logo-resp span {
    color: #ffffff !important;
    background: none !important;
    -webkit-text-fill-color: #ffffff !important;
    font-weight: 700 !important;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    font-size: 1.5rem !important;
}

.logo-resp span::after {
    content: "";
    /* REMOVED DOT AS REQUESTED */
    color: var(--primary-gradient);
    /* Army Green Dot */
    text-shadow: 0 0 10px rgba(75, 83, 32, 0.5);
}

/* Nav Links */
.nav-link {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    position: relative;
    opacity: 0.8;
}

.nav-link:hover {
    color: var(--neon-accent) !important;
    opacity: 1;
    transform: translateY(-2px);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: var(--neon-accent);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 100%;
}

/* Search Bar */
.search-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 50px !important;
    color: white !important;
    padding-left: 20px !important;
    transition: all 0.3s ease;
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--neon-accent) !important;
    box-shadow: 0 0 15px rgba(107, 142, 35, 0.2) !important;
}

.btn-primary {
    border-radius: 50px !important;
    background: var(--primary-gradient) !important;
    border: 1px solid #444 !important;
    /* Visible border */
    color: white !important;
    padding: 0.375rem 1.5rem !important;
    font-weight: 600;
    transition: transform 0.2s;
}

.btn-primary:hover {
    background: #000 !important;
    border-color: #fff !important;
}

.btn-primary:active {
    transform: scale(0.95);
}

/* Manga Cards (General) */
.swiper-slide,
.card,
.utao .uta {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    border-radius: 12px !important;
    overflow: hidden;
    position: relative;
}

.swiper-slide:hover,
.utao .uta:hover {
    transform: translateY(-5px);
    z-index: 10;
    box-shadow: var(--card-hover-shadow);
}

/* Images */
img {
    border-radius: 12px;
}

/* Section Titles */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
}

.movie-home h1,
.movie-home h2 {
    position: relative;
    display: inline-block;
    color: #fff;
    font-weight: 700;
    margin-bottom: 20px;
}

/* Hero Section Polish */
.hero-slider {
    margin-top: 20px;
    margin-bottom: 40px;
}

/* -------------------------------------------------------------
   MOBILE HERO SLIDER FIX (Fixes Distorted Aspect Ratio)
   ------------------------------------------------------------- */
@media (max-width: 640px) {

    /* Override the hardcoded Tailwind height */
    .hero-slider,
    .hero-slider .swiper,
    .hero-slider .swiper-slide,
    .h-\[430px\] {
        height: 280px !important;
        min-height: 280px !important;
        max-height: 280px !important;
    }

    /* Force images to adapt to the new container height */
    .hero-slider img,
    .hero-slider .swiper-slide img {
        height: 100% !important;
        width: 100% !important;
        object-fit: cover !important;
        object-position: top center !important;
    }
}

/* -------------------------------------------------------------
   MOBILE GENRE PAGE FIX (Hide Redundant Vertical Cards)
   ------------------------------------------------------------- */
@media (max-width: 640px) {
    /* Hide the second occurrence of the same manga (Vertical Card) */
    /* Assumes the Horizontal Line Item comes first */

    /* Target elements that share the same container but are intended for different modes */
    /* The vertical card typically has 'flex-col' and 'h-full' while horizontal has 'flex-row' */

    /* Using attribute selector for the Tailwind 'group-data' class that is failing */
    /* We match the class string that contains "hidden" for horizontal mode */
    [class*="group-data-[mode=horizontal]:hidden"] {
        display: none !important;
    }
}

/* -------------------------------------------------------------
   DETAIL PAGE INFO BAR FIX (CSS Grid)
   ------------------------------------------------------------- */
/* Target the flex container that holds Released, Type, Author, etc. */
/* We need to override the existing flex behavior which causes overlaps */

.detail .flex.flex-col.lg\:gap-5,
.imptdt {
    display: grid !important;
    /* Create a responsive grid: minimum 140px per item, fit as many as possible */
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: 15px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    /* Allow grid to layout naturally */
    flex-wrap: wrap !important;
}

@media (max-width: 640px) {

    /* Prevent Body Overflow */
    body,
    html {
        overflow-x: hidden;
    }

    /* Force 2 columns on mobile for "Tidy" look */
    .detail .flex.flex-col.lg\:gap-5,
    .imptdt {
        grid-template-columns: repeat(2, 1fr) !important;
        overflow-x: visible !important;
        display: grid !important;
        flex-direction: unset !important;
        white-space: normal !important;
        /* Allow text wrapping */
        padding-bottom: 0 !important;
    }

    /* Ensure items wrap text properly */
    .detail .flex.flex-col.lg\:gap-5>div,
    .imptdt>div {
        white-space: normal !important;
        word-break: break-word;
        min-width: 0;
        /* Allow grid items to shrink below content size if needed */
    }

    /* Fix top section overflow if any */
    .container.detail>section {
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* Fix Alternate Titles - Line Clamp */
.detail .shd h3,
/* Often where alt titles live */
.detail .alternativetitles {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* Standard property */
    /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 5px;
}

/* -------------------------------------------------------------
   READER PAGE FIXES
   ------------------------------------------------------------- */
/* Ensure images fit the screen and are centered */
.reader-area img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Sticky Footer Polish */
.reader-nav-bar {
    z-index: 1000 !important;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(5px);
    border-top: 1px solid #333;
    padding: 10px 0;
}

/* -------------------------------------------------------------
   HISTORY & BOOKMARKS PAGE FIXES
   ------------------------------------------------------------- */
/* Ensure the History list is a clean grid */
#history-list,
#bookmarks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    padding: 10px 0;
}

/* History Card Styling */
.history-card {
    background: #222;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 2/3;
}

.history-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-card .title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 10px;
    font-size: 0.9rem;
    color: white;
    text-shadow: 0 1px 2px black;
}

@media (max-width: 640px) {

    #history-list,
    #bookmarks-list {
        grid-template-columns: repeat(2, 1fr);
        /* 2 Column on Mobile */
    }
}

/* -------------------------------------------------------------
   GENERAL GRID POLISH (Search Results, Latest Updates)
   ------------------------------------------------------------- */
/* Ensure generic manga lists are tidy on mobile */
@media (max-width: 640px) {

    .listupd,
    .c-tabs-item__content {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        /* Force 2 columns */
        gap: 10px !important;
    }

    /* Ensure items inside don't force width */
    .listupd .bs,
    .c-tabs-item__content .bs {
        width: 100% !important;
        margin: 0 !important;
    }

    /* Hide spacers or clear divs if they break grid */
    .listupd .clearn,
    .c-tabs-item__content .clearn {
        display: none !important;
    }
}

/* -------------------------------------------------------------
   NOVEL / TEXT READER POLISH
   ------------------------------------------------------------- */
/* Target common text containers for novels */
.epcontent,
.entry-content,
.text-left {
    font-size: 18px !important;
    line-height: 1.8 !important;
    color: #e0e0e0 !important;
    padding: 15px !important;
}

.epcontent p,
.entry-content p {
    margin-bottom: 20px !important;
}

/* Ensure Novel Images fit */
.epcontent img,
.entry-content img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    margin: 10px auto;
    display: block;
}

/* -------------------------------------------------------------
   PAGINATION POLISH
   ------------------------------------------------------------- */
.hpage a,
.pagination a {
    padding: 10px 15px !important;
    background: #333 !important;
    color: white !important;
    border-radius: 5px !important;
    margin: 2px !important;
    display: inline-block !important;
}

.hpage a:hover,
.pagination a:hover,
.hpage .current,
.pagination .current {
    background: var(--primary) !important;
    color: white !important;
}

/* -------------------------------------------------------------
   ACCESSIBILITY IMPROVEMENTS
   ------------------------------------------------------------- */
/* High visibility focus ring for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--neon-accent) !important;
    outline-offset: 2px;
}

/* Ensure links in prose have high contrast underline */
.epcontent a,
.entry-content a {
    text-decoration: underline;
    text-decoration-color: var(--neon-accent);
    text-underline-offset: 3px;
}