/* 
 * Modern Komik Digital Design System
 * Uses CSS Variables for Dark/Light Mode 
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;800&display=swap');

:root {
    /* Pusaka Malind Theme Palette */
    --bg-primary: #fdf5e6;
    /* Old Lace / Cream background */
    --bg-secondary: #fffbf0;
    --bg-dark-wood: #2C1A14;
    /* Dark brown for navbar/footer */
    --card-bg: #5c2b29;
    /* Maroon for comic cards */
    --text-primary: #3E2723;
    /* Dark brown for main text */
    --text-light: #fdf5e6;
    /* Light text for dark areas */
    --text-secondary: #5D4037;
    --accent-color: #d97706;
    /* Warm orange/gold */
    --accent-hover: #b45309;
    --border-color: #d7ccc8;
    --border-dark: #3E2723;
    --card-shadow: 0 8px 16px rgba(44, 26, 20, 0.15);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    --gradient-text: linear-gradient(to right, #5c2b29, #d97706);
    /* Maroon to Orange for light backgrounds */
    --gradient-hero: linear-gradient(to right, #FFD700, #FF4500);
    /* Vibrant Gold to Orange Red for dark backgrounds */
    --hero-bg: transparent;
    /* Handled by image later */
}

[data-theme="dark"] {
    /* Disabling dark mode, keep the same variables to prevent UI breaks */
    --bg-primary: #fdf5e6;
    --bg-secondary: #fffbf0;
    --bg-dark-wood: #2C1A14;
    --card-bg: #5c2b29;
    --text-primary: #3E2723;
    --text-light: #fdf5e6;
    --text-secondary: #5D4037;
    --accent-color: #d97706;
    --accent-hover: #b45309;
    --border-color: #d7ccc8;
    --border-dark: #3E2723;
    --card-shadow: 0 8px 16px rgba(44, 26, 20, 0.15);
    --gradient-primary: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    --gradient-text: linear-gradient(to right, #5c2b29, #d97706);
    /* Maroon to Orange */
    --gradient-hero: linear-gradient(to right, #FFD700, #FF4500);
    /* Vibrant Gold to Orange Red */
    --hero-bg: transparent;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Hero Banner Style */
.hero-banner-section {
    width: 100%;
    aspect-ratio: 1080 / 508;
    max-height: 508px;
    margin: 1.5rem auto 3rem;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--card-shadow);
    border: 4px solid var(--border-dark);
}

.hero-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(44, 26, 20, 0.9), rgba(44, 26, 20, 0.3));
    z-index: 1;
}

.hero-banner-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
    max-width: 800px;
}

.hero-banner-content h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    text-shadow: 2px 4px 8px rgb(0 0 0 / 56%);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.hero-banner-content p {
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--accent-color);
    font-weight: 600;
    text-shadow: 2px 4px 8px rgb(0 0 0 / 56%);
    margin-bottom: 2rem;
}

.hero-banner-content .btn-gradient {
    font-size: 1.1rem;
    padding: 1rem 2.5rem;
    border-radius: 50px;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}

/* Solid Ethnic Navbar with Pattern */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-dark-wood);
    border-bottom: 5px solid var(--accent-color);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
    position: relative;
}

/* Ethnic decorative bottom border for navbar */
.navbar::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 5px;
    background: repeating-linear-gradient(-45deg,
            var(--card-bg),
            var(--card-bg) 10px,
            transparent 10px,
            transparent 20px);
    z-index: 1001;
}

.navbar-brand {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-light);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand span {
    color: var(--accent-color);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent-color);
}

.search-nav {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 0.2rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.search-nav input {
    background: transparent;
    border: none;
    color: var(--text-light);
    padding: 0.5rem;
    outline: none;
}

.search-nav input::placeholder {
    color: rgba(253, 245, 230, 0.5);
}

.search-nav button {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background-color: var(--accent-color);
    color: #fff !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 2px solid transparent;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

/* Gradient Buttons & Text */
.btn-gradient {
    background: var(--gradient-primary);
    color: #fff !important;
    border: none;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.25);
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-weight: bold;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.btn-gradient:hover {
    box-shadow: 0 6px 20px rgba(180, 83, 9, 0.4);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.text-gradient {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    filter: drop-shadow(2px 4px 8px rgba(92, 43, 41, 0.2));
}

.hero-text-gradient {
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    filter: drop-shadow(2px 4px 8px rgb(0 0 0 / 56%));
}

/* Hero Section Banner */
.hero-section {
    position: relative;
    background: url('https://images.unsplash.com/photo-1542273917363-3b1817f69a2d?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80') center/cover no-repeat;
    border-radius: 24px;
    padding: 6rem 2rem;
    margin-bottom: 3rem;
    border: 4px solid var(--border-dark);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 26, 20, 0.6);
    z-index: 0;
}

[data-theme="dark"] .hero-section {
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    background-color: #111827;
    /* Fallback */
}

/* Ambient Glow behind Hero (Optional decoration inside hero) */
.hero-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 5%;
}

/* Grid System */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.grid-cols-4 {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Comic Card - Ethnic Style */
.comic-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 4px solid var(--border-dark);
    display: flex;
    flex-direction: column;
    position: relative;
}

.comic-card::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    pointer-events: none;
}

.comic-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-color);
}

[data-theme="dark"] .comic-card {
    /* Kept for compatibility but theme is static */
}

[data-theme="dark"] .comic-card:hover {
    /* Kept for compatibility */
}

.comic-cover {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-bottom: 2px solid var(--border-dark);
}

