/* ============================================================
   Secure Comic Reader — reader.css
   ============================================================ */

/* ---- Reader Shell ---- */
.reader-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #05050a;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* ---- Toolbar ---- */
.reader-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.5rem;
    height: 60px;
    background: rgba(12, 12, 20, 0.97);
    border-bottom: 1px solid rgba(0, 230, 118, 0.12);
    backdrop-filter: blur(12px);
    z-index: 100;
    flex-shrink: 0;
}

.reader-toolbar-left,
.reader-toolbar-center,
.reader-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.reader-toolbar-left { flex: 1; }
.reader-toolbar-center { flex: 0 0 auto; }
.reader-toolbar-right { flex: 1; justify-content: flex-end; }

.reader-back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: #ffffff;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-body);
    transition: all 0.2s ease;
    text-decoration: none;
}

.reader-back-btn:hover {
    border-color: var(--clr-primary);
    color: var(--clr-primary-bright);
}

.reader-chapter-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.reader-page-info {
    font-size: 0.85rem;
    color: #ffffff;
    background: rgba(255,255,255,0.05);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.06);
    min-width: 90px;
    text-align: center;
}

.reader-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-body);
}

.reader-nav-btn:hover:not(:disabled) {
    background: rgba(0, 230, 118, 0.15);
    border-color: var(--clr-primary);
    color: var(--clr-primary-bright);
    transform: scale(1.05);
}

.reader-nav-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.reader-zoom-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.reader-zoom-btn:hover {
    border-color: var(--clr-primary);
    color: var(--clr-primary-bright);
    background: rgba(0,230,118,0.1);
}

/* ---- Viewer Area ---- */
.reader-viewport {
    flex: 1;
    overflow: auto;
    padding: 2rem 1rem;
    position: relative;
    background: #05050a;
    background-image: radial-gradient(circle at 50% 0%, rgba(0,230,118,0.04) 0%, transparent 60%);
    text-align: center;
}

/* PDF Canvas */
#pdfCanvas {
    display: inline-block;
    max-width: none !important;
    margin: 0 auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.8), 0 0 0 1px rgba(0,230,118,0.08);
    border-radius: 4px;
    background: #fff;
    transition: transform 0.2s ease;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* ZIP/CBZ Image Viewer */
#cbzImageViewer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

#cbzCurrentImage {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.8), 0 0 0 1px rgba(0,230,118,0.08);
    display: block;
    background: #111;
    min-height: 200px;
}

.cbz-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: #ffffff;
    font-size: 0.9rem;
}

/* Loading Spinner */
.reader-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(0, 230, 118, 0.15);
    border-top-color: var(--clr-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error Banner */
.reader-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    text-align: center;
    color: #ff6b6b;
}

.reader-error svg {
    opacity: 0.5;
}

.reader-error p {
    color: #ffffff;
    max-width: 400px;
}

/* Status badge on toolbar */
.reader-status-badge {
    font-size: 0.75rem;
    background: rgba(0, 230, 118, 0.12);
    color: var(--clr-primary);
    border: 1px solid rgba(0,230,118,0.2);
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* ---- Keyboard Shortcut Overlay ---- */
.reader-shortcuts {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(12,12,20,0.92);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 0.5rem 1.2rem;
    display: flex;
    gap: 1.5rem;
    font-size: 0.78rem;
    color: #ffffff;
    backdrop-filter: blur(10px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 50;
}

.reader-shell:hover .reader-shortcuts {
    opacity: 1;
}

.reader-shortcuts kbd {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--clr-primary-bright);
}

/* ---- Access Denied Screen ---- */
.reader-access-denied {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 3rem;
    text-align: center;
}

.reader-access-denied h2 {
    font-size: 1.8rem;
    color: #ffffff;
}

.reader-access-denied p {
    color: #ffffff;
    max-width: 400px;
    line-height: 1.7;
}

.reader-lock-icon {
    color: rgba(0,230,118,0.3);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .reader-toolbar {
        padding: 0 0.5rem;
        gap: 0.3rem;
        height: 54px;
    }
    .reader-status-badge { display: none; }
    .reader-shortcuts { display: none; }
    .reader-chapter-title {
        display: none; /* Hide to save space for core nav buttons */
    }
    .reader-nav-btn, .reader-zoom-btn {
        width: 40px; /* Better touch targets */
        height: 40px;
    }
    .reader-back-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    .reader-back-btn span, .reader-back-btn text {
        display: none; /* If there's text, hide it, keep the icon */
    }
    .reader-viewport {
        padding: 0.5rem; /* Maximize comic size */
    }
    #cbzCurrentImage {
        max-height: calc(100vh - 70px);
    }
    .reader-page-info {
        min-width: 70px;
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
    }
}
