/* Reset và Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Theme Colors */
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --bg-color: #ffffff;
    --surface-color: #f8f9fa;
    --text-color: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #ecf0f1;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 5px 20px rgba(0,0,0,0.15);
    
    /* Typography */
    --font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Layout */
    --container-max-width: 1200px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.3s ease;
    --container-max-width-mobile: 100vw;
    --container-horizontal-padding-mobile: 1rem;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary-color: #34495e;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --bg-color: #1a1a1a;
    --surface-color: #2d2d2d;
    --text-color: #ecf0f1;
    --text-secondary: #bdc3c7;
    --border-color: #404040;
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
    --shadow-hover: 0 5px 20px rgba(0,0,0,0.4);
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
}

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

@media (max-width: 768px) {
    .container {
        max-width: var(--container-max-width-mobile);
        padding: 0 var(--container-horizontal-padding-mobile);
    }
}

/* Header Styles */
.header {
    background-color: var(--surface-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) 0;
}

@media (max-width: 768px) {
    .header-content {
        gap: var(--spacing-md);
        padding: var(--spacing-sm) 0;
    }
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary-color);
    font-size: var(--font-size-xl);
    font-weight: 700;
    gap: var(--spacing-sm);
}

.logo i {
    color: var(--secondary-color);
}

/* Navigation Menu */
.main-nav {
    padding: 0;
    border-bottom: 1px solid #eee;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        padding: var(--spacing-md);
        gap: var(--spacing-sm);
    }
}

.nav-menu > li {
    position: relative;
}

.nav-menu > li > a {
    color: #333;
    text-decoration: none;
    padding: 1rem 1.5rem;
    display: block;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-menu > li:hover > a {
    color: #3498db;
}

.nav-menu > li.active > a {
    color: #3498db;
}

/* Search Section */
.search-section {
    padding: 2rem 0;
    background-color: #f8f9fa;
}

.search-container {
    display: flex;
    justify-content: center;
}

@media (max-width: 768px) {
    .search-container {
        justify-content: stretch;
    }
}

.search-box {
    display: flex;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .search-box {
        flex-direction: column;
        gap: 0;
        border-radius: 12px;
    }
}

.search-box input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    font-size: 1rem;
    outline: none;
    background-color: white;
}

@media (max-width: 768px) {
    .search-box input {
        padding: 0.85rem 1rem;
        font-size: var(--font-size-base);
    }
}

.search-box button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 1rem 2rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .search-box button {
        justify-content: center;
        width: 100%;
        padding: 0.9rem;
        border-radius: 0 0 12px 12px;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 8px;
    gap: 4px;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background-color: var(--text-color);
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* User Actions */
.user-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-actions button {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 2px solid #e1e8ed;
    background-color: white;
    color: #657786;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.user-actions button:hover {
    border-color: #3498db;
    color: #3498db;
    background-color: #f0f8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.2);
}

.user-actions button:active {
    transform: translateY(0);
}

/* Submenu Styles */
.submenu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background-color: #fff;
    width: 800px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    border-radius: 4px;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.nav-menu > li:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.submenu li {
    list-style: none;
}

.submenu li a {
    color: #333;
    padding: 0.5rem;
    display: block;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    text-align: center;
    border-radius: 4px;
}

.submenu li a:hover {
    background-color: #f8f9fa;
    color: #3498db;
}

/* Mobile Submenu Toggle Indicator */
.nav-menu > li.has-submenu > a,
.nav-menu > li > a.has-submenu {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-menu > li.has-submenu > a::after,
.nav-menu > li > a.has-submenu::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.75rem;
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
    display: none;
}

@media (max-width: 768px) {
    .nav-menu > li.has-submenu > a::after,
    .nav-menu > li > a.has-submenu::after {
        display: inline-block;
    }
    
    .nav-menu > li.submenu-open.has-submenu > a::after,
    .nav-menu > li.submenu-open > a.has-submenu::after {
        transform: rotate(180deg);
    }
}

/* Story Grid Layout */
.story-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .stories-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .stories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
    }
}

@media (max-width: 480px) {
    .stories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--spacing-sm);
    }
}

.story-card {
    position: relative;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

@media (max-width: 768px) {
    .story-card {
        border-radius: 12px;
        border: 1px solid rgba(0, 0, 0, 0.05);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    }
}

.story-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .story-cover {
        padding: var(--spacing-sm);
        background: white;
    }
}

.story-cover .cover-link {
    display: block;
    width: 90%;
    height: 90%;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
}

@media (max-width: 768px) {
    .story-cover .cover-link {
        width: 100%;
        height: auto;
    }
}

.story-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    transition: transform 0.3s ease;
    display: block;
}

@media (max-width: 768px) {
    .story-cover img {
        aspect-ratio: 3/4;
        height: auto;
    }
}

/* Badge System - Applied to all pages */
.story-badges {
    position: absolute;
    right: 8px;
    top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 15;
    pointer-events: none;
    align-items: flex-end;
}

