/* Global Variables & Design Tokens */
:root {
    /* Color Palette - HSL for easy manipulation */
    --primary-h: 220;
    --primary-s: 90%;
    --primary-l: 56%;
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-hover: hsl(var(--primary-h), var(--primary-s), 46%);
    --primary-light: hsl(var(--primary-h), var(--primary-s), 95%);

    --secondary-h: 280;
    --secondary-s: 80%;
    --secondary-l: 60%;
    --secondary: hsl(var(--secondary-h), var(--secondary-s), var(--secondary-l));

    --bg-body: #f8f9fa;
    --bg-surface: #ffffff;
    --bg-surface-glass: rgba(255, 255, 255, 0.8);
    
    --text-main: #1a1a1a;
    --text-muted: #666666;
    --text-light: #999999;

    --border-color: #e9ecef;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary);
}

img {
    max-width: 100%;
    display: block;
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(var(--primary-h), var(--primary-s), var(--primary-l), 0.3);
}

.btn-secondary {
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.tag.hot { background: #ffebeb; color: #ff4d4f; }
.tag.recommend { background: #e6f7ff; color: #1890ff; }
.tag.vip { background: #fff7e6; color: #fa8c16; }

/* Components */

/* Header */
.header {
    background: var(--bg-surface-glass);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.8rem 0;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav {
    display: flex;
    gap: 20px;
}

.nav a {
    font-weight: 500;
    color: var(--text-muted);
}

.nav a:hover, .nav a.active {
    color: var(--primary);
}

.search-box form {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 20px; /* Pill shape */
    overflow: hidden;
    background: var(--bg-surface);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-box input {
    border: none;
    padding: 0.5rem 1rem;
    outline: none;
    width: 200px;
    background: transparent;
}

.search-box button {
    border: none;
    background: transparent;
    padding: 0 1rem;
    color: var(--text-muted);
    cursor: pointer;
}

.search-box button:hover {
    color: var(--primary);
}

/* Hero / Announcements */
.announcement-section {
    margin: 20px 0;
    background: #fff;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
}

.announcement-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Sections */
.category-section, .hot-section, .latest-section, .related-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    position: relative;
    padding-left: 15px;
}

.section-header h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 1.2rem;
    background: var(--primary);
    border-radius: 2px;
}

.more {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Novel Grid */
.novel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); /* Responsive grid */
    gap: 20px;
}

.novel-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 10px;
    transition: transform 0.3s, box-shadow 0.3s;
    height: 100%;
}

.novel-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.novel-card .cover {
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 3/4;
    margin-bottom: 10px;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.novel-card .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.novel-card:hover .cover img {
    transform: scale(1.05); /* Zoom effect */
}

.novel-card h3 {
    font-size: 1rem;
    margin-bottom: 4px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.novel-card .author {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Book Detail */
.breadcrumb {
    padding: 15px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.book-detail {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 30px;
    margin-bottom: 30px;
}

.book-info {
    display: flex;
    gap: 30px;
}

.book-info .cover {
    width: 200px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.book-info .info {
    flex: 1;
}

.book-info h1 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.book-info .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.book-info .meta span {
    color: var(--text-light);
}

.book-info .tags {
    margin-bottom: 20px;
}

.book-info .description {
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    color: #444;
}

.book-info .actions {
    display: flex;
    gap: 15px;
}

/* Chapter List */
.chapter-list-section {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 30px;
}

.chapter-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.chapter-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: #fcfcfc;
    border: 1px solid transparent;
}

.chapter-item:hover {
    background: #fff;
    border-color: var(--border-color);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.chapter-item .time {
    color: var(--text-light);
    font-size: 0.8rem;
}

/* Read Page */
.read-container {
    max-width: 900px;
    margin: 30px auto;
    background: var(--bg-surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    min-height: 80vh;
}

.read-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.read-content {
    font-size: 18px;
    line-height: 1.8;
    color: #333;
    font-family: 'Merriweather', serif; /* Better for reading */
}

/* Footer */
.footer {
    background: #2b2d42;
    color: #8d99ae;
    padding: 40px 0;
    margin-top: 60px;
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .book-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .book-info .meta {
        justify-content: center;
    }
    
    .book-info .actions {
        justify-content: center;
    }
}
