/* =========================
   BASE STYLES
   ========================= */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #0c0c0c;
    color: #eee;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

a {
    color: #61afef;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =========================
   HEADER
   ========================= */

header {
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
    padding: 15px 0;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 a {
    color: #61afef;
    font-size: 1.4rem;
    font-weight: 600;
}

header .subtitle {
    font-size: 0.85rem;
    color: #888;
    margin-top: 2px;
}

/* =========================
   SEARCH
   ========================= */

#search {
    margin: 30px 0;
}

#search input {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #eee;
    font-size: 1rem;
    border-radius: 6px;
}

#search input:focus {
    outline: none;
    border-color: #61afef;
}

/* =========================
   STATS
   ========================= */

.stats {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #888;
}

.stats strong {
    color: #61afef;
}

/* =========================
   SERIES GRID
   ========================= */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.series-card {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

.series-card:hover {
    transform: translateY(-3px);
    border-color: #61afef;
}

.series-card img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
}

.series-card .info {
    padding: 12px;
}

.series-card .title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #eee;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.series-card .meta {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

/* =========================
   SERIES DETAIL
   ========================= */

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #888;
}

#series-detail {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 20px;
}

#series-detail img {
    width: 200px;
    height: 280px;
    object-fit: cover;
    border-radius: 6px;
}

#series-detail .info h2 {
    font-size: 1.6rem;
    margin-bottom: 10px;
}

#series-detail .info .description {
    color: #aaa;
    margin: 10px 0;
}

#series-detail .info .meta span {
    display: inline-block;
    margin-right: 10px;
    font-size: 0.85rem;
    color: #888;
}

/* =========================
   CHAPTER LIST
   ========================= */

#chapter-list h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

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

.chapter-item {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.chapter-item:hover {
    border-color: #61afef;
    text-decoration: none;
}

.chapter-item .number {
    color: #61afef;
    font-weight: 500;
}

.chapter-item .title {
    color: #888;
    font-size: 0.8rem;
    margin-left: 6px;
}

/* =========================
   READER
   ========================= */

.reader-body {
    background: #000;
}

.reader-header {
    position: sticky;
    top: 0;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
    padding: 10px 0;
    z-index: 100;
}

.reader-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reader {
    max-width: 800px;
    margin: 20px auto;
}

#chapter-images img {
    width: 100%;
    display: block;
    margin-bottom: 4px;
}

#loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.chapter-nav {
    display: flex;
    justify-content: space-between;
    margin: 30px 0;
    gap: 20px;
}

.chapter-nav a {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    padding: 15px;
    text-align: center;
    border-radius: 6px;
    font-weight: 500;
}

.chapter-nav a:hover {
    border-color: #61afef;
    text-decoration: none;
}

.chapter-nav a.disabled {
    color: #444;
    pointer-events: none;
}

/* =========================
   FOOTER
   ========================= */

footer {
    margin-top: 60px;
    padding: 20px 0;
    text-align: center;
    color: #555;
    font-size: 0.8rem;
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 600px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    #series-detail {
        flex-direction: column;
    }
    
    #series-detail img {
        width: 100%;
        height: auto;
    }
}
