/**
 * AnimeHub Base Styles
 *
 * Core styles, typography, header, footer, and utilities
 *
 * @package AnimeHub
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

:root {
    /* Colors */
    --animehub-primary: #ff6b35;
    --animehub-primary-hover: #e55a2a;
    --animehub-primary-rgb: 255, 107, 53;
    --animehub-secondary: #1a1a1a;
    --animehub-accent: #4a9eff;
    
    /* Background */
    --animehub-bg: #0a0a0a;
    --animehub-bg-secondary: #111111;
    --animehub-bg-card: #141414;
    --animehub-bg-elevated: #1a1a1a;
    
    /* Text */
    --animehub-text: #ffffff;
    --animehub-text-secondary: #a0a0a0;
    --animehub-text-muted: #666666;
    
    /* Border */
    --animehub-border: #2a2a2a;
    --animehub-border-light: #333333;
    
    /* Status */
    --animehub-success: #00c853;
    --animehub-warning: #ffc107;
    --animehub-error: #ff5252;
    --animehub-info: #2196f3;
    
    /* Spacing */
    --animehub-container: 1400px;
    --animehub-gap: 24px;
    --animehub-radius: 12px;
    --animehub-radius-sm: 8px;
    
    /* Fonts - Matching animestream theme */
    --animehub-font: "Fira Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --animehub-font-mono: "SF Mono", Consolas, monaco, "Andale Mono", "DejaVu Sans Mono", monospace;
    
    /* Shadows */
    --animehub-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --animehub-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    
    /* Transitions */
    --animehub-transition: 0.2s ease;
    --animehub-transition-slow: 0.3s ease;
    
    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-header: 500;
    --z-overlay: 900;
    --z-modal: 1000;
}

/* ==========================================================================
   Base Reset & Typography
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Fira Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    font-size: 16px;
    line-height: 1.6;
    color: var(--animehub-text);
    background: var(--animehub-bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.mobile-menu-open {
    overflow: hidden;
}

a {
    color: var(--animehub-primary);
    text-decoration: none;
    transition: color var(--animehub-transition);
}

a:hover {
    color: var(--animehub-primary-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
}

p {
    margin: 0 0 1em;
}

/* ==========================================================================
   Container
   ========================================================================== */

.container {
    max-width: var(--animehub-container);
    margin: 0 auto;
    padding: 0 var(--animehub-gap);
}

/* ==========================================================================
   Skip Link
   ========================================================================== */

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    z-index: 1000;
    background: var(--animehub-primary);
    color: #fff;
    padding: 10px 20px;
}

.skip-link:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 10px;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--animehub-border);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--animehub-container);
    margin: 0 auto;
    padding: 0 var(--animehub-gap);
    height: 70px;
}

/* Logo */
.site-branding {
    flex-shrink: 0;
}

.site-logo {
    display: flex;
    align-items: center;
}

.site-logo {
    position: relative;
}

.site-logo .logo-img {
    height: 54px;
    width: auto;
    display: block;
}

.site-logo .logo-img--light {
    display: block;
}

.site-logo .logo-img--dark {
    display: none;
}

/* Dark mode logo (if theme supports dark mode) */
@media (prefers-color-scheme: dark) {
    .site-logo .logo-img--light {
        display: none;
    }
    .site-logo .logo-img--dark {
        display: block;
    }
}

.site-logo .logo-text {
    font-size: 24px;
    font-weight: 800;
    color: var(--animehub-text);
    letter-spacing: -0.5px;
}

.site-logo .logo-text:hover {
    color: var(--animehub-primary);
}

/* Navigation */
.main-navigation {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
    margin: 0 40px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    position: relative;
}

.nav-menu li a {
    display: block;
    padding: 10px 16px;
    color: var(--animehub-text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--animehub-radius-sm);
    transition: all var(--animehub-transition);
}

.nav-menu li a:hover,
.nav-menu li.current-menu-item > a {
    color: var(--animehub-text);
    background: rgba(255, 255, 255, 0.05);
}

.nav-menu li.current-menu-item > a {
    color: var(--animehub-primary);
}