.story-badge {
    height: 20px;
    padding: 0 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 40px;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Badge colors and strict ordering */
.story-badge.hot {
    order: 1; /* Always first - highest priority */
    background-color: #FF4E4E;
    background: linear-gradient(135deg, #FF4E4E 0%, #E53E3E 100%);
}

.story-badge.hot::before {
    content: '\f7e4'; /* Fire icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-right: 4px;
    font-size: 9px;
}

.story-badge.new {
    order: 2; /* Always second */
    background-color: #8EB3FD;
    background: linear-gradient(135deg, #8EB3FD 0%, #6B9BFF 100%);
}

.story-badge.full {
    order: 3; /* Always last - lowest priority */
    background-color: #009688;
    background: linear-gradient(135deg, #009688 0%, #00796B 100%);
}

.story-badge.ongoing {
    order: 4;
    background-color: #17a2b8;
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.story-badge.drop {
    order: 5;
    background-color: #6c757d;
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
}

/* Apply badge system to all story covers */
.story-cover {
    position: relative;
    overflow: hidden;
}

.story-info {
    padding: 10px;
    margin: 0;
    background-color: white;
    box-sizing: content-box;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

@media (max-width: 768px) {
    .story-info {
        padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
    }
}

.story-title {
    font-size: 0.9rem;
    font-weight: 700; /* Bold title as requested */
    margin: 10px 0 2px 0;
    padding: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
    box-sizing: content-box;
    text-align: center;
    min-height: 2.4em; /* 2 lines * 1.2 line-height */
    max-height: 2.4em;
}

@media (max-width: 768px) {
    .story-title {
        font-size: var(--font-size-base);
        margin: var(--spacing-sm) 0 var(--spacing-xs);
        -webkit-line-clamp: 3;
        line-clamp: 3;
        line-height: 1.3;
        min-height: 3.9em; /* 3 lines * 1.3 line-height */
        max-height: 3.9em;
    }
}

.story-title a {
    color: #333;
    text-decoration: none;
    margin: 0;
    padding: 0;
}

.story-title a:hover {
    color: #3498db;
}

.story-chapters {
    font-size: 0.8rem;
    color: #666;
    margin: 2px 0 5px 0;
    padding: 0;
    box-sizing: content-box;
    line-height: 1.2;
    text-align: center;
}

/* Story Info Styles - For Story Page Only */
.story-info-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.story-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    width: 100%;
    align-items: start;
}

.story-left-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

.story-main-info {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    align-items: flex-start;
}

.story-main-info .story-cover {
    width: 200px;
    min-width: 200px;
    height: auto;
    aspect-ratio: 3/4;
    border-radius: 8px;
}

.story-main-info .story-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-details {
    flex: 1;
}

.story-description {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    height: 100%;
}

.story-description h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-color);
}

.description-content {
    line-height: 1.8;
    color: var(--text-secondary);
    overflow: hidden;
    position: relative;
    transition: max-height 0.3s ease;
    flex: 1;
}

.description-content:not(.expanded) {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.description-content.expanded {
    max-height: none;
    display: block;
}

.description-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, var(--background-color));
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.description-content.expanded::after {
    opacity: 0;
}

.btn-see-more {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    flex-shrink: 0;
}

.btn-see-more:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-see-more i {
    transition: transform 0.3s ease;
}



.story-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.story-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
}

.story-meta .meta-label {
    font-size: inherit;
    font-weight: 600;
    margin: 0;
    color: var(--text-secondary);
}

.story-meta .meta-value {
    color: var(--text-color);
}

.story-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
}

.story-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: center;
}

.story-actions button,
.story-actions a {
    padding: 0.65rem 0.85rem;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    border: none;
    font-size: 0.85rem;
    white-space: nowrap;
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.story-actions button i,
.story-actions a i {
    font-size: 0.8rem;
}

.btn-primary {
    background-color: #3498db;
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #fff;
    color: #333;
    border: 2px solid #eee;
}

.btn-secondary:hover {
    border-color: #3498db;
    color: #3498db;
}

.btn-favorite {
    background-color: #e74c3c;
    color: white;
    border: none;
}

.btn-favorite:hover {
    background-color: #c0392b;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    padding: 4rem 0;
    text-align: center;
}

@media (max-width: 768px) {
    .hero {
        padding: var(--spacing-2xl) 0 var(--spacing-xl);
    }
}

.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: var(--font-size-3xl);
        line-height: 1.2;
        padding: 0 var(--spacing-sm);
    }
}

.hero-content p {
    font-size: 1.2rem;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .hero-content p {
        font-size: var(--font-size-base);
        margin-top: var(--spacing-sm);
    }
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xl);
    margin-top: var(--spacing-xl);
}

@media (max-width: 768px) {
    .hero-stats {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--spacing-lg);
    }
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: var(--font-size-sm);
    opacity: 0.8;
}

/* Section Titles */
.section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-2xl);
    font-weight: 600;
    margin-bottom: var(--spacing-xl);
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .section-title {
        font-size: var(--font-size-xl);
        margin-bottom: var(--spacing-lg);
    }
}

.section-title i {
    color: var(--secondary-color);
}

/* Featured Stories */
.featured-stories {
    padding: var(--spacing-2xl) 0;
}

@media (max-width: 768px) {
    .featured-stories {
        padding: var(--spacing-xl) 0;
    }
}

.stories-slider {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl);
}



/* Latest Updates */
.latest-updates {
    padding: var(--spacing-2xl) 0;
    background-color: var(--surface-color);
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2xl);
}

.content-section {
    background-color: var(--bg-color);
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
}

/* Story List */
.story-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.story-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.story-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.story-item .story-cover {
    width: 120px;
    height: 180px;
    flex-shrink: 0;
    position: relative;
}

.story-item .story-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.story-item .story-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.story-item .story-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.story-item .story-title a {
    color: var(--text-color);
    text-decoration: none;
}

.story-item .story-title a:hover {
    color: var(--primary-color);
}

.story-item .story-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.story-item .story-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.story-item .story-meta i {
    width: 16px;
    color: var(--primary-color);
}

.story-item .update-time {
    margin-top: 8px;
    font-style: italic;
    color: var(--text-secondary);
}

.story-item .update-time i {
    color: #666;
}

/* Pagination (Legacy - kept for backwards compatibility) */
.page-dots {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

/* Categories Section */
.categories-section {
    padding: var(--spacing-2xl) 0;
}

/* Ranking List */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.ranking-item:hover {
    background-color: var(--border-color);
}

.rank {
    background-color: var(--secondary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.ranking-item .story-info {
    flex: 1;
}

.ranking-item h4 {
    margin-bottom: var(--spacing-xs);
}

.ranking-item h4 a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
}

.views {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* Story Grid */
.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-lg);
}

.story-card-small {
    text-align: center;
}

.story-card-small .story-image {
    margin-bottom: var(--spacing-md);
}

.story-card-small .story-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.story-card-small h4 {
    margin-bottom: var(--spacing-sm);
}

.story-card-small h4 a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: var(--font-size-sm);
}



/* View More Button */
.view-more-btn {
    display: inline-block;
    margin-top: var(--spacing-lg);
    padding: var(--spacing-sm) var(--spacing-lg);
    background-color: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
}

.view-more-btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Advertisement */
.advertisement {
    padding: var(--spacing-xl) 0;
    background-color: var(--surface-color);
}

.ad-banner {
    text-align: center;
}

.ad-content p {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    margin-bottom: var(--spacing-sm);
}

.ad-placeholder {
    background-color: var(--border-color);
    border: 2px dashed var(--text-secondary);
    padding: var(--spacing-xl);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-style: italic;
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: white;
    padding: var(--spacing-2xl) 0 var(--spacing-lg);
}

@media (max-width: 768px) {
    .footer {
        padding-bottom: var(--spacing-2xl);
    }
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--spacing-2xl);
    margin-bottom: var(--spacing-xl);
}

@media (max-width: 768px) {
    .footer-content {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-xl);
    }
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
}

.footer-logo i {
    color: var(--secondary-color);
}

.footer-section p {
    margin-bottom: var(--spacing-md);
    opacity: 0.9;
    line-height: 1.6;
}

