/**
 * Reader Styles
 * For doujins and comics reading mode
 */

.reader-page {
    position: fixed;
    inset: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    max-width: 100vw;
    max-height: 100vh;
}

.reader-page * {
    box-sizing: border-box;
}

/* Header */
.reader-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md, 16px);
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.9);
    z-index: 20;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.reader-page.immersive .reader-header,
.reader-page.immersive .reader-footer {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.reader-page.immersive .reader-footer {
    transform: translateY(100%);
}

.header-back,
.header-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    text-decoration: none;
}

.header-back:hover,
.header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-back svg,
.header-btn svg {
    width: 24px;
    height: 24px;
}

.header-info {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.header-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.header-page {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.header-actions {
    display: flex;
    gap: 4px;
}

/* Page Mode Container */
.reader-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    height: calc(100vh - 120px);
    max-height: calc(100vh - 120px);
}

.reader-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reader-image {
    max-width: 100%;
    height: calc(100vh - 120px);
    width: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    margin: 0 auto;
    display: block;
}

.reader-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    transition: opacity 0.2s;
}

.reader-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent-primary, #e91e63);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Click Zones */
.click-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    cursor: pointer;
    z-index: 10;
}

.click-zone--left {
    left: 0;
    width: 30%;
}

.click-zone--center {
    left: 30%;
    width: 40%;
}

.click-zone--right {
    right: 0;
    width: 30%;
}

/* Scroll Mode Container */
.scroll-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.scroll-container.hidden {
    display: none;
}

.scroll-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 4px;
    max-width: 1024px;
    margin: 0 auto;
}

.scroll-content img {
    max-width: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

.scroll-content .page-placeholder {
    width: 100%;
    min-height: 300px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.9rem;
}

/* Footer */
.reader-footer {
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.9);
    z-index: 20;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.footer-progress {
    margin-bottom: 8px;
}

.progress-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
}

.progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-primary, #e91e63);
    border-radius: 50%;
    cursor: pointer;
}

.progress-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent-primary, #e91e63);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.footer-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.control-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.control-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.page-display {
    color: white;
    font-size: 0.9rem;
    min-width: 80px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Mode indicator */
.reader-page[data-mode="scroll"] .reader-container {
    display: none;
}

.reader-page[data-mode="scroll"] .scroll-container {
    display: block;
}

.reader-page[data-mode="scroll"] .footer-progress,
.reader-page[data-mode="scroll"] .footer-controls {
    display: none;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .header-title {
        font-size: 0.8rem;
    }

    .click-zone--left {
        width: 25%;
    }

    .click-zone--center {
        left: 25%;
        width: 50%;
    }

    .click-zone--right {
        width: 25%;
    }

    .reader-container {
        height: calc(100vh - 110px);
        max-height: calc(100vh - 110px);
    }

    .reader-image {
        max-width: calc(100vw - 10px);
        height: auto;
        max-height: calc(100vh - 110px);
    }

    .scroll-content {
        max-width: 100%;
        padding: 0;
    }

    .scroll-content img {
        width: 100%;
        max-width: 100%;
    }

    .scroll-content .page-placeholder {
        min-height: 200px;
    }
}