/* Dropdown */
.nav-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    padding: 8px 0;
    background: var(--animehub-bg-elevated);
    border: 1px solid var(--animehub-border);
    border-radius: var(--animehub-radius);
    box-shadow: var(--animehub-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--animehub-transition);
    list-style: none;
}

.nav-menu li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-menu .sub-menu a {
    padding: 10px 20px;
    border-radius: 0;
}

/* Header Quick Search */
.header-search-form {
    margin-left: 20px;
}

.header-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.header-search-input {
    width: 200px;
    padding: 8px 40px 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--animehub-border);
    border-radius: var(--animehub-radius-sm);
    color: var(--animehub-text);
    font-size: 14px;
    transition: all var(--animehub-transition);
}

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

.header-search-input:focus {
    outline: none;
    width: 280px;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--animehub-primary);
}

.header-search-submit {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--animehub-text-secondary);
    cursor: pointer;
    transition: color var(--animehub-transition);
    padding: 0;
}

.header-search-submit:hover {
    color: var(--animehub-primary);
}

.header-search-input:focus + .header-search-submit {
    color: var(--animehub-primary);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: transparent;
    border: 1px solid var(--animehub-border);
    border-radius: var(--animehub-radius-sm);
    color: var(--animehub-text-secondary);
    transition: all var(--animehub-transition);
}

.header-action-btn:hover {
    background: var(--animehub-primary);
    border-color: var(--animehub-primary);
    color: #fff;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    padding: 0;
    width: 42px;
    height: 42px;
    background: transparent;
    border: 1px solid var(--animehub-border);
    border-radius: var(--animehub-radius-sm);
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    justify-content: center;
}

.hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--animehub-text);
    transition: all var(--animehub-transition);
}

/* ==========================================================================
   Search Overlay
   ========================================================================== */

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 120px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--animehub-transition-slow);
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-overlay-container {
    width: 90%;
    max-width: 700px;
}

.search-form-overlay {
    display: flex;
    align-items: center;
    background: var(--animehub-bg-elevated);
    border: 1px solid var(--animehub-border);
    border-radius: var(--animehub-radius);
    overflow: hidden;
}

.search-input-overlay {
    flex: 1;
    padding: 18px 24px;
    background: transparent;
    border: none;
    color: var(--animehub-text);
    font-size: 18px;
    font-family: inherit;
    outline: none;
}

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

.search-submit-overlay,
.search-close {
    padding: 18px;
    background: transparent;
    border: none;
    color: var(--animehub-text-secondary);
    cursor: pointer;
    transition: color var(--animehub-transition);
}

.search-submit-overlay:hover,
.search-close:hover {
    color: var(--animehub-primary);
}

.search-suggestions {
    margin-top: 30px;
}

