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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Container */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 12px;
}

/* Header */
.header {
    background: #fff;
    border-bottom: 1px solid #ddd;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logo {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.logo img {
    height: 40px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    display: block;
}

.search-form {
    flex: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.nav-links {
    display: flex;
    gap: 12px;
    font-size: 13px;
}

/* Main Content */
.main {
    padding: 16px 0;
    min-height: calc(100vh - 120px);
}

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

.manga-card {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.manga-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.manga-cover {
    position: relative;
    padding-top: 140%;
    background: #eee;
    overflow: hidden;
}

.manga-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.manga-info {
    padding: 8px;
}

.manga-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.manga-meta {
    font-size: 11px;
    color: #666;
}

/* Manga Detail */
.manga-detail {
    background: #fff;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
}

.manga-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.manga-poster {
    width: 120px;
    flex-shrink: 0;
}

.manga-poster img {
    border-radius: 4px;
}

.manga-details h1 {
    font-size: 20px;
    margin-bottom: 8px;
}

.manga-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.genre-tag {
    display: inline-block;
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 3px;
    font-size: 12px;
    color: #495057;
}

.manga-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

.btn:hover {
    background: #0056b3;
    text-decoration: none;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-success {
    background: #28a745;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

/* Chapter List */
.chapter-list {
    background: #fff;
    border-radius: 4px;
    padding: 16px;
}

.chapter-list h2 {
    font-size: 16px;
    margin-bottom: 12px;
}

.chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.chapter-item:last-child {
    border-bottom: none;
}

.chapter-name {
    font-size: 14px;
    color: #333;
}

.chapter-date {
    font-size: 12px;
    color: #999;
}

/* Chapter Reader */
.reader-header {
    background: #fff;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 4px;
    text-align: center;
}

.reader-header h1 {
    font-size: 16px;
    margin-bottom: 8px;
}

.chapter-select {
    width: 100%;
    max-width: 300px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.reader-images {
    background: #000;
    margin: 0 -12px;
}

.reader-images img {
    width: 100%;
    height: auto;
    margin: 0 auto;
    display: block;
}

.reader-nav {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);

    /* Sticky at bottom */
    position: sticky;
    bottom: 0;
    z-index: 50;
}

.reader-nav .btn {
    flex: 1;
    min-height: 44px;
    /* Better touch target */
}

/* Top navigation (not sticky) */
.reader-nav-top {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #fff;
    margin-bottom: 12px;
    border-radius: 4px;
}

.reader-nav-top .btn {
    flex: 1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
}

.pagination a:hover {
    background: #007bff;
    color: #fff;
    text-decoration: none;
}

.pagination .active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* Footer */
.footer {
    background: #1a1a1a;
    border-top: none;
    padding: 48px 0 24px;
    text-align: center;
    font-size: 14px;
    color: #aaa;
    margin-top: 40px;
}

.footer .container {
    max-width: 900px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 24px 0;
}

.footer-links a {
    display: inline-block;
    padding: 8px 16px;
    background: #333;
    color: #e0e0e0;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.footer-links a:hover {
    background: #007bff;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
    border-color: #007bff;
    text-decoration: none;
}

.footer p {
    margin-bottom: 12px;
    line-height: 1.6;
}

/* Admin Styles */
.admin-header {
    background: #343a40;
    color: #fff;
    padding: 12px 0;
    margin-bottom: 20px;
}

.admin-nav {
    display: flex;
    gap: 16px;
}

.admin-nav a {
    color: #fff;
}

.admin-table {
    width: 100%;
    background: #fff;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.admin-table th,
.admin-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.admin-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-checkbox {
    margin-right: 6px;
}

.alert {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 4px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive */
@media (max-width: 480px) {
    .manga-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }

    .manga-header {
        flex-direction: column;
    }

    .manga-poster {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }

    .nav-links {
        display: none;
    }
}