/* CSS Design System for KomikID Clone */

/* Fonts */
:root {
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Dark Theme Variables (Default) */
    --bg-primary: #0a0c10;
    --bg-secondary: #11141e;
    --bg-tertiary: #191c28;
    --bg-card: rgba(25, 28, 40, 0.6);
    --accent: #bf5af2;
    --accent-gradient: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    --accent-hover: #b046e8;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border-color: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    --glass-bg: rgba(17, 20, 30, 0.75);
    --glass-border: rgba(255, 255, 255, 0.05);
    --rating-star: #fbbf24;
    
    /* Manga Tag Colors */
    --tag-manga: #8b5cf6;
    --tag-manhua: #10b981;
    --tag-manhwa: #ef4444;
}

/* Light Theme Variables */
body.light-theme {
    --bg-primary: #f3f5fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef1f8;
    --bg-card: rgba(255, 255, 255, 0.85);
    --accent: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
    --accent-hover: #7c3aed;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: rgba(0, 0, 0, 0.08);
    --card-shadow: 0 12px 40px rgba(31, 41, 55, 0.06);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.04);
    --rating-star: #f59e0b;
}

/* Reset and Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-family: var(--font-primary);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Background Glowing Blobs */
.blob-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(160px);
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

body.light-theme .blob-glow {
    opacity: 0.07;
}

.blob-1 {
    top: -100px;
    right: -100px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
}

.blob-2 {
    bottom: 20%;
    left: -200px;
    background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
}

/* Page Container (wraps scrollable page content to clear fixed navbar) */
.page-container {
    padding-top: 92px;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 92px);
}

@media (max-width: 768px) {
    .page-container {
        padding-top: 76px;
    }
}

/* Layout Container */
.main-content {
    flex: 1;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 0 40px 0; /* Remove top padding since page-container handles it */
}