.comic-info {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    color: var(--text-light);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.comic-title {
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #ffffff;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comic-meta-row {
    margin-bottom: 1rem;
    font-size: 0.85rem;
    flex-grow: 1;
}

.comic-author {
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.comic-author strong {
    color: #fca5a5; /* Light soft red/pink, contrasts well with maroon */
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comic-rating {
    display: none; /* Just in case it's still somewhere */
}

.btn-card {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    text-align: center;
    padding: 0.6rem;
    border-radius: 8px;
    display: block;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: auto;
}

.btn-card:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #ffffff;
    transform: translateY(-2px);
}

/* Reader Mode Specific */
.reader-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem 0;
}

.comic-page {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: -1px;
    /* Remove gaps */
}

/* Modern Ethnic Footer Style */
.modern-ethnic-footer {
    background-color: #3b1817;
    /* Darker Maroon */
    color: var(--text-light);
    margin-top: 4rem;
    position: relative;
    border-top: 5px solid var(--accent-color);
}

.modern-ethnic-footer::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 0;
    width: 100%;
    height: 5px;
    background: repeating-linear-gradient(45deg,
            var(--card-bg),
            var(--card-bg) 10px,
            transparent 10px,
            transparent 20px);
    z-index: 1001;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    padding: 4rem 5% 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-brand p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-top: 1rem;
}

.footer-links h4,
.footer-social h4 {
    color: #fff;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-links a {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.75rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent-hover);
}

.social-icons {
    display: flex;
    gap: 1rem;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--accent-color);
    transition: all 0.3s ease;
}

.social-icons a:hover {
    background: var(--accent-color);
    color: #fff;
    transform: translateY(-3px);
}

.footer-bottom {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem 5%;
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 1rem;
}

.mt-2 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 1rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

/* Mobile Menu Styles */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1002;
}

.mobile-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.mobile-menu-header .navbar-brand {
    color: var(--text-primary);
}

.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-outline {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}

.btn-outline:hover {
    background: var(--bg-secondary);
}

/* Reader Styles */
.reader-top-bar {
    background: var(--bg-secondary);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.reader-top-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.reader-chapter-badge {
    color: var(--text-secondary);
    white-space: nowrap;
}

.reader-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.reader-nav-bottom {
    display: flex;
    justify-content: space-between;
    padding: 2rem 1rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    gap: 1rem;
}

/* Comic Detail Styles */
.comic-detail-container {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
    align-items: flex-start;
}

.comic-detail-image {
    flex: 0 0 300px;
}

.comic-detail-cover {
    width: 100%;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.comic-detail-info {
    flex: 1;
    min-width: 300px;
}

.comic-detail-info h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.comic-author {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tags-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.comic-tag {
    background: var(--accent-color);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.comic-desc {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.stats-container {
    display: flex;
    gap: 1rem;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: var(--border-color);
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
    .grid {
        gap: 1rem;
    }
    
    .grid-cols-4, .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .comic-info {
        padding: 0.75rem;
    }
    
    .comic-title {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }
    
    .comic-author {
        font-size: 0.75rem;
    }
    
    .comic-author strong {
        font-size: 0.75rem;
    }
    
    .comic-meta-row {
        margin-bottom: 0.75rem;
    }
    
    .btn-card {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    .comic-detail-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .comic-detail-image {
        flex: 0 0 auto;
        max-width: 250px;
        margin: 0 auto;
    }

    .tags-container {
        justify-content: center;
    }

    .stats-container {
        justify-content: center;
    }

    .comic-author {
        justify-content: center;
    }

    .hero-banner-section {
        aspect-ratio: auto;
        min-height: 450px;
        margin-top: 1rem;
        border-radius: 8px;
    }

    .reader-top-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .reader-top-title {
        justify-content: space-between;
        margin-bottom: 0.5rem;
    }

    .reader-controls {
        justify-content: space-between;
    }

    .reader-nav-bottom {
        flex-direction: column;
    }

    .reader-nav-bottom .btn {
        width: 100%;
        text-align: center;
    }

    .mobile-menu-btn {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        background-color: var(--bg-secondary);
        flex-direction: column;
        align-items: flex-start;
        padding: 2rem;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1005;
        /* Increase z-index above navbar::after */
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
    }

    [data-theme="dark"] .nav-links {
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    }

    .nav-links.active {
        right: 0;
    }

    .mobile-menu-header,
    .mobile-close-btn {
        display: flex;
    }

    .nav-links a {
        width: 100%;
        padding: 1rem 0;
        font-size: 1.1rem;
        color: var(--text-primary);
        /* Fix text color for light bg */
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links a:hover {
        padding-left: 0.5rem;
        color: var(--accent-color);
    }

    .search-nav {
        width: 100%;
        margin-top: 1rem;
        background: rgba(0, 0, 0, 0.05);
        /* Darker bg for contrast */
        border-color: var(--border-color);
    }

    .search-nav input {
        color: var(--text-primary);
        width: 100%;
    }

    .search-nav input::placeholder {
        color: var(--text-secondary);
    }

    .search-nav button {
        color: var(--text-primary);
    }

    .nav-actions {
        flex-direction: column;
        width: 100%;
        margin-top: 2rem;
        gap: 1rem;
    }

    .nav-actions a {
        width: 100%;
        text-align: center;
        background: var(--card-bg) !important;
        /* Force maroon bg for icons on mobile */
        color: #fff !important;
        border-radius: 8px !important;
        padding: 1rem !important;
    }

    .nav-actions a svg {
        stroke: #fff !important;
    }
}