.search-suggestions-title {
    font-size: 12px;
    color: var(--animehub-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.search-suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.search-suggestions-list a {
    padding: 8px 16px;
    background: var(--animehub-bg-elevated);
    border: 1px solid var(--animehub-border);
    border-radius: 20px;
    color: var(--animehub-text-secondary);
    font-size: 14px;
}

.search-suggestions-list a:hover {
    border-color: var(--animehub-primary);
    color: var(--animehub-primary);
}

/* ==========================================================================
   Mobile Menu
   ========================================================================== */

/* ==========================================================================
   Mobile Menu - Clean Rewrite
   ========================================================================== */

/* 
 * Mobile Menu Structure:
 * .mobile-menu (container - fixed, full screen, hidden by default)
 *   .mobile-menu-header (logo + close button)
 *   .mobile-menu-content (search + menu items)
 *     .mobile-search-form
 *     ul.mobile-nav-menu
 *       li.menu-item > a
 */

/* Base state: hidden off-screen to the left */
.mobile-menu {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important; /* Dynamic viewport height for mobile */
    background-color: #0a0a0a;
    z-index: 10000 !important;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: contain;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Active state: slide in from left */
.mobile-menu.active {
    transform: translateX(0) !important;
    pointer-events: auto;
}


/* Header with logo and close button */
.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: #0a0a0a;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
}

.mobile-logo {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
}

.mobile-menu-close {
    width: 40px;
    height: 40px;
    padding: 8px;
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-close svg {
    width: 24px;
    height: 24px;
    stroke: #ffffff;
}

/* Content area - scrollable */
.mobile-menu-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background-color: #0a0a0a;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Search form */
.mobile-search-form {
    margin-bottom: 24px;
}

.mobile-search-input {
    width: 100%;
    padding: 14px 18px;
    background-color: #111111;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    font-family: inherit;
}

.mobile-search-input::placeholder {
    color: #666666;
}

/* Navigation menu */
.mobile-nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-menu li {
    border-bottom: 1px solid #2a2a2a;
}

.mobile-nav-menu li:last-child {
    border-bottom: none;
}

.mobile-nav-menu li a {
    display: block;
    padding: 16px 0;
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.mobile-nav-menu li a:hover {
    color: #ff6b35;
}

.mobile-nav-menu li.current-menu-item > a,
.mobile-nav-menu li.current_page_item > a {
    color: #ff6b35;
}

/* Fallback nav-menu class support */
.mobile-menu-content .nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu-content .nav-menu li {
    border-bottom: 1px solid #2a2a2a;
}

.mobile-menu-content .nav-menu li a {
    display: block;
    padding: 16px 0;
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
}

/* Submenu support */
.mobile-nav-menu .sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    padding-left: 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-nav-menu .menu-item-has-children.submenu-open > .sub-menu {
    max-height: 500px;
}

.mobile-nav-menu .sub-menu li a {
    padding: 12px 0;
    font-size: 14px;
    color: #a0a0a0;
}

/* Body lock when menu is open */
body.mobile-menu-open {
    overflow: hidden;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    background: var(--animehub-bg-secondary);
    border-top: 1px solid var(--animehub-border);
    margin-top: 60px;
}

.footer-container {
    max-width: var(--animehub-container);
    margin: 0 auto;
    padding: 0 var(--animehub-gap);
}

.footer-top {
    padding: 60px 0 40px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 30px;
}

/* Footer Brand */
.footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.footer-logo {
    font-size: 54px;
    font-weight: 800;
    color: var(--animehub-text);
    display: inline-block;
    margin-bottom: 15px;
    text-align: center;
}

.footer-logo:hover {
    color: var(--animehub-primary);
}

.footer-logo-img {
    height: 90px;
    width: auto;
    max-width: 450px;
    display: block;
    margin: 0 auto;
}

.footer-logo-text {
    font-size: 54px;
    font-weight: 800;
    color: var(--animehub-text);
    display: inline-block;
}

.footer-logo:hover .footer-logo-text {
    color: var(--animehub-primary);
}

.footer-tagline {
    color: var(--animehub-text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    text-align: center;
}

/* Footer Social */
.footer-social {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--animehub-bg-card);
    border: 1px solid var(--animehub-border);
    border-radius: var(--animehub-radius-sm);
    color: var(--animehub-text-secondary);
    transition: all var(--animehub-transition);
}

.social-link:hover {
    background: var(--animehub-primary);
    border-color: var(--animehub-primary);
    color: #fff;
}

/* Footer Widgets */
.footer-widget-area {
    padding-left: 20px;
}

.footer-widget-area .widget-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--animehub-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
}

.footer-widget-area ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-widget-area ul li {
    margin-bottom: 10px;
}

.footer-widget-area ul li a {
    color: var(--animehub-text-secondary);
    font-size: 14px;
}

.footer-widget-area ul li a:hover {
    color: var(--animehub-primary);
}

/* Footer Menu */
.footer-nav {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    margin: 0 !important;
    padding: 0 !important;
}

.footer-menu,
#footer-menu,
.footer-nav #footer-menu,
.site-footer #footer-menu,
footer #footer-menu {
    display: inline-flex !important;
    gap: 12px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 auto !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    text-align: center !important;
}

.footer-menu li,
#footer-menu li {
    display: inline-block;
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-menu li a,
#footer-menu li a {
    display: inline-block;
    padding: 8px 16px;
    color: var(--animehub-text-secondary);
    font-size: 14px;
    text-decoration: none;
    border: 1px solid var(--animehub-border);
    border-radius: var(--animehub-radius-sm);
    transition: all var(--animehub-transition);
}

.footer-menu li a:hover,
#footer-menu li a:hover {
    color: var(--animehub-primary);
    border-color: var(--animehub-primary);
    background: rgba(255, 107, 53, 0.1);
}

/* Footer Bottom */
.footer-bottom {
    padding: 24px 0;
    border-top: 1px solid var(--animehub-border);
    text-align: center;
}

.footer-bottom-content {
    display: block;
    width: 100%;
    text-align: center;
}

.footer-copyright {
    color: var(--animehub-text-muted);
    font-size: 14px;
    text-align: center;
    display: block;
    width: 100%;
}

/* ==========================================================================
   Back to Top
   ========================================================================== */

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--animehub-primary);
    border: none;
    border-radius: var(--animehub-radius-sm);
    color: #fff;
    z-index: var(--z-sticky);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--animehub-transition);
    box-shadow: var(--animehub-shadow);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--animehub-primary-hover);
    transform: translateY(-3px);
}

/* ==========================================================================
   Page Title Section
   ========================================================================== */

.page-title-section {
    padding: 40px 0;
    background: linear-gradient(135deg, var(--animehub-bg-secondary) 0%, var(--animehub-bg) 100%);
    border-bottom: 1px solid var(--animehub-border);
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}

.page-description {
    color: var(--animehub-text-secondary);
    font-size: 16px;
    margin: 0;
}

/* ==========================================================================
   Anime News Header (Reusable Header Style)
   ========================================================================== */

.anime-news-header {
    text-align: center;
    margin-bottom: 40px;
}

.anime-news-header-icon {
    margin-bottom: 15px;
    color: var(--animehub-primary);
    display: flex;
    justify-content: center;
    align-items: center;
}

.anime-news-header .page-title {
    font-size: 2rem;
    margin-bottom: 10px;
}

.anime-news-header .page-description {
    color: var(--animehub-text-muted);
}

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--animehub-text-muted);
    margin-bottom: 15px;
}

.breadcrumbs a {
    color: var(--animehub-text-secondary);
}

.breadcrumbs a:hover {
    color: var(--animehub-primary);
}

.breadcrumbs .separator {
    color: var(--animehub-text-muted);
}

/* ==========================================================================
   Grid Layouts
   ========================================================================== */

.cards-grid {
    display: grid;
    gap: 20px;
}

/* Anime Grid - Responsive columns */
.cards-grid--anime,
.cards-grid--upcoming_anime,
.cards-grid--popular_anime,
.cards-grid--most_viewed_anime,
.cards-grid--latest_anime,
.cards-grid--top_rated,
.cards-grid--currently_airing {
    display: grid !important;
    gap: 20px !important;
    grid-template-columns: repeat(2, 1fr); /* Mobile: 2 columns */
    grid-template-rows: auto;
}

@media (min-width: 768px) {
    .cards-grid--anime,
    .cards-grid--upcoming_anime,
    .cards-grid--popular_anime,
    .cards-grid--most_viewed_anime,
    .cards-grid--latest_anime,
    .cards-grid--top_rated,
    .cards-grid--currently_airing {
        grid-template-columns: repeat(3, 1fr); /* Tablet: 3 columns */
    }
    
    /* Exception: Homepage sections use 2 columns on mobile */
    @media (max-width: 1199px) {
        .homepage .home-section .cards-grid--anime,
        .homepage .home-section .cards-grid--episode,
        .homepage .home-section .cards-grid--video {
            grid-template-columns: repeat(2, 1fr) !important;
        }
    }
}

@media (min-width: 1200px) {
    .cards-grid--anime,
    .cards-grid--upcoming_anime,
    .cards-grid--popular_anime,
    .cards-grid--most_viewed_anime,
    .cards-grid--latest_anime,
    .cards-grid--top_rated,
    .cards-grid--currently_airing {
        grid-template-columns: repeat(5, 1fr); /* Laptop: 5 columns */
    }
    
    /* Exception: Homepage sections use 2 columns on mobile */
    @media (max-width: 1399px) {
        .homepage .home-section .cards-grid--anime,
        .homepage .home-section .cards-grid--episode,
        .homepage .home-section .cards-grid--video {
            grid-template-columns: repeat(2, 1fr) !important;
        }
    }
}

