/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #e0e0e0;
    background-color: #1a1a1a;
}

/* Header */
header {
    background: linear-gradient(135deg, #005da6 0%, #0c4d7a 100%);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border-bottom: 3px solid #5ac246;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Library Page */
.library {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.comics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.comic-card {
    background: #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    border: 2px solid transparent;
}

.comic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(90, 194, 70, 0.3);
    border-color: #5ac246;
}

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

.comic-card-content {
    padding: 1.5rem;
}

.comic-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #5ac246;
}

.comic-card p {
    color: #b0b0b0;
    margin-bottom: 0.5rem;
}

.comic-meta {
    font-size: 0.9rem;
    color: #888;
}

/* Reader Page */
.reader-page {
    background-color: #0f0f0f;
    color: #fff;
}

.reader-header {
    background: linear-gradient(135deg, #005da6 0%, #0c4d7a 100%);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 3px solid #5ac246;
}

.back-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
    border: 1px solid rgba(90, 194, 70, 0.3);
}

.back-link:hover {
    background-color: rgba(90, 194, 70, 0.2);
    border-color: #5ac246;
}

.reader-header h1 {
    font-size: 1.5rem;
}

.reader {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.reader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    min-height: 600px;
    max-height: 80vh;
    height: 80vh;
}

.comic-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

.reader-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.nav-btn {
    background: linear-gradient(135deg, #5ac246 0%, #4a9e38 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(90, 194, 70, 0.3);
}

.nav-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #6bd458 0%, #5ac246 100%);
    box-shadow: 0 4px 12px rgba(90, 194, 70, 0.4);
    transform: translateY(-2px);
}

.nav-btn:disabled {
    background: #3a3a3a;
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

.page-info {
    font-size: 1.1rem;
    color: #ccc;
    min-width: 120px;
    text-align: center;
}

.comic-info {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background-color: rgba(0, 93, 166, 0.15);
    border-radius: 8px;
    border: 1px solid rgba(90, 194, 70, 0.2);
}

.comic-info p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.comic-meta {
    font-size: 0.9rem;
    color: #999;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #005da6 0%, #0c4d7a 100%);
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
    border-top: 3px solid #5ac246;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .comics-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .reader-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .reader-container {
        min-height: 400px;
        height: 60vh;
        max-height: 60vh;
    }

    .reader-controls {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: #5ac246;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}
