/**
 * Modern Reader Styles - MangaDenizi
 * Extracted from inline styles for better caching
 * Dark theme with modern UI components
 */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1f1f1f;
    --bg-hover: #2a2a2a;
    --border-color: #2d2d2d;
    --text-primary: #f5f5f5;
    --text-secondary: #a0a0a0;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --danger: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== TOP NAVIGATION ===== */
.reader-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.reader-nav.hidden {
    transform: translateY(-100%);
}

.nav-left,
.nav-center,
.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-size: 16px;
}

.nav-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.manga-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    text-decoration: none;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-badge {
    background: var(--accent);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--bg-tertiary);
    z-index: 999;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    transition: width 0.3s ease;
}

/* ===== MAIN CONTENT ===== */
.reader-content {
    padding-top: 80px;
    padding-bottom: 120px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.4s ease;
}

/* ===== PAGE DISPLAY ===== */
.page-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px;
}

.page-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.page-image.loaded {
    opacity: 1;
}

/* Long-strip mode */
.longstrip-container {
    display: none;
}

.longstrip-container.active {
    display: block;
}

.longstrip-page {
    margin-bottom: 2px;
}

.longstrip-page img {
    width: 100%;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 1;
}

.longstrip-page img.loaded {
    opacity: 1;
}

/* Loading skeleton for images */
.image-wrapper {
    position: relative;
    min-height: 400px;
    background: var(--bg-tertiary);
}

.image-wrapper.loaded {
    min-height: auto;
    background: transparent;
}

.loading-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.loading-skeleton.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Longstrip skeleton */
.longstrip-skeleton {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.longstrip-skeleton.hidden {
    display: none;
}

/* Single page mode */
.single-container {
    display: block;
}

.single-container.hidden {
    display: none;
}

/* ===== FLOATING CONTROLS ===== */
.floating-controls {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 10px 14px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    z-index: 998;
}

.ctrl-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.ctrl-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.ctrl-btn.chapter-nav {
    padding: 12px 14px;
}

.page-info {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
}

.page-info span {
    color: var(--text-secondary);
    font-weight: 400;
}

/* ===== DROPDOWNS ===== */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: var(--shadow);
    z-index: 1001;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu.top {
    bottom: 100%;
    margin-bottom: 8px;
}

.dropdown-menu.right {
    right: 0;
}

.dropdown-header {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item.active {
    background: rgba(99, 102, 241, 0.15);
}

.dropdown-item i.check {
    color: var(--success);
    opacity: 0;
}

.dropdown-item.active i.check {
    opacity: 1;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* ===== CHAPTER SIDEBAR ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1100;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.chapter-sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 1101;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.chapter-sidebar.show {
    right: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
}

.chapter-item {
    display: flex;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.chapter-item:hover {
    background: var(--bg-hover);
}

.chapter-item.active {
    background: rgba(99, 102, 241, 0.15);
    border-left: 3px solid var(--accent);
}

.chapter-num {
    font-weight: 600;
    min-width: 70px;
}

.chapter-name {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== NEXT CHAPTER BUTTON ===== */
.next-chapter-box {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin: 40px auto;
    max-width: 400px;
}

.next-chapter-box h4 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.next-chapter-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--accent);
    color: white;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: var(--transition);
}

.next-chapter-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* ===== RTL MODE ===== */
body.rtl-mode .page-image,
body.rtl-mode .longstrip-page img {
    transform: scaleX(-1);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .nav-center {
        position: static;
        transform: none;
    }

    .manga-title {
        max-width: 120px;
        font-size: 13px;
    }

    .chapter-badge {
        padding: 4px 10px;
        font-size: 11px;
    }

    .floating-controls {
        left: 12px;
        right: 12px;
        transform: none;
        justify-content: space-between;
    }

    .ctrl-btn span {
        display: none;
    }

    .ctrl-btn {
        padding: 12px 16px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== MODAL DARK THEME ===== */
.modal-content {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
    color: var(--text-primary) !important;
}

.modal-header {
    background: var(--bg-tertiary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}

.modal-header .modal-title {
    color: var(--text-primary) !important;
}

.modal-header .close {
    color: var(--text-primary) !important;
    opacity: 0.7;
}

.modal-header .close:hover {
    color: var(--text-primary) !important;
    opacity: 1;
}

.modal-body {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.modal-body label {
    color: var(--text-primary) !important;
}

.modal-body .form-control {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
}

.modal-body .form-control:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2) !important;
}

.modal-footer {
    background: var(--bg-tertiary) !important;
    border-top: 1px solid var(--border-color) !important;
    border-radius: 0 0 var(--radius) var(--radius) !important;
}

.modal-footer .btn-default {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}

.modal-footer .btn-default:hover {
    background: var(--bg-hover) !important;
}

.modal-footer .btn-primary {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
}

.modal-footer .btn-primary:hover {
    background: var(--accent-hover) !important;
}

.modal-backdrop {
    background: rgba(0, 0, 0, 0.8) !important;
}