.footer-section h4 {
    margin-bottom: var(--spacing-md);
    color: white;
    font-weight: 600;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: var(--spacing-sm);
}

.footer-section ul li a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section ul li a:hover {
    color: var(--secondary-color);
}

.social-links {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.contact-info p {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--spacing-lg);
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .main-nav {
        display: none;
        width: 100%;
        order: 3;
        background-color: var(--surface-color);
        box-shadow: var(--shadow);
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1000;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
    
    .main-nav.show {
        display: block;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-actions .search-box {
        display: none;
    }
    
    /* Mobile Navigation Container */
    .nav-container {
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        max-width: 100%;
    }
    
    .nav-container .user-actions {
        padding: 1rem 1.5rem;
        justify-content: center;
        border-top: 1px solid var(--border-color);
    }
    
    /* Mobile Submenu Styles */
    .nav-menu > li {
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu > li:last-child {
        border-bottom: none;
    }
    
    .nav-menu > li > a {
        padding: 1rem 1.5rem;
        width: 100%;
    }
    
    .submenu {
        position: static !important;
        transform: none !important;
        width: 100%;
        background-color: rgba(52, 152, 219, 0.05);
        padding: 0;
        margin: 0;
        box-shadow: none;
        border-radius: 0;
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 0;
        opacity: 1 !important;
        visibility: visible !important;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .nav-menu > li.submenu-open .submenu {
        max-height: 2000px;
        padding: 0.5rem 0;
    }
    
    .submenu li {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    .submenu li:last-child {
        border-bottom: none;
    }
    
    .submenu li a {
        padding: 0.75rem 2.5rem;
        text-align: left;
        font-size: 0.9rem;
        border-radius: 0;
    }
    
    .submenu li a:hover,
    .submenu li a:active {
        background-color: rgba(52, 152, 219, 0.1);
    }
    
    /* Disable hover effect on mobile */
    .nav-menu > li:hover .submenu {
        opacity: 0;
        visibility: hidden;
        display: none;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .stories-slider {
        grid-template-columns: 1fr;
    }
    
    .story-card.featured {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
    
    .hero-content h1 {
        font-size: var(--font-size-3xl);
    }
    
    .container {
        padding: 0 var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .hero {
        padding: var(--spacing-xl) 0;
    }
    
    .hero-content h1 {
        font-size: var(--font-size-2xl);
    }
    
    .hero-content p {
        margin-top: 15px !important;
        font-size: 0.9rem;
    }
    
    .section-title {
        font-size: var(--font-size-lg);
    }
    
    .story-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Font Size Controls */
.font-size-small {
    font-size: 14px;
}

.font-size-medium {
    font-size: 16px;
}

.font-size-large {
    font-size: 18px;
}

.font-size-x-large {
    font-size: 20px;
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
button:focus,
input:focus,
a:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Additional Components */

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--secondary-color);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    z-index: 10000;
    transform: translateX(100%);
    opacity: 0;
    transition: var(--transition);
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.notification-success {
    background-color: var(--success-color);
}

.notification.notification-error {
    background-color: var(--accent-color);
}

.notification.notification-warning {
    background-color: var(--warning-color);
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

/* Anchor to limit search box and dropdown width */
.search-anchor {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    box-shadow: var(--shadow-hover);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    margin-top: -1px;
    animation: dropdownIn 140ms ease-out;
}

.suggestions-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding: calc(var(--spacing-sm) + 2px) var(--spacing-md);
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 1;
}

.suggestions-header .header-left {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--primary-color);
    font-weight: 600;
}

.query-chip {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(52, 152, 219, 0.12);
    color: var(--secondary-color);
    font-size: var(--font-size-sm);
}

.suggestion-group {
    padding: var(--spacing-xs) 0;
}

.group-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: var(--spacing-sm) var(--spacing-md);
}

.suggestion-item {
    display: grid;
    grid-template-columns: 28px 1fr 18px;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-md);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    color: var(--text-color);
    text-decoration: none;
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* Subtle hover, keep text readable */
.suggestion-item:hover {
    background-color: rgba(52, 152, 219, 0.08);
}

.suggestion-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.95rem;
}

/* Icon theme by type */
.suggestion-item.type-story .suggestion-icon {
    color: var(--secondary-color);
    background: rgba(52, 152, 219, 0.12);
}

.suggestion-item.type-author .suggestion-icon {
    color: var(--accent-color);
    background: rgba(231, 76, 60, 0.12);
}

.suggestion-arrow {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.suggestion-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.suggestion-title {
    font-weight: 600;
    font-size: var(--font-size-base);
}

.suggestion-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.suggestion-item:hover .suggestion-subtitle {
    color: var(--text-secondary);
    opacity: 0.95;
}

.suggestion-view-all {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    justify-content: center;
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
}

.suggestion-view-all:hover {
    background: rgba(52, 152, 219, 0.08);
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Continue Reading Badge */
.continue-reading {
    position: absolute;
    top: 15px;
    left: -30px;
    background-color: var(--success-color);
    color: white;
    padding: 2px 8px;
    font-size: var(--font-size-xs);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1;
    transform: rotate(-45deg);
    transform-origin: center;
    width: auto;
    min-width: 80px;
    justify-content: center;
    line-height: 1.2;
    white-space: nowrap;
}

/* Loading Animation */
/* Loading Indicators & Animations */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Navigation Progress Bar */
.navigation-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--secondary-color);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.3s ease-out;
    z-index: 9999;
    box-shadow: 0 0 10px var(--secondary-color);
}

.navigation-progress-bar.active {
    animation: progressBar 2s ease-out forwards;
}

@keyframes progressBar {
    0% {
        transform: scaleX(0);
    }
    50% {
        transform: scaleX(0.7);
    }
    100% {
        transform: scaleX(1);
        opacity: 0;
    }
}

/* Loading Container */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    padding: var(--spacing-xl);
    width: 100%;
}

.loading-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 0.8s linear infinite;
}

.loading-message {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    margin: 0;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Skeleton Loading States */
.skeleton-page,
.skeleton-story-list,
.skeleton-chapter-list {
    width: 100%;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Skeleton Page Layout */
.skeleton-page {
    padding: var(--spacing-xl);
}

.skeleton-header {
    height: 48px;
    background: linear-gradient(90deg, var(--border-color) 25%, var(--surface-color) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-xl);
    width: 60%;
}

.skeleton-content {
    margin-bottom: var(--spacing-xl);
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, var(--border-color) 25%, var(--surface-color) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
}

.skeleton-line.short {
    width: 70%;
}

.skeleton-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-lg);
}

.skeleton-card {
    height: 300px;
    background: linear-gradient(90deg, var(--border-color) 25%, var(--surface-color) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius-lg);
}

/* Skeleton Story List */
.skeleton-story-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    padding: var(--spacing-lg);
}

.skeleton-story-card {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--surface-color);
}

.skeleton-story-cover {
    width: 120px;
    height: 160px;
    flex-shrink: 0;
    background: linear-gradient(90deg, var(--border-color) 25%, var(--surface-color) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius);
}

.skeleton-story-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* Skeleton Chapter List */
.skeleton-chapter-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg);
}