/* Sticky Glassmorphic Navbar */
.navbar-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    z-index: 100;
    background-color: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.navbar-container {
    max-width: 1280px;
    height: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo */
.logo-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.5px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: #3b82f6; /* Blue icon */
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-highlight {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Nav Menu Buttons */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item {
    background: none;
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
}

.nav-item.active {
    color: #3b82f6; /* Matching active menu style in the screenshot */
    background-color: rgba(59, 130, 246, 0.08);
}

body.light-theme .nav-item.active {
    color: #2563eb;
    background-color: rgba(37, 99, 235, 0.08);
}

.nav-icon {
    width: 16px;
    height: 16px;
}

/* Actions in navbar */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Rounded Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 220px;
    transition: width 0.3s ease;
}

.search-box:focus-within {
    width: 280px;
}

.search-icon {
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    height: 38px;
    padding: 0 36px 0 38px;
    border-radius: 19px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    border-color: #3b82f6;
    background-color: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-clear-btn {
    position: absolute;
    right: 14px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
}

.search-clear-btn:hover {
    color: var(--text-primary);
}

/* Search Dropdown Suggestions */
.search-box {
    /* Make search box a stacking context for the dropdown */
    overflow: visible !important;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 320px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 1000;
    animation: dropdownFadeIn 0.18s ease;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.search-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-color);
}

.search-dropdown-item:last-child {
    border-bottom: none;
}

.search-dropdown-item:hover {
    background-color: var(--bg-tertiary);
}

.search-dropdown-thumb {
    width: 40px;
    height: 52px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background-color: var(--bg-tertiary);
}

.search-dropdown-info {
    flex: 1;
    min-width: 0;
}

.search-dropdown-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-dropdown-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.search-dropdown-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.search-dropdown-badge.manga    { background: var(--tag-manga);   color: #fff; }
.search-dropdown-badge.manhwa   { background: var(--tag-manhwa);  color: #fff; }
.search-dropdown-badge.manhua   { background: var(--tag-manhua);  color: #fff; }

.search-dropdown-more {
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    text-align: center;
    cursor: pointer;
    transition: background 0.15s ease;
}

.search-dropdown-more:hover {
    background-color: var(--bg-tertiary);
}

.search-dropdown-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Circle Action Buttons */
.action-circle-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.action-circle-btn:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
    transform: translateY(-2px);
}

.action-circle-btn svg {
    width: 18px;
    height: 18px;
}

/* Active State for Filter Button */
.action-circle-btn.active {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

/* Purple Login Button */
.login-btn {
    height: 38px;
    padding: 0 24px;
    border-radius: 19px;
    border: none;
    outline: none;
    background: linear-gradient(135deg, #c026d3 0%, #8b5cf6 100%);
    color: #ffffff;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.45);
    filter: brightness(1.05);
}

/* Expandable Filter Panel */
.filter-panel-wrapper {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    background-color: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 99;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.filter-panel-wrapper.open {
    max-height: 250px;
    opacity: 1;
}

.filter-panel-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-options {
    display: flex;
    gap: 8px;
}

.filter-opt {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 16px;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-opt:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
}

.filter-opt.active {
    background: var(--accent-gradient);
    color: #ffffff;
    border-color: transparent;
}

.filter-actions {
    margin-left: auto;
}

/* Secondary Button style */
.btn-secondary {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 18px;
    border-radius: 18px;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
}

/* SECTION CONTAINER GENERAL */
.section-container {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-indicator {
    width: 6px;
    height: 24px;
    background: linear-gradient(to bottom, #a855f7, #ec4899);
    border-radius: 3px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.highlight-title {
    color: var(--accent);
}

.section-icon {
    font-size: 18px;
}

/* View all link styling */
.view-all-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.view-all-link:hover {
    color: var(--accent);
}

.view-all-link svg {
    width: 14px;
    height: 14px;
}

/* MANGA POPULER GRID */
.manga-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .manga-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .manga-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .navbar-container {
        padding: 0 16px;
    }
    .main-content {
        padding-left: 0;
        padding-right: 0;
    }
}

@media (max-width: 480px) {
    .manga-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* MANGA CARD STYLING */
.manga-card {
    position: relative;
    aspect-ratio: 2/3;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    background-color: var(--bg-secondary);
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.manga-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.4), 0 0 15px rgba(139, 92, 246, 0.2);
}

body.light-theme .manga-card:hover {
    box-shadow: 0 20px 35px rgba(31, 41, 55, 0.12), 0 0 15px rgba(139, 92, 246, 0.1);
}

.manga-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.manga-card:hover .manga-card-image {
    transform: scale(1.05);
}

/* Overlays inside Card */
.manga-card-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2;
    pointer-events: none;
}

.type-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.type-tag.manga {
    background-color: var(--tag-manga);
}

.type-tag.manhua {
    background-color: var(--tag-manhua);
}

.type-tag.manhwa {
    background-color: var(--tag-manhwa);
}

.rank-badge {
    background-color: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

/* Bottom Text and Shadows */
.manga-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 12px 12px 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 50%, transparent 100%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.manga-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manga-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #e5e7eb;
}

.manga-card-ch {
    color: #9ca3af;
}

.manga-card-rating {
    display: flex;
    align-items: center;
    gap: 3px;
    font-weight: 700;
    color: var(--rating-star);
}

/* "Lihat Semua Manga" Load More Button */
.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.load-more-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 24px;
    border-radius: 20px;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.load-more-btn:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
}

.arrow-icon {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.load-more-btn:hover .arrow-icon {
    transform: translateX(4px);
}

/* UPDATE MANGA TERBARU GRID */
.updates-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 900px) {
    .updates-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 580px) {
    .updates-grid {
        grid-template-columns: 1fr;
    }
}

/* Horizontal card design for updates */
.update-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.update-card:hover {
    transform: scale(1.02);
    border-color: rgba(139, 92, 246, 0.2);
    background-color: var(--bg-tertiary);
}

.update-thumb {
    width: 72px;
    height: 96px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.update-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.update-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
}

.update-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.update-chapter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-bottom: 6px;
}

.update-ch {
    color: var(--text-secondary);
    font-weight: 500;
}

.update-time {
    color: var(--text-muted);
    font-size: 11px;
}

.update-status-tag {
    align-self: flex-start;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* MODAL / BACKDROP LAYER */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* modal container */
.modal-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-height: none;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.open .modal-card {
    transform: scale(1);
}

/* Close button */
.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    transition: transform 0.2s ease, color 0.2s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.modal-close-btn:hover {
    color: var(--accent);
    transform: scale(1.1);
}

/* MANGA DETAILS MODAL LAYOUT */
.manga-detail-card {
    max-width: 860px;
    overflow: hidden;
}

.detail-header-banner {
    height: 180px;
    width: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
}

.detail-header-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(to top, var(--bg-secondary) 0%, rgba(17, 20, 30, 0.4) 60%, transparent 100%);
}

.detail-content-wrapper {
    display: flex;
    padding: 0 32px 32px 32px;
    margin-top: -80px;
    gap: 32px;
    position: relative;
    z-index: 2;
}

@media (max-width: 680px) {
    .detail-content-wrapper {
        flex-direction: column;
        align-items: center;
        padding: 0 20px 20px 20px;
        margin-top: -60px;
        gap: 20px;
    }
}

.detail-left {
    width: 180px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-cover-img {
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--border-color);
}

/* Bookmark button */
.bookmark-toggle-btn {
    width: 100%;
    height: 42px;
    border-radius: 21px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bookmark-toggle-btn svg {
    width: 15px;
    height: 15px;
}

.bookmark-toggle-btn:hover {
    background-color: var(--border-color);
}

.bookmark-toggle-btn.saved {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.bookmark-toggle-btn.saved svg {
    fill: currentColor;
}

/* Detail right columns */
.detail-right {
    flex-grow: 1;
    min-width: 0;
}

.detail-type-badge-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.manga-type-badge {
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    padding: 3px 10px;
    border-radius: 4px;
    background-color: var(--accent);
}

.detail-rating-badge,
.detail-rank-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.detail-rating-badge span:first-child {
    color: var(--rating-star);
}

.detail-rank-badge span:first-child {
    color: var(--text-muted);
}

.detail-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.2;
}

.detail-author {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.detail-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.genre-tag {
    font-size: 11px;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 12px;
}

.detail-synopsis-section {
    margin-bottom: 24px;
}

.detail-synopsis-section h3,
.detail-chapters-section h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.detail-synopsis {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Chapters Section */
.detail-chapters-section {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.chapters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chapters-count {
    font-size: 12px;
    color: var(--text-muted);
}

.chapters-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}

.chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chapter-item:hover {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.05);
}

.chapter-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.chapter-date {
    font-size: 11px;
    color: var(--text-muted);
}

/* Chapter read state */
.chapter-item.read {
    opacity: 0.6;
    background-color: var(--bg-primary);
}

/* LOGIN MODAL STYLING */
.login-card {
    max-width: 400px;
    padding: 32px;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-header h2 {
    font-size: 20px;
    font-weight: 800;
    margin-top: 16px;
    margin-bottom: 6px;
}

.login-header p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input {
    height: 42px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    border-color: #3b82f6;
}

.form-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    cursor: pointer;
}

.forgot-pass {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.btn-primary {
    height: 42px;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.3);
    filter: brightness(1.05);
}

.w-full {
    width: 100%;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.login-footer a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

/* LIBRARY EMPTY STATE */
.library-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    background-color: var(--bg-card);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.library-empty h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.library-empty p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.library-empty .btn-primary {
    padding: 0 24px;
    border-radius: 20px;
    height: 38px;
    font-size: 13px;
}

/* PLACEHOLDER / COMING SOON STATE */
.other-view-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 80px 20px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
}

.other-view-card h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 10px;
}

.other-view-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.coming-soon-illustration {
    font-size: 64px;
    margin-bottom: 32px;
}

.other-view-card .btn-primary {
    padding: 0 24px;
    border-radius: 20px;
    height: 38px;
    font-size: 13px;
}

/* FOOTER SECTION */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 48px 24px 24px 24px;
    margin-top: auto;
    transition: background-color 0.4s ease;
}

.footer-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .footer-container {
        flex-direction: column;
        gap: 30px;
    }
}

.footer-info {
    max-width: 380px;
}

.footer-desc {
    margin-top: 16px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    gap: 60px;
}

@media (max-width: 580px) {
    .footer-links {
        flex-direction: column;
        gap: 24px;
    }
}

.links-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.links-column h4 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.links-column a {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.footer-bottom {
    max-width: 1280px;
    margin: 0 auto;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* TOAST NOTIFICATION STYLING */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1010;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: var(--bg-tertiary);
    border-left: 4px solid var(--accent);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
    animation: slideIn 0.3s ease forwards;
    transition: opacity 0.3s ease;
    border: 1px solid var(--border-color);
}

.toast.success {
    border-left-color: #10b981;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Hide tab views helper */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background-color: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

/* API Loading States */
.grid-loader-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 0;
    width: 100%;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.skeleton-card {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-color) 37%, var(--bg-tertiary) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: 12px;
    aspect-ratio: 2/3;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Carousel Styles */
.carousel-wrapper {
    position: relative;
    width: 100%;
}

.manga-grid-carousel {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 20px;
    padding: 10px 4px 20px 4px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE */
}

.manga-grid-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* In carousel mode, the manga cards should have a fixed width */
.manga-grid-carousel:not(.grid-view) .manga-card {
    flex: 0 0 calc((100% - 100px) / 6); /* 6 columns */
    min-width: 170px;
}

@media (max-width: 1024px) {
    .manga-grid-carousel:not(.grid-view) .manga-card {
        flex: 0 0 calc((100% - 60px) / 4); /* 4 columns */
    }
}

@media (max-width: 768px) {
    .manga-grid-carousel:not(.grid-view) .manga-card {
        flex: 0 0 calc((100% - 40px) / 3); /* 3 columns */
        min-width: 130px;
    }
}

@media (max-width: 480px) {
    .manga-grid-carousel:not(.grid-view) .manga-card {
        flex: 0 0 calc((100% - 20px) / 2); /* 2 columns */
        min-width: 110px;
    }
}

/* Expanded Grid Mode when grid-view class is added */
.manga-grid-carousel.grid-view {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    overflow-x: visible;
    flex-wrap: wrap;
    gap: 20px;
}

@media (max-width: 1024px) {
    .manga-grid-carousel.grid-view {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .manga-grid-carousel.grid-view {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .manga-grid-carousel.grid-view {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Carousel Nav Buttons */
.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.carousel-wrapper:hover .carousel-nav-btn {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
}

.carousel-nav-btn:hover {
    background-color: var(--border-color);
    color: var(--accent);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.carousel-nav-btn.prev-btn {
    left: -22px;
}

.carousel-nav-btn.next-btn {
    right: -22px;
}

.carousel-nav-btn svg {
    width: 18px;
    height: 18px;
}

/* Hide navigation buttons when carousel is expanded into grid view */
.carousel-wrapper.expanded .carousel-nav-btn {
    display: none !important;
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-btn {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    min-width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0 14px;
    outline: none;
}

.page-btn:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
    border-color: var(--text-secondary);
    transform: translateY(-1px);
}

.page-btn.active {
    background: var(--accent-gradient);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(168, 85, 247, 0.2);
}

.page-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
    cursor: not-allowed;
}

.page-dots {
    color: var(--text-muted);
    font-weight: 700;
    padding: 0 4px;
}

/* Reader View Styles */
.reader-header {
    position: sticky;
    top: 72px; /* Stick below the fixed 72px desktop navbar */
    width: 100%;
    background-color: rgba(17, 24, 39, 0.85); /* Dark background matching theme with blur */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 90; /* slightly below main navbar's 100 z-index */
}

/* Light theme support */
.light-theme .reader-header {
    background-color: rgba(255, 255, 255, 0.85);
}

.reader-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.reader-manga-info {
    display: flex;
    flex-direction: column;
}

.reader-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.reader-chapter-title {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.reader-select {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.reader-select:focus {
    border-color: var(--accent);
}

.reader-container {
    width: 100%;
    background-color: #0b0f19; /* dark reader background for best contrast */
    padding: 20px 0;
    display: flex;
    justify-content: center;
}

.light-theme .reader-container {
    background-color: #f3f4f6;
}

.reader-images-wrapper {
    max-width: 800px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px; /* flow pages closely */
}

.reader-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    background-color: #111827; /* placeholder background for images */
}

/* Reader navigation at the bottom */
.reader-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 30px 24px 60px 24px;
    background-color: #0b0f19;
    border-top: 1px solid var(--border-color);
}

.light-theme .reader-navigation {
    background-color: #f3f4f6;
}

@media (max-width: 768px) {
    .reader-header {
        top: 56px; /* Stick below the fixed 56px mobile navbar */
        padding: 10px 16px;
    }
    .reader-title {
        font-size: 14px;
    }
    .reader-select {
        padding: 6px 10px;
        font-size: 12px;
    }
    .reader-navigation {
        padding: 20px 16px 40px 16px;
        gap: 8px;
    }
    .reader-navigation .page-btn {
        padding: 0 10px;
        font-size: 12px;
        height: 36px;
    }
}


/* ═══════════════════════════════════════════════════════════
   MOBILE BOTTOM NAVIGATION BAR
   ═══════════════════════════════════════════════════════════ */

.mobile-bottom-nav {
    display: none; /* hidden on desktop */
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background-color: var(--glass-bg);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid var(--glass-border);
        z-index: 200;
        align-items: flex-end;
        padding-bottom: 4px;
        padding-bottom: env(safe-area-inset-bottom, 4px);
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 0 8px;
        background: none;
        border: none;
        outline: none;
        cursor: pointer;
        color: var(--text-muted);
        font-family: var(--font-primary);
        font-size: 10px;
        font-weight: 500;
        transition: color 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-item svg {
        width: 22px;
        height: 22px;
        transition: transform 0.2s ease;
    }

    .mobile-nav-item.active {
        color: #3b82f6;
    }

    .mobile-nav-item:active svg {
        transform: scale(0.88);
    }

    /* Center search bubble CTA */
    .mobile-nav-search-btn {
        flex: 1.2;
        color: #fff;
        position: relative;
    }

    .mobile-nav-search-bubble {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: var(--accent-gradient);
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 16px rgba(139, 92, 246, 0.5);
        margin-top: -20px;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .mobile-nav-search-btn:active .mobile-nav-search-bubble {
        transform: scale(0.9);
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
    }

    .mobile-nav-search-bubble svg {
        width: 22px;
        height: 22px;
        color: #fff;
    }

    /* Give main content bottom padding so content isn't hidden behind bottom nav */
    .main-content {
        padding-bottom: 80px !important;
    }
}


/* ═══════════════════════════════════════════════════════════
   MOBILE SEARCH OVERLAY (Full Screen)
   ═══════════════════════════════════════════════════════════ */

.mobile-search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    background-color: var(--bg-primary);
    flex-direction: column;
    animation: overlaySlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-search-overlay.open {
    display: flex;
}

@keyframes overlaySlideIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mobile-search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.mob-search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.mobile-search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-primary);
    font-size: 16px;
    color: var(--text-primary);
    min-width: 0;
}

.mobile-search-bar input::placeholder {
    color: var(--text-muted);
}

#mobile-search-close {
    background: none;
    border: none;
    outline: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}

#mobile-search-close:hover {
    background: var(--bg-tertiary);
}

.mobile-search-results {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
}

.mobile-search-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Mobile search result item (list style) */
.mob-result-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.mob-result-item:active {
    background: var(--bg-tertiary);
}

.mob-result-thumb {
    width: 48px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.mob-result-info {
    flex: 1;
    min-width: 0;
}

.mob-result-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mob-result-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.mob-result-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.mob-result-badge.manga    { background: var(--tag-manga);   color: #fff; }
.mob-result-badge.manhwa   { background: var(--tag-manhwa);  color: #fff; }
.mob-result-badge.manhua   { background: var(--tag-manhua);  color: #fff; }
.mob-result-badge.tv       { background: #f59e0b;            color: #fff; }


/* ═══════════════════════════════════════════════════════════
   MOBILE NAVBAR — Simplified Top Bar
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Hide desktop nav menu and search on mobile */
    .nav-menu {
        display: none;
    }
    .nav-actions .search-box {
        display: none;
    }
    .nav-actions .action-circle-btn#filter-toggle-btn {
        display: none;
    }
    .nav-actions .login-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0 14px;
        font-size: 12px;
        height: 34px;
    }
    /* Keep only theme toggle in desktop nav (will be handled by bottom nav on mobile) */
    .nav-actions #theme-toggle-btn {
        display: none; /* managed from bottom nav */
    }

    /* Slim the top navbar on mobile */
    .navbar-header {
        height: 56px;
    }
    .main-content {
        padding-top: 0;
    }

    /* Logo on left, actions on right on mobile */
    .navbar-container {
        justify-content: space-between;
        padding: 0 16px;
    }

    /* Show filter button on mobile next to logo */
    .nav-actions {
        position: absolute;
        right: 16px;
    }
    .nav-actions .action-circle-btn#filter-toggle-btn {
        display: flex !important;
    }

    /* Logo smaller */
    .logo-link {
        font-size: 18px;
    }
    .logo-icon {
        width: 24px;
        height: 24px;
    }
}


/* ═══════════════════════════════════════════════════════════
   MOBILE CONTENT LAYOUT IMPROVEMENTS
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Section headers */
    .section-title {
        font-size: 18px !important;
    }

    .section-header {
        margin-bottom: 14px;
    }

    /* Hero / Popular section */
    .popular-section {
        margin-bottom: 28px;
    }

    /* Manga grid — 2 columns on small phone, 3 on larger */
    .manga-grid.grid-view {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    /* Carousel cards on home */
    .manga-grid:not(.grid-view) .manga-card {
        width: 130px;
    }

    /* Updates grid single column on phone */
    .updates-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Cards: reduce hover lift on touch devices */
    .manga-card:hover {
        transform: none;
    }

    /* Filter panel full-width */
    .filter-panel-container {
        flex-wrap: wrap;
        gap: 10px;
    }

    .filter-group {
        width: 100%;
    }

    /* Toggle popular button */
    .toggle-popular-btn {
        font-size: 13px;
        padding: 8px 18px;
    }
}

@media (max-width: 480px) {
    .manga-grid.grid-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}


/* ═══════════════════════════════════════════════════════════
   MOBILE DETAIL MODAL IMPROVEMENTS
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 680px) {
    #detail-modal .modal-card {
        border-radius: 16px 16px 0 0;
        max-height: 94vh;
        margin-top: auto;
        overflow-y: auto;
    }

    #detail-modal.modal-backdrop {
        align-items: flex-end;
    }

    /* Drag handle indicator */
    #detail-modal .modal-card::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: var(--border-color);
        margin: 12px auto 0;
    }

    .detail-banner {
        height: 160px;
    }

    .detail-content-wrapper {
        flex-direction: column;
        align-items: center;
        padding: 0 16px 100px 16px;
        gap: 16px;
        margin-top: -50px;
    }

    .detail-left {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .detail-cover-img {
        width: 150px;
        height: auto;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    }

    .bookmark-toggle-btn {
        width: 220px !important;
        justify-content: center;
    }

    .detail-right {
        width: 100%;
        text-align: center;
    }

    .detail-title {
        font-size: 20px !important;
    }

    .detail-author {
        font-size: 13px;
    }

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

    .detail-genres {
        justify-content: center;
    }

    .detail-close-btn {
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    /* Chapter list items bigger touch target */
    .chapter-item {
        padding: 14px 12px;
    }
}


/* ═══════════════════════════════════════════════════════════
   MOBILE READER IMPROVEMENTS
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Reader image full-width, no side padding */
    .reader-page-img {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    .reader-pages-container {
        padding: 0;
        gap: 2px;
    }

    /* Tap zones for prev/next page */
    .reader-tap-left,
    .reader-tap-right {
        display: flex;
        position: fixed;
        top: 60px;
        bottom: 80px;
        width: 35%;
        z-index: 10;
        align-items: center;
        justify-content: center;
        opacity: 0;
        pointer-events: all;
        -webkit-tap-highlight-color: transparent;
    }
    .reader-tap-left  { left: 0; }
    .reader-tap-right { right: 0; }
}


/* ═══════════════════════════════════════════════════════════
   MOBILE MANGA DIRECTORY TAB
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .directory-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }

    .directory-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .directory-controls {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .page-info-text {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .directory-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}


/* ═══════════════════════════════════════════════════════════
   TOAST — move up above bottom nav on mobile
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .toast-container {
        bottom: 72px;
    }
}

/* ==========================================================================
   ADS SYSTEM & DASHBOARDS
   ========================================================================== */

/* Main layout wrapper to display content and sidebar side-by-side */
.main-layout-wrapper {
    display: flex;
    max-width: 1280px;
    margin: 0 auto;
    gap: 24px;
    padding: 0 24px;
    width: 100%;
}

.main-content {
    flex: 1;
    min-width: 0; /* prevent layout blowout */
}

/* Sidebar Ads layout */
.sidebar-ads {
    width: 260px;
    flex-shrink: 0;
    display: block;
}

.sidebar-ads-sticky {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (max-width: 1024px) {
    .sidebar-ads {
        display: none; /* Hide sidebar ads on medium/small screens */
    }
    .main-layout-wrapper {
        padding: 0 16px;
    }
}

/* General Ads slots styling */
.ads-slot {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ads-slot:hover {
    border-color: rgba(168, 85, 247, 0.3);
    box-shadow: 0 6px 16px rgba(168, 85, 247, 0.1);
}

.ads-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.ads-banner-mock {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.ads-banner-mock:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    border-color: var(--accent);
}

/* Header & Footer Ads special sizing */
.header-ads {
    max-width: 1280px;
    margin: 16px auto 0 auto;
    width: calc(100% - 48px);
}

.footer-ads {
    max-width: 1280px;
    margin: 24px auto;
    width: calc(100% - 48px);
}

@media (max-width: 1024px) {
    .header-ads, .footer-ads {
        width: calc(100% - 32px);
    }
}

.sidebar-ad-box {
    padding: 16px;
}

.ads-banner-mock.vertical-ad-1 {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 24px 16px;
    text-align: center;
    color: var(--text-primary);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.ads-banner-mock.vertical-ad-2 {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1) 0%, rgba(244, 63, 94, 0.1) 100%);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 24px 16px;
    text-align: center;
    color: var(--text-primary);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.ads-banner-mock.vertical-ad-1 h4,
.ads-banner-mock.vertical-ad-2 h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.ads-banner-mock.vertical-ad-1 p,
.ads-banner-mock.vertical-ad-2 p {
    margin: 0;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.ads-banner-mock .btn-sm {
    height: 32px;
    padding: 0 16px;
    font-size: 12px;
    border-radius: 16px;
    cursor: pointer;
}

.ads-close-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
}

.ads-close-btn:hover {
    color: var(--text-primary);
}

/* Login/Register Tabs */
.login-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    gap: 16px;
}

.login-tab-btn {
    flex: 1;
    height: 44px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.login-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Admin Dashboard Panel Styles */
.admin-dashboard-grid,
.user-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .admin-dashboard-grid,
    .user-dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.admin-card,
.dashboard-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.admin-card h3,
.dashboard-card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.admin-form-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-form-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    width: 100%;
}

.admin-form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Switch styling */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #3b82f6;
    border-color: transparent;
}

input:checked + .slider:before {
    transform: translateX(22px);
    background-color: #ffffff;
}

.admin-stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.admin-stat-box {
    flex: 1;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.admin-stat-number {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
}

.admin-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 600;
}

.admin-stat-box-large {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
}

.admin-stat-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
}

/* User Dashboard list elements */
.history-list,
.updates-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}

.history-item,
.update-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover,
.update-item-row:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}

.history-cover,
.update-item-cover {
    width: 40px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
}

.history-info,
.update-item-info {
    flex: 1;
    min-width: 0;
}

.history-title,
.update-item-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-ch,
.update-item-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

.history-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
    flex-shrink: 0;
}