@media (min-width: 1400px) {
    .cards-grid--anime,
    .cards-grid--upcoming_anime,
    .cards-grid--popular_anime,
    .cards-grid--most_viewed_anime,
    .cards-grid--latest_anime,
    .cards-grid--top_rated,
    .cards-grid--currently_airing {
        grid-template-columns: repeat(6, 1fr); /* Desktop: 6 columns */
    }
}

/* CRITICAL: Override for homepage - must be after desktop rules */
/* Force mobile 2 columns for homepage sections */
@media (max-width: 1399px) {
    .homepage .home-section .cards-grid--anime,
    .homepage .home-section .cards-grid--episode,
    .homepage .home-section .cards-grid--video,
    .site-main.homepage .home-section .cards-grid--anime,
    .site-main.homepage .home-section .cards-grid--episode,
    .site-main.homepage .home-section .cards-grid--video {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .homepage .home-section.section-columns-2 .cards-grid,
    .homepage .home-section.section-columns-3 .cards-grid,
    .homepage .home-section.section-columns-4 .cards-grid,
    .homepage .home-section.section-columns-5 .cards-grid,
    .homepage .home-section.section-columns-6 .cards-grid,
    .site-main.homepage .home-section.section-columns-2 .cards-grid,
    .site-main.homepage .home-section.section-columns-3 .cards-grid,
    .site-main.homepage .home-section.section-columns-4 .cards-grid,
    .site-main.homepage .home-section.section-columns-5 .cards-grid,
    .site-main.homepage .home-section.section-columns-6 .cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* CRITICAL: Force mobile 2 columns for homepage - override desktop rules */
@media (max-width: 1399px) {
    .homepage .home-section .cards-grid--anime,
    .homepage .home-section .cards-grid--episode,
    .homepage .home-section .cards-grid--video {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Video Grid - Responsive columns (16:9 thumbnails) */
.cards-grid--video,
.cards-grid--latest_videos,
.cards-grid--popular_videos,
.cards-grid--most_viewed_videos {
    display: grid !important;
    gap: 20px !important;
    grid-template-columns: repeat(2, 1fr); /* Mobile: 2 columns */
}

@media (min-width: 768px) {
    .cards-grid--video,
    .cards-grid--latest_videos,
    .cards-grid--popular_videos,
    .cards-grid--most_viewed_videos {
        grid-template-columns: repeat(3, 1fr); /* Tablet: 3 columns */
    }
}

@media (min-width: 1200px) {
    .cards-grid--video,
    .cards-grid--latest_videos,
    .cards-grid--popular_videos,
    .cards-grid--most_viewed_videos {
        grid-template-columns: repeat(4, 1fr); /* Laptop: 4 columns */
    }
}

@media (min-width: 1400px) {
    .cards-grid--video,
    .cards-grid--latest_videos,
    .cards-grid--popular_videos,
    .cards-grid--most_viewed_videos {
        grid-template-columns: repeat(5, 1fr); /* Desktop: 5 columns */
    }
}

/* Episode Grid - Responsive columns */
.cards-grid--episode,
.cards-grid--latest_episodes,
.cards-grid--popular_episodes,
.cards-grid--most_viewed_episodes {
    display: grid !important;
    gap: 20px !important;
    grid-template-columns: repeat(2, 1fr); /* Mobile: 2 columns */
}

@media (min-width: 768px) {
    .cards-grid--episode,
    .cards-grid--latest_episodes,
    .cards-grid--popular_episodes,
    .cards-grid--most_viewed_episodes {
        grid-template-columns: repeat(4, 1fr); /* Tablet: 4 columns */
    }
}

@media (min-width: 1200px) {
    .cards-grid--episode,
    .cards-grid--latest_episodes,
    .cards-grid--popular_episodes,
    .cards-grid--most_viewed_episodes {
        grid-template-columns: repeat(5, 1fr); /* Laptop: 5 columns */
    }
}

@media (min-width: 1400px) {
    .cards-grid--episode,
    .cards-grid--latest_episodes,
    .cards-grid--popular_episodes,
    .cards-grid--most_viewed_episodes {
        grid-template-columns: repeat(6, 1fr); /* Desktop: 6 columns */
    }
}

/* News Grid - Responsive columns (16:9 thumbnails) */
.cards-grid--news,
.cards-grid--latest_news,
.cards-grid--most_viewed_news {
    display: grid !important;
    gap: 20px !important;
    grid-template-columns: repeat(1, 1fr); /* Mobile: 1 column */
}

@media (min-width: 768px) {
    .cards-grid--news,
    .cards-grid--latest_news,
    .cards-grid--most_viewed_news {
        grid-template-columns: repeat(2, 1fr); /* Tablet: 2 columns */
    }
}

@media (min-width: 1200px) {
    .cards-grid--news,
    .cards-grid--latest_news,
    .cards-grid--most_viewed_news {
        grid-template-columns: repeat(3, 1fr); /* Laptop: 3 columns */
    }
}

@media (min-width: 1400px) {
    .cards-grid--news,
    .cards-grid--latest_news,
    .cards-grid--most_viewed_news {
        grid-template-columns: repeat(4, 1fr); /* Desktop: 4 columns */
    }
}

/* Schedule Grid - Responsive columns */
.cards-grid--schedule {
    display: grid !important;
    gap: 20px !important;
    grid-template-columns: repeat(2, 1fr); /* Mobile: 2 columns */
}

@media (min-width: 768px) {
    .cards-grid--schedule {
        grid-template-columns: repeat(4, 1fr); /* Tablet: 4 columns */
    }
}

@media (min-width: 1200px) {
    .cards-grid--schedule {
        grid-template-columns: repeat(5, 1fr); /* Laptop: 5 columns */
    }
}

@media (min-width: 1400px) {
    .cards-grid--schedule {
        grid-template-columns: repeat(6, 1fr); /* Desktop: 6 columns */
    }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--animehub-radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--animehub-transition);
    text-decoration: none;
}

.btn--primary {
    background: var(--animehub-primary);
    color: #fff;
}

.btn--primary:hover {
    background: var(--animehub-primary-hover);
    color: #fff;
}

.btn--secondary {
    background: var(--animehub-bg-elevated);
    border: 1px solid var(--animehub-border);
    color: var(--animehub-text);
}

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

.btn--ghost {
    background: transparent;
    color: var(--animehub-text-secondary);
}

.btn--ghost:hover {
    color: var(--animehub-primary);
}

.btn--sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn--lg {
    padding: 16px 32px;
    font-size: 16px;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
}

.badge--primary {
    background: var(--animehub-primary);
    color: #fff;
}

.badge--sub {
    background: #3498db;
    color: #fff;
}

.badge--dub {
    background: #27ae60;
    color: #fff;
}

.badge--hd {
    background: #9b59b6;
    color: #fff;
}

.badge--new {
    background: var(--animehub-error);
    color: #fff;
}

.badge--ongoing {
    background: var(--animehub-success);
    color: #fff;
}

.badge--completed {
    background: #3498db;
    color: #fff;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Responsive Header Search */
@media (max-width: 1200px) {
    .header-search-input {
        width: 160px;
    }
    .header-search-input:focus {
        width: 220px;
    }
}

@media (max-width: 1024px) {
    .header-search-form {
        display: none;
    }
    .main-navigation {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    :root {
        --animehub-gap: 16px;
    }
    
    .header-container {
        height: 60px;
    }
    
    .random-btn {
        display: none;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .footer-content {
        gap: 24px;
        align-items: center;
        text-align: center;
    }
    
    .footer-nav {
        display: block;
        width: 100%;
        text-align: center;
    }
    
    .footer-menu,
    #footer-menu {
        display: inline-flex;
        gap: 8px;
        justify-content: center;
        margin: 0;
    }
    
    .footer-menu li a,
    #footer-menu li a {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .footer-bottom {
        text-align: center;
    }
    
    .footer-bottom-content {
        display: block;
        text-align: center;
    }
    
    .footer-copyright {
        text-align: center;
        width: 100%;
        display: block;
    }
    
    /* Keep 2 columns on mobile for better UX - minmax can cause inconsistent columns */
    .cards-grid--anime,
    .cards-grid--upcoming_anime,
    .cards-grid--popular_anime,
    .cards-grid--most_viewed_anime,
    .cards-grid--latest_anime,
    .cards-grid--top_rated,
    .cards-grid--currently_airing {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cards-grid--video,
    .cards-grid--latest_videos,
    .cards-grid--popular_videos,
    .cards-grid--most_viewed_videos {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-title-section {
        padding: 30px 0;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .btn--sm {
        min-height: 36px;
        padding: 8px 16px;
    }
    
    .back-to-top {
        right: 16px;
        bottom: 16px;
        width: 44px;
        height: 44px;
    }
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.animehub-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--animehub-border);
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--animehub-text-muted);
}

.pagination-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    justify-content: center;
}

.page-item {
    display: flex;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    background: var(--animehub-bg-secondary);
    border: 1px solid var(--animehub-border);
    border-radius: var(--animehub-radius-sm);
    color: var(--animehub-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--animehub-transition);
    cursor: pointer;
}

.page-link:hover {
    background: var(--animehub-primary);
    border-color: var(--animehub-primary);
    color: #fff;
    transform: translateY(-2px);
}

.page-item.active .page-link,
.page-item.active .page-link:hover {
    background: var(--animehub-primary);
    border-color: var(--animehub-primary);
    color: #fff;
    cursor: default;
    transform: none;
}

.page-item.page-prev .page-link,
.page-item.page-next .page-link {
    font-weight: 600;
    font-size: 1.1rem;
}

.page-item.page-first .page-link,
.page-item.page-last .page-link {
    font-weight: 600;
    font-size: 1.1rem;
}

.page-dots .page-link {
    background: transparent;
    border-color: transparent;
    cursor: default;
    min-width: auto;
    padding: 0 8px;
}

.page-dots .page-link:hover {
    background: transparent;
    border-color: transparent;
    color: var(--animehub-text);
    transform: none;
}

@media (max-width: 768px) {
    .animehub-pagination {
        margin-top: 30px;
        padding-top: 20px;
    }
    
    .pagination-links {
        gap: 6px;
    }
    
    .page-link {
        min-width: 38px;
        height: 38px;
        padding: 0 12px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .pagination-info {
        font-size: 0.85rem;
    }
    
    .page-link {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 0.85rem;
    }
    
    .page-item.page-prev .page-link,
    .page-item.page-next .page-link,
    .page-item.page-first .page-link,
    .page-item.page-last .page-link {
        font-size: 1rem;
    }
}

/* ==========================================================================
   No Results State
   ========================================================================== */

.no-results {
    text-align: center;
    padding: 60px 20px;
    margin: 60px auto;
    width: 100%;
}

.no-results h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--animehub-text, #fff);
    margin: 0 0 15px 0;
}

.no-results p {
    font-size: 1rem;
    color: var(--animehub-text-secondary, #999);
    margin: 0 0 30px 0;
    line-height: 1.6;
}

.no-results .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Site Notice (below main menu)
   ========================================================================== */

.site-notice {
    width: 100%;
    background: var(--animehub-primary, #ff6b35);
    color: #fff;
    font-size: 0.9375rem;
    line-height: 1.4;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

.site-notice__inner {
    max-width: var(--animehub-container, 1400px);
    margin: 0 auto;
    padding: 10px var(--animehub-gap, 24px);
    padding-right: 52px; /* space for dismiss button */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.site-notice__text {
    flex: 1;
    text-align: center;
}

.site-notice__text a {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.site-notice__text a:hover {
    opacity: 0.9;
}

.site-notice__dismiss {
    position: absolute;
    right: var(--animehub-gap, 24px);
    top: 50%;
    transform: translateY(-50%);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: var(--animehub-radius-sm, 8px);
    cursor: pointer;
    transition: background var(--animehub-transition, 0.2s ease);
}

.site-notice__dismiss:hover {
    background: rgba(255, 255, 255, 0.3);
}

.site-notice__dismiss:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