.skeleton-chapter-item {
    height: 48px;
    background: linear-gradient(90deg, var(--border-color) 25%, var(--surface-color) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius);
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Page Transition Effects */
.page-transition-enter {
    animation: pageEnter 0.3s ease-out;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Content Loading State */
.content-loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
}

/* Smooth transitions for dynamic content */
.main-content,
.chapters-section,
.story-info {
    animation: pageEnter 0.4s ease-out;
}

/* Mobile Menu Animation */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Chapter Reading Mode */
.reading-mode .chapter-content {
    font-size: 18px;
    line-height: 2;
    color: var(--text-color);
}

.reading-mode .chapter-content p {
    margin-bottom: var(--spacing-xl);
}

/* Chapter Content Media Constraints */
.chapter-content img,
.chapter-content svg,
.chapter-content iframe,
.chapter-content video,
.chapter-content canvas,
.chapter-content embed,
.chapter-content object {
    max-width: min(100%, calc(100vw - 2 * var(--spacing-sm, 0.5rem)));
    width: auto;
    height: auto !important;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.chapter-content table,
.chapter-content pre {
    max-width: 100%;
    width: 100%;
    overflow-x: auto;
    display: block;
}

.chapter-content figure,
.chapter-content blockquote,
.chapter-content div,
.chapter-content section {
    max-width: 100%;
}

@media (max-width: 768px) {
    .chapter-content img,
    .chapter-content svg,
    .chapter-content iframe,
    .chapter-content video,
    .chapter-content canvas,
    .chapter-content embed,
    .chapter-content object {
        width: 100%;
        max-width: 100%;
    }
}

/* Story Card Hover Effects */
.story-card:hover .story-image img {
    transform: scale(1.05);
}

.story-item:hover .story-thumbnail img {
    transform: scale(1.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-color);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .advertisement,
    .reading-controls,
    .chapter-navigation,
    .comments-section {
        display: none !important;
    }
    
    .chapter-content {
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: black;
        background: white;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #333333;
        --shadow: 0 2px 10px rgba(0,0,0,0.5);
    }
    
    [data-theme="dark"] {
        --border-color: #ffffff;
        --text-secondary: #cccccc;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Large Text Mode */
@media (min-resolution: 192dpi) {
    body {
        font-size: 18px;
    }
    
    .story-card-title {
        font-size: var(--font-size-xl);
    }
    
    .chapter-content {
        font-size: 20px;
        line-height: 1.8;
    }
}

/* Dark Mode Specific Adjustments */
[data-theme="dark"] .story-image img {
    opacity: 0.9;
}

[data-theme="dark"] .ad-placeholder {
    background-color: var(--surface-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .search-suggestions {
    background-color: var(--surface-color);
    border-color: var(--border-color);
}

/* Dark theme adjustments for hover chips */
[data-theme="dark"] .suggestion-item:hover {
    background-color: rgba(52, 152, 219, 0.18);
}

[data-theme="dark"] .query-chip {
    background: rgba(52, 152, 219, 0.2);
}

/* Dark Theme - Logo and Site Title */
[data-theme="dark"] .logo a {
    color: var(--text-color);
}

[data-theme="dark"] .logo i {
    color: var(--secondary-color);
}

/* Dark Theme - Section Titles */
[data-theme="dark"] .section-title {
    color: var(--text-color);
}

[data-theme="dark"] .section-title i {
    color: var(--secondary-color);
}

/* Dark Theme - Navigation Menu */
[data-theme="dark"] .nav-menu > li > a {
    color: var(--text-color);
}

[data-theme="dark"] .nav-menu > li:hover > a {
    color: var(--secondary-color);
}

[data-theme="dark"] .nav-menu > li.active > a {
    color: var(--secondary-color);
}

[data-theme="dark"] .submenu {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .submenu li a {
    color: var(--text-color);
}

[data-theme="dark"] .submenu li a:hover {
    background-color: rgba(52, 152, 219, 0.15);
    color: var(--secondary-color);
}

@media (max-width: 768px) {
    [data-theme="dark"] .submenu {
        background-color: rgba(52, 152, 219, 0.08);
        border: none;
    }
    
    [data-theme="dark"] .submenu li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    [data-theme="dark"] .submenu li a:hover,
    [data-theme="dark"] .submenu li a:active {
        background-color: rgba(52, 152, 219, 0.15);
    }
}

/* Dark Theme - Breadcrumb */
[data-theme="dark"] .breadcrumb {
    color: var(--text-secondary);
}

[data-theme="dark"] .breadcrumb a {
    color: var(--secondary-color);
}

[data-theme="dark"] .breadcrumb a:hover {
    color: var(--text-color);
    text-decoration: underline;
}

[data-theme="dark"] .breadcrumb span {
    color: var(--text-secondary);
}

/* Dark Theme - Chapter Header */
[data-theme="dark"] .chapter-header {
    background-color: var(--bg-color);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .chapter-title h1 {
    color: var(--text-color);
}

[data-theme="dark"] .chapter-meta-item {
    color: var(--text-secondary);
}

[data-theme="dark"] .chapter-meta-item i {
    color: var(--secondary-color);
}

[data-theme="dark"] .chapter-meta-item .novel-title-link {
    color: var(--secondary-color);
}

[data-theme="dark"] .chapter-meta-item .novel-title-link:hover {
    color: var(--text-color);
}

/* Legacy support for old chapter-subtitle (if still used elsewhere) */
[data-theme="dark"] .chapter-subtitle {
    color: var(--text-secondary);
}

[data-theme="dark"] .chapter-subtitle a {
    color: var(--secondary-color);
}

[data-theme="dark"] .chapter-subtitle a:hover {
    color: var(--text-color);
}

/* Dark Theme - Story Cards */
[data-theme="dark"] .story-card {
    background-color: var(--surface-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .story-card:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

[data-theme="dark"] .story-item {
    background-color: var(--surface-color);
}

[data-theme="dark"] .story-item:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

[data-theme="dark"] .story-item .story-title a {
    color: var(--text-color);
}

[data-theme="dark"] .story-item .story-title a:hover {
    color: var(--secondary-color);
}

/* Dark Theme - Chapter Content */
[data-theme="dark"] .chapter-content {
    color: var(--text-color);
}

[data-theme="dark"] .chapter-content p {
    color: var(--text-color);
}

/* Dark Theme - Reading Controls */
[data-theme="dark"] .reading-controls {
    background-color: var(--surface-color);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .control-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

[data-theme="dark"] .control-btn:hover {
    background-color: var(--secondary-color);
    color: white;
}

[data-theme="dark"] .nav-btn-top {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

[data-theme="dark"] .nav-btn-top:hover {
    background-color: var(--secondary-color);
    color: white;
}

[data-theme="dark"] .nav-btn-top.disabled {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Dark Theme - Chapter Title (for chapter page) */
[data-theme="dark"] .chapter-title {
    color: var(--text-color);
}

/* Dark Theme - Chapter header section */
[data-theme="dark"] section.chapter-header {
    color: var(--text-color);
}

[data-theme="dark"] section.chapter-header .chapter-title h1 {
    color: var(--text-color) !important;
}

/* Dark Theme - Latest Updates Section */
[data-theme="dark"] .update-col-chapter a {
    color: var(--secondary-color);
}

[data-theme="dark"] .update-col-chapter a:hover {
    color: var(--text-color);
    text-decoration: underline;
}

/* Dark Theme - Chapter count and info */
[data-theme="dark"] .chapter-info {
    color: var(--text-color);
}

[data-theme="dark"] .chapter-count {
    color: var(--text-color);
}

[data-theme="dark"] .chapter-count strong {
    color: var(--text-color);
}

/* Dark Theme - Font size display */
[data-theme="dark"] .font-size-display {
    color: var(--text-color);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Dark Theme - Story Detail Page */
[data-theme="dark"] .story-details h1 {
    color: var(--text-color);
}

[data-theme="dark"] .story-details .story-title {
    color: var(--text-color);
}

[data-theme="dark"] .story-info {
    background-color: var(--surface-color);
}

[data-theme="dark"] .story-info-header {
    color: var(--text-color);
}

[data-theme="dark"] .story-description h3 {
    color: var(--text-color);
}

[data-theme="dark"] .story-description {
    color: var(--text-secondary);
}

[data-theme="dark"] .description-content::after {
    background: linear-gradient(to bottom, transparent, var(--surface-color));
}

[data-theme="dark"] .btn-see-more {
    background-color: var(--primary-color);
    color: white;
}

[data-theme="dark"] .btn-see-more:hover {
    background-color: var(--primary-hover);
}

[data-theme="dark"] .story-meta .meta-label {
    color: var(--text-secondary);
}

[data-theme="dark"] .story-meta .meta-value {
    color: var(--text-color);
}

[data-theme="dark"] .story-meta .author-link {
    color: var(--secondary-color);
}

[data-theme="dark"] .story-meta .author-link:hover {
    color: var(--text-color);
}

/* Dark Theme - Story Title (for story cards) */
[data-theme="dark"] .story-title a {
    color: var(--text-color);
}

[data-theme="dark"] .story-title a:hover {
    color: var(--secondary-color);
}

/* Dark Theme - Chapters Section */
[data-theme="dark"] .chapters-section h2 {
    color: var(--text-color);
}

[data-theme="dark"] .chapters-list {
    color: var(--text-color);
}

[data-theme="dark"] .chapter-item {
    background-color: var(--surface-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .chapter-item:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

[data-theme="dark"] .chapter-item .chapter-title a {
    color: var(--secondary-color);
}

[data-theme="dark"] .chapter-item .chapter-title a:hover {
    color: var(--text-color);
}

[data-theme="dark"] .chapter-item .chapter-time {
    color: var(--text-secondary);
}

/* Loading States */
.story-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.story-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error States */
.error-message {
    background-color: var(--accent-color);
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    margin: var(--spacing-md) 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.error-message i {
    font-size: var(--font-size-lg);
}

/* Success States */
.success-message {
    background-color: var(--success-color);
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    margin: var(--spacing-md) 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--surface-color) 25%, var(--border-color) 50%, var(--surface-color) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: 4px;
}

.skeleton-title {
    height: 1.5em;
    width: 80%;
    margin-bottom: 1em;
    border-radius: 4px;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: var(--border-radius);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.hidden { display: none !important; }
.visible { display: block !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--spacing-sm) !important; }
.mt-2 { margin-top: var(--spacing-md) !important; }
.mt-3 { margin-top: var(--spacing-lg) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--spacing-sm) !important; }
.mb-2 { margin-bottom: var(--spacing-md) !important; }
.mb-3 { margin-bottom: var(--spacing-lg) !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: var(--spacing-sm) !important; }
.p-2 { padding: var(--spacing-md) !important; }
.p-3 { padding: var(--spacing-lg) !important; }

.flex { display: flex !important; }
.flex-center { 
    display: flex !important; 
    align-items: center !important; 
    justify-content: center !important; 
}

.w-full { width: 100% !important; }
.h-full { height: 100% !important; }

.rounded { border-radius: var(--border-radius) !important; }
.rounded-lg { border-radius: var(--border-radius-lg) !important; }

.shadow { box-shadow: var(--shadow) !important; }
.shadow-hover { box-shadow: var(--shadow-hover) !important; }

/* Responsive Utilities */
@media (max-width: 640px) {
    .sm-hidden { display: none !important; }
    .sm-visible { display: block !important; }
}

@media (max-width: 768px) {
    .md-hidden { display: none !important; }
    .md-visible { display: block !important; }
}

@media (max-width: 1024px) {
    .lg-hidden { display: none !important; }
    .lg-visible { display: block !important; }
}

/* Featured Stories Grid */
.featured-grid {
    display: grid;
    gap: var(--spacing-lg);
}

.featured-row {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: var(--spacing-md);
}

.story-card-mini {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.story-card-mini:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}



.story-card-mini:hover .story-cover img {
    transform: scale(1.05);
}



/* New Stories Section */
.new-stories-section {
    padding: var(--spacing-xl) 0;
    background-color: var(--background-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
}

.view-all-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    background-color: var(--secondary-color);
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.view-all-btn:hover {
    background-color: var(--primary-color);
}

.new-stories-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.new-stories-row {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: var(--spacing-md);
}

/* Main Layout */
.main-layout {
    padding: var(--spacing-xl) 0;
    background-color: var(--surface-color);
}

@media (max-width: 768px) {
    .main-layout {
        padding: var(--spacing-lg) 0;
    }
}

.layout-grid {
    display: grid;
    grid-template-columns: 70% 30%;
    gap: var(--spacing-xl);
}

@media (max-width: 992px) {
    .layout-grid {
        grid-template-columns: 100%;
    }
}

@media (max-width: 768px) {
    .layout-grid {
        gap: var(--spacing-lg);
    }
}

.main-content-area {
    background: var(--background-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow);
}

@media (max-width: 768px) {
    .main-content-area {
        padding: var(--spacing-md);
        border-radius: 12px;
    }
}

/* Updates Grid */
.updates-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.updates-grid-item {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.updates-grid-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.update-info {
    margin-bottom: var(--spacing-sm);
}

.update-info .story-name {
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    font-size: var(--font-size-sm);
    line-height: 1.3;
    display: block;
    margin-bottom: var(--spacing-xs);
}

.update-info .story-name:hover {
    color: var(--secondary-color);
}

.update-info .genre-tag {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    background-color: rgba(74, 144, 226, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Chapter info for story cards/listings (not chapter navigation) */
.story-card .chapter-info,
.story-item .chapter-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-xs);
}

.story-card .chapter-info a,
.story-item .chapter-info a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.story-card .chapter-info a:hover,
.story-item .chapter-info a:hover {
    text-decoration: underline;
}

.update-time {
    color: var(--text-secondary);
}

/* Updates Table */
.updates-table {
    background-color: var(--surface-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

@media (max-width: 768px) {
    .updates-table {
        border-radius: 16px;
        box-shadow: none;
        border: 1px solid rgba(0, 0, 0, 0.05);
        background-color: white;
    }
}

.updates-header {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr 1fr;
    gap: var(--spacing-md);
    background-color: var(--secondary-color);
    color: white;
    padding: var(--spacing-lg);
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
}

.updates-row {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr 1fr;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

@media (max-width: 768px) {
    .updates-row {
        grid-template-columns: 1fr;
        gap: var(--spacing-xs);
        padding: var(--spacing-md);
    }
}

.update-col-name {
    min-width: 0; /* Allow ellipsis to work in CSS Grid */
}

.update-col-name a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.update-col-name a:hover {
    color: var(--secondary-color);
}

.update-col-genre {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

@media (max-width: 768px) {
    .update-col-genre {
        font-size: var(--font-size-xs);
        color: var(--text-color);
        order: 3;
    }
}

.update-col-chapter a {
    color: var(--primary-color);
    text-decoration: none;
}

@media (max-width: 768px) {
    .update-col-chapter a {
        font-size: var(--font-size-sm);
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        gap: var(--spacing-xs);
    }
}

.update-col-time {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

@media (max-width: 768px) {
    .update-col-time {
        font-size: var(--font-size-xs);
        color: var(--text-secondary);
        order: 2;
    }
}

/* Story Meta 2-Column Layout for story.html */
.story-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md) var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

/* Balance story-chapters and story-genres for listing pages */
.story-chapters,
.story-genres {
    flex: 1;
    min-width: 0;
}

/* Responsive adjustments for completed stories grid */
@media (max-width: 1200px) {
    .completed-stories-row {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .story-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .completed-stories-row {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .updates-header,
    .updates-row {
        grid-template-columns: 2fr 1fr 1fr 1fr;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .story-meta {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    /* Story Page Mobile Layout */
    .story-layout {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .story-left-column {
        display: contents;
    }
    
    .story-main-info {
        order: 1;
        flex-direction: column;
        gap: 1rem;
    }
    
    .story-main-info .story-cover {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .story-description {
        order: 2;
    }
    
    .story-actions {
        order: 3;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .description-content:not(.expanded) {
        -webkit-line-clamp: 8;
        line-clamp: 8;
    }
    
    .story-actions button,
    .story-actions a {
        flex: 1 1 calc(50% - 0.375rem);
        min-width: 120px;
        justify-content: center;
        font-size: 0.85rem;
        padding: 0.75rem 0.5rem;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
        margin-top: 20px !important;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-box button {
        border-radius: 0 0 8px 8px;
    }
    
    .story-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .submenu {
        width: 90vw;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .completed-stories-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .updates-header,
    .updates-row {
        grid-template-columns: 1fr;
        gap: var(--spacing-xs);
    }
    
    .updates-header {
        display: none;
    }
    
    .updates-row {
        display: flex;
        flex-direction: column;
        padding: var(--spacing-md);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        margin-bottom: var(--spacing-sm);
    }
    
    .story-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .story-cover {
        height: 150px;
    }
    
    .story-info {
        padding: 0.75rem;
    }
    
    .story-title {
        font-size: 0.85rem;
    }
    
    .story-meta {
        font-size: 0.75rem;
    }
    
    .submenu {
        grid-template-columns: 1fr;
    }
    
    .user-actions {
        gap: 0.25rem;
    }
    
    .user-actions button {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .sidebar {
        margin-top: 2rem;
    }
    
    .reading-item-no-image {
        padding: 0.6rem;
    }
    
    .reading-info {
        gap: 0.25rem;
    }
    
    .reading-title {
        font-size: 0.85rem;
    }
    
    .reading-progress {
        font-size: 0.75rem;
    }
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 40px 0;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    min-width: 40px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-family);
}

.page-btn:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.page-btn.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.page-btn.next {
    font-weight: 600;
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination span {
    color: var(--text-secondary);
    padding: 10px 5px;
}

/* Completed Stories Section */
.completed-stories {
    margin: var(--spacing-2xl) 0;
}

.completed-stories-row {
    display: flex;
    gap: var(--spacing-md);
    overflow-x: auto;
    padding: var(--spacing-md) 0;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.completed-stories-row::-webkit-scrollbar {
    height: 6px;
}

.completed-stories-row::-webkit-scrollbar-track {
    background: var(--surface-color);
    border-radius: 3px;
}

.completed-stories-row::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 3px;
}

.completed-story-card {
    flex: 0 0 auto;
    width: 200px;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.completed-story-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.completed-story-cover {
    position: relative;
    width: 100%;
    height: 120px;
    margin-bottom: var(--spacing-sm);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.completed-story-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.completed-story-card:hover .completed-story-cover img {
    transform: scale(1.05);
}

.completed-story-info {
    text-align: left;
}

.completed-story-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.completed-story-title a {
    color: var(--text-color);
    text-decoration: none;
}

.completed-story-title a:hover {
    color: var(--secondary-color);
}

.completed-story-chapters {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .completed-stories-row {
        gap: var(--spacing-sm);
    }
    
    .completed-story-card {
        width: 160px;
    }
    
    .completed-story-cover {
        height: 100px;
    }
}

@media (max-width: 480px) {
    .completed-story-card {
        width: 140px;
    }
    
    .completed-story-cover {
        height: 90px;
    }
}

/* Image handling */
.story-cover img,
.completed-story-cover img {
    background: var(--surface-color);
    min-height: 100%;
    opacity: 1 !important;
    visibility: visible !important;
}

.story-cover img[src*="default-cover"],
.completed-story-cover img[src*="default-cover"] {
    object-fit: contain;
    padding: var(--spacing-sm);
    background: var(--surface-color);
    border: 1px dashed var(--border-color);
}

.story-cover.loading img,
.completed-story-cover.loading img {
    opacity: 1;
}

.story-cover.error img,
.completed-story-cover.error img {
    opacity: 0.7;
}

/* Image loading animation */
@keyframes imageLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.story-cover.loading::before,
.completed-story-cover.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--surface-color) 25%,
        var(--border-color) 50%,
        var(--surface-color) 75%
    );
    background-size: 200% 100%;
    animation: imageLoading 1.5s infinite;
    z-index: 1;
}

/* Stories Grid Layout - Homepage */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Stories List Layout - Category Pages */
.stories-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.story-list-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--surface-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    height: 100%;
}

.story-list-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.story-list-cover {
    flex: 0 0 120px;
    position: relative;
}

.story-list-cover img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.story-list-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.story-list-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    min-height: 2.6em; /* 2 lines * 1.3 line-height */
    max-height: 2.6em;
}

.story-list-title a {
    color: var(--text-color);
    text-decoration: none;
}

.story-list-title a:hover {
    color: var(--secondary-color);
}

.story-list-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
    margin-top: auto;
    font-size: var(--font-size-sm);
}

.story-list-meta span {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--text-secondary);
}

.story-list-meta i {
    color: var(--secondary-color);
}

/* Categories Widget */
.categories-widget {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.category-link {
    display: block;
    padding: var(--spacing-sm);
    background: var(--bg-color);
    border-radius: var(--border-radius);
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
    text-align: center;
    border: 1px solid var(--border-color);
}

.category-link:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .stories-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(3, auto);
    }
    
    .stories-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stories-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(4, auto);
    }
    
    .story-list-item {
        flex-direction: column;
    }
    
    .story-list-cover {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .story-list-meta {
        grid-template-columns: 1fr;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stories-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(6, auto);
    }
}

/* Hot Stories Layout */
.hot-stories-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
    overflow: visible;
}

.hot-story-item {
    position: relative;
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--surface-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    height: 100%;
    overflow: visible;
}

.hot-story-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.hot-story-cover {
    flex: 0 0 135px;
    position: relative;
    height: 200px;
    overflow: hidden;
}

.hot-story-cover .cover-image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.hot-story-cover img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.hot-story-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.hot-story-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    min-height: 2.6em; /* 2 lines * 1.3 line-height */
    max-height: 2.6em;
}

.hot-story-title a {
    color: var(--text-color);
    text-decoration: none;
}

.hot-story-title a:hover {
    color: var(--secondary-color);
}

.hot-story-meta {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.hot-story-meta span {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.hot-story-meta i {
    color: var(--secondary-color);
    width: 16px;
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .hot-stories-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hot-story-item {
        flex-direction: column;
    }
    
    .hot-story-cover {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.view-all {
    background-color: #3498db;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-all:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

/* Reading History Widget */
.reading-history-widget {
    background-color: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.reading-history-widget .widget-title {
    font-size: 1.2rem;
    margin: 0 0 1rem;
    color: #333;
}

.reading-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.reading-history-item {
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.reading-history-item:last-child {
    border-bottom: none;
}

.reading-history-item:hover {
    background-color: #f8f9fa;
}

.reading-history-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.reading-history-title a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.reading-history-title a:hover {
    color: #3498db;
}

.reading-history-chapter {
    color: #666;
    font-size: 0.85rem;
}

/* Reading List in Sidebar */
.reading-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.reading-item-no-image {
    background-color: #fff;
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 3px solid #3498db;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.reading-item-no-image:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    border-left-color: #2980b9;
}

.reading-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.reading-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    text-decoration: none;
    line-height: 1.3;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reading-title:hover {
    color: #3498db;
}

.reading-progress {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
    flex-shrink: 0;
    text-decoration: none;
    transition: all 0.3s ease;
}

.reading-progress:hover {
    color: #3498db;
    text-decoration: underline;
}

/* Sidebar Styles */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (max-width: 768px) {
    .sidebar {
        gap: var(--spacing-lg);
    }
}

.sidebar-section {
    background-color: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

@media (max-width: 768px) {
    .sidebar-section {
        padding: var(--spacing-md);
        border-radius: 12px;
        box-shadow: none;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--spacing-sm);
    }
}

.reading-item-no-image {
    background-color: #fff;
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 3px solid #3498db;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .reading-item-no-image {
        padding: var(--spacing-sm);
    }
}

.reading-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .reading-info {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
    }
}

.reading-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    text-decoration: none;
    line-height: 1.3;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .reading-title {
        font-size: var(--font-size-base);
        white-space: normal;
    }
}

.reading-progress {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
    flex-shrink: 0;
    text-decoration: none;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .reading-progress {
        font-size: var(--font-size-sm);
    }
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: white;
    padding: var(--spacing-2xl) 0 var(--spacing-lg);
}

@media (max-width: 768px) {
    .footer {
        padding-bottom: var(--spacing-2xl);
    }
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--spacing-2xl);
    margin-bottom: var(--spacing-xl);
}

@media (max-width: 768px) {
    .footer-content {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-xl);
    }
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
}

.footer-logo i {
    color: var(--secondary-color);
}

.footer-section p {
    margin-bottom: var(--spacing-md);
    opacity: 0.9;
    line-height: 1.6;
}

.footer-section h4 {
    margin-bottom: var(--spacing-md);
    color: white;
    font-weight: 600;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: var(--spacing-sm);
}

.footer-section ul li a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section ul li a:hover {
    color: var(--secondary-color);
}

.social-links {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.contact-info p {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--spacing-lg);
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 768px) {
    .footer-bottom {
        text-align: center;
    }
}

/* Utility */
.d-flex {
    display: flex !important;
}

@media (max-width: 480px) {
    .d-flex {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Responsive Utilities */
.stack-sm {
    display: flex;
    gap: var(--spacing-md);
}

.stack-sm > * {
    flex: 1;
}

@media (max-width: 768px) {
    .stack-sm {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
}

.grid-responsive {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-responsive.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-responsive.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-responsive.auto {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

@media (max-width: 992px) {
    .grid-responsive.two,
    .grid-responsive.three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .grid-responsive.two,
    .grid-responsive.three,
    .grid-responsive.auto {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: var(--spacing-md);
    }
}

.responsive-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-radius: var(--border-radius-lg);
    scrollbar-width: thin;
    background: var(--surface-color);
}

.responsive-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.responsive-table thead {
    background: var(--secondary-color);
    color: white;
}

.responsive-table th,
.responsive-table td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
}

@media (max-width: 768px) {
    .responsive-table {
        border-radius: 16px;
    }

    .responsive-table table {
        min-width: 100%;
    }
}

.responsive-form {
    display: grid;
    gap: var(--spacing-lg);
}

@media (max-width: 768px) {
    .responsive-form {
        gap: var(--spacing-md);
    }
}

.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.pill-list .pill-item {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
}

@media (max-width: 768px) {
    .pill-list {
        gap: var(--spacing-xs);
    }

    .pill-list .pill-item {
        font-size: var(--font-size-xs);
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}

/* ============================================
   Chapter Header & Meta Information
   ============================================ */

/* Chapter Header Section */
.chapter-header {
    background-color: var(--surface-color);
    padding: var(--spacing-xl) 0;
    border-bottom: 1px solid var(--border-color);
}

.chapter-title {
    text-align: center;
}

.chapter-title h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: var(--spacing-md);
    line-height: 1.3;
}

/* Chapter Meta Information (Stacked Layout) */
.chapter-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.chapter-meta-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    line-height: 1.5;
}

.chapter-meta-item i {
    color: var(--secondary-color);
    font-size: var(--font-size-sm);
}

.chapter-meta-item .novel-title-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-size-lg);
    transition: var(--transition);
}

.chapter-meta-item .novel-title-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Mobile Responsive for Chapter Header */
@media (max-width: 768px) {
    .chapter-header {
        padding: var(--spacing-lg) 0;
    }

    .chapter-title h1 {
        font-size: var(--font-size-2xl);
        margin-bottom: var(--spacing-sm);
    }

    .chapter-meta {
        gap: var(--spacing-xs);
    }

    .chapter-meta-item {
        font-size: var(--font-size-sm);
    }

    .chapter-meta-item .novel-title-link {
        font-size: var(--font-size-base);
    }
}

/* ============================================
   Chapter Reading Controls
   ============================================ */

/* Reading Controls Section */
.reading-controls {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.controls-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Control Buttons (Font size +/-) */
.control-btn {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: var(--font-size-base);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

.control-btn:hover {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.control-btn:active {
    transform: scale(0.95);
}

/* Font Size Display */
.font-size-display {
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-color);
    min-width: 60px;
    text-align: center;
}

/* Navigation Buttons (Chapter prev/next/list) */
.nav-btn-top {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    white-space: nowrap;
}

.nav-btn-top:hover {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.nav-btn-top:active {
    transform: scale(0.95);
}

.nav-btn-top.disabled {
    background-color: var(--surface-color);
    color: var(--text-secondary);
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .reading-controls {
        padding: var(--spacing-sm) 0;
    }

    .controls-container {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    /* Font size controls - keep as is on mobile */
    .control-group:first-child {
        width: 100%;
        justify-content: center;
    }

    /* Navigation group - make buttons equal width and hide text on middle button */
    .control-group-navigation {
        width: 100%;
        justify-content: space-between;
        gap: var(--spacing-xs);
    }

    .control-group-navigation .nav-btn-top {
        flex: 1;
        justify-content: center;
        padding: var(--spacing-sm);
        min-height: 44px; /* Touch-friendly size */
    }

    /* Hide text on mobile, keep icon */
    .control-group-navigation .nav-btn-top .nav-btn-text {
        display: inline;
    }

    /* Hide text only on the chapter list button in mobile */
    .control-group-navigation .nav-btn-chapter-list .nav-btn-text {
        display: none;
    }

    .control-group-navigation .nav-btn-chapter-list {
        flex: 0 0 auto;
        min-width: 44px;
        padding: var(--spacing-sm);
    }

    /* Action buttons (fullscreen, share, report) - keep visible but smaller */
    .control-group:last-child {
        width: 100%;
        justify-content: center;
    }

    .control-btn {
        min-width: 44px;
        height: 44px;
        padding: var(--spacing-sm);
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .controls-container {
        gap: var(--spacing-sm);
    }

    .nav-btn-top {
        padding: var(--spacing-sm);
        font-size: var(--font-size-sm);
    }
}

/* ============================================
   Chapter Bottom Navigation
   ============================================ */

/* Chapter Navigation Section (Bottom) */
.chapter-navigation {
    background-color: var(--surface-color);
    padding: var(--spacing-xl) 0;
    margin: var(--spacing-2xl) 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.nav-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
}

/* Navigation Buttons */
.nav-btn {
    background-color: var(--secondary-color);
    color: white;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-size-base);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    transition: var(--transition);
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.nav-btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.nav-btn:active {
    transform: translateY(0);
}

.nav-btn.disabled {
    background-color: var(--surface-color);
    color: var(--text-secondary);
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    border: 1px solid var(--border-color);
}

/* Chapter Info (Center) */
.chapter-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    text-align: center;
}

.chapter-count {
    font-size: var(--font-size-lg);
    color: var(--text-color);
}

.chapter-count strong {
    color: var(--primary-color);
    font-size: var(--font-size-xl);
}

/* Mobile Responsive Styles for Bottom Navigation */
@media (max-width: 768px) {
    .chapter-navigation {
        padding: var(--spacing-md) 0;
        margin: var(--spacing-lg) 0;
    }

    .nav-buttons {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--spacing-xs);
        flex-wrap: nowrap; /* Keep all three items on same line */
    }

    .nav-btn {
        flex: 1;
        padding: var(--spacing-sm) var(--spacing-xs);
        font-size: var(--font-size-sm);
        min-height: 44px; /* Touch-friendly */
        justify-content: center;
        gap: var(--spacing-xs);
    }

    .nav-btn i {
        font-size: var(--font-size-sm);
    }

    /* Chapter info takes minimal space in mobile */
    .chapter-info {
        flex: 0 0 auto;
        gap: 0;
        padding: 0 var(--spacing-xs);
    }

    .chapter-count {
        font-size: var(--font-size-sm);
        white-space: nowrap;
    }

    .chapter-count strong {
        font-size: var(--font-size-base);
    }
}

/* Tablet adjustments for bottom navigation */
@media (min-width: 769px) and (max-width: 1024px) {
    .nav-btn {
        padding: var(--spacing-sm) var(--spacing-lg);
        font-size: var(--font-size-sm);
    }
}


