/* MangaBox - Dark Theme */
:root {
    --bg: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-hover: #222240;
    --text: #e4e4e7;
    --text-muted: #9ca3af;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --border: #2a2a3e;
    --success: #22c55e;
    --warning: #f59e0b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }

/* Navbar */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 0;
}

.nav-content {
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.nav-links { display: flex; gap: 16px; }
.nav-links a { color: var(--text-muted); transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }

.search-box {
    position: relative;
    margin-left: auto;
    flex: 0 1 320px;
}

.search-box input {
    width: 100%;
    padding: 8px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.search-box input:focus { border-color: var(--accent); }

.search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 200;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.search-item:hover { background: var(--bg-hover); }
.search-item img { border-radius: 4px; object-fit: cover; }
.search-item strong { display: block; font-size: 14px; }
.search-type { font-size: 12px; color: var(--text-muted); text-transform: capitalize; }

/* Sections */
.section { margin: 32px 0; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h1, .section-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.see-all {
    color: var(--accent);
    font-size: 14px;
    transition: opacity 0.2s;
}

.see-all:hover { opacity: 0.8; }

/* Manga Grid */
.manga-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.manga-card { transition: transform 0.2s; }
.manga-card:hover { transform: translateY(-4px); }

.manga-cover {
    position: relative;
    aspect-ratio: 5/7;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
}

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

.manga-type {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.manga-status {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.manga-status.completed { background: var(--success); color: white; }

.manga-info { padding: 8px 0; }

.manga-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.manga-chapter, .manga-views {
    font-size: 12px;
    color: var(--text-muted);
}

/* Manga Detail Page */
.manga-detail {
    display: flex;
    gap: 24px;
    margin: 24px 0;
}

.manga-detail-cover {
    flex-shrink: 0;
    width: 220px;
}

.manga-detail-cover img {
    width: 100%;
    border-radius: 8px;
}

.manga-detail-info { flex: 1; }
.manga-detail-info h1 { font-size: 1.5rem; margin-bottom: 8px; }

.manga-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.meta-tag {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.meta-tag.genre { background: var(--accent); color: white; border-color: var(--accent); }

.manga-description {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 16px 0;
}

/* Chapter List */
.chapter-list { margin: 24px 0; }
.chapter-list h2 { font-size: 1.2rem; margin-bottom: 12px; }

.chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.chapter-item:hover { background: var(--bg-card); }
.chapter-item a { flex: 1; }
.chapter-date { font-size: 12px; color: var(--text-muted); }

/* Reader */
.reader-container {
    max-width: 900px;
    margin: 0 auto;
    background: #000;
    min-height: 100vh;
}

.reader-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.reader-nav select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
}

.reader-nav a, .reader-nav button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.reader-nav a.disabled { opacity: 0.3; pointer-events: none; }

.reader-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.reader-pages img {
    width: 100%;
    max-width: 900px;
    display: block;
}

/* Browse page */
.browse-filters {
    display: flex;
    gap: 12px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.browse-filters select, .browse-filters input {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 24px 0;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
}

.pagination a { background: var(--bg-card); border: 1px solid var(--border); }
.pagination a:hover { background: var(--bg-hover); }
.pagination .active { background: var(--accent); color: white; }

/* Footer */
.footer {
    margin-top: 48px;
    padding: 24px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-links { display: flex; justify-content: center; gap: 16px; margin-top: 8px; }
.footer-links a:hover { color: var(--accent); }

/* 404 */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 4rem; color: var(--accent); }
.error-page p { color: var(--text-muted); margin: 12px 0; }

/* Mobile */
@media (max-width: 768px) {
    .manga-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .manga-detail { flex-direction: column; }
    .manga-detail-cover { width: 160px; margin: 0 auto; }
    .nav-links { display: none; }
    .search-box { flex: 1; }
}

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