/* Moderní design systém pro modul Čtení (E-knihy) v Hravé Angličtině */
:root {
    --reader-bg: #f8fafc;
    --reader-card: #ffffff;
    --reader-text: #1e293b;
    --reader-muted: #64748b;
    --reader-primary: #3b82f6;
    --reader-primary-hover: #2563eb;
    --reader-border: #e2e8f0;
    --reader-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --reader-shadow-hover: 0 20px 35px -10px rgba(15, 23, 42, 0.15), 0 10px 15px -5px rgba(15, 23, 42, 0.06);
    --reader-radius: 24px;
}

body.cteni-page {
    background-color: var(--reader-bg);
    color: var(--reader-text);
    font-family: 'Nunito', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.cteni-container {
    width: 100%;
    max-width: 1200px;
    padding: 24px 20px 60px;
    box-sizing: border-box;
}

/* Horní navigační lišta */
.cteni-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.cteni-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #ffffff;
    color: #334155;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #f1f5f9;
}

.cteni-back-btn:hover {
    transform: translateY(-2px);
    color: #2563eb;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.cteni-stats-badge {
    background: #ffffff;
    padding: 10px 22px;
    border-radius: 50px;
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    color: #475569;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cteni-stats-badge strong {
    color: #3b82f6;
}

/* Hero sekce */
.cteni-hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #38bdf8 100%);
    border-radius: 28px;
    padding: 38px 36px;
    color: #ffffff;
    box-shadow: 0 16px 36px rgba(37, 99, 235, 0.25);
    margin-bottom: 36px;
    position: relative;
    overflow: hidden;
}

.cteni-hero::after {
    content: '📚';
    position: absolute;
    right: 25px;
    bottom: -15px;
    font-size: 8rem;
    opacity: 0.15;
    pointer-events: none;
    line-height: 1;
}

.cteni-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.cteni-hero-title {
    font-family: 'Poppins', sans-serif;
    font-size: 2.3rem;
    font-weight: 900;
    margin: 0 0 12px 0;
    line-height: 1.2;
}

.cteni-hero-subtitle {
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.95;
    max-width: 750px;
    line-height: 1.6;
}

/* Mřížka knih */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

.book-card {
    background: #ffffff;
    border-radius: var(--reader-radius);
    padding: 24px;
    box-shadow: var(--reader-shadow);
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.book-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--reader-shadow-hover);
    border-color: #cbd5e1;
}

.book-cover-wrap {
    width: 100%;
    height: 270px;
    border-radius: 18px;
    overflow: hidden;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
    position: relative;
    cursor: pointer;
    text-decoration: none;
}

.book-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.book-card:hover .book-cover-img,
.book-cover-wrap:hover .book-cover-img {
    transform: scale(1.06);
}

.book-cover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 3;
    pointer-events: none;
}

.book-cover-wrap:hover .book-cover-overlay {
    opacity: 1;
}

.book-cover-play-badge {
    background: rgba(255, 255, 255, 0.95);
    color: #1e3a8a;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 800;
    padding: 8px 18px;
    border-radius: 30px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transform: translateY(6px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.book-cover-wrap:hover .book-cover-play-badge {
    transform: translateY(0);
}

.book-badge-level {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(15, 23, 42, 0.85);
    color: #ffffff;
    backdrop-filter: blur(6px);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 800;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.5px;
    z-index: 4;
}

.book-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.book-genre {
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.book-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.book-author {
    font-size: 1rem;
    font-weight: 700;
    color: #3b82f6;
    margin: 0 0 14px 0;
}

.book-desc {
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.55;
    margin: 0 0 16px 0;
    flex-grow: 1;
}

.book-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.book-features li {
    font-size: 0.88rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.book-features li::before {
    content: '✓';
    color: #10b981;
    font-weight: 900;
}

.book-open-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    text-decoration: none;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.3);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.book-open-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.4);
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* ==========================================================================
   ČTEČKA (EPUB READER MODAL & FULL VIEW)
   ========================================================================== */
.reader-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.reader-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.reader-app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fdfdfd;
    position: relative;
    overflow: hidden;
}

/* Horní lišta čtečky */
.reader-top-bar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 15px;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
}

.reader-left-controls,
.reader-right-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reader-btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reader-btn-icon:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: scale(1.05);
}

.reader-book-meta {
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 0 10px;
    flex-grow: 1;
}

.reader-title-display {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    color: #0f172a;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reader-author-display {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

/* Hlavní plocha čtení */
.reader-main-stage {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    width: 100%;
}

.reader-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 64px;
    border-radius: 12px;
    background: transparent;
    box-shadow: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    cursor: pointer;
    color: currentColor;
    opacity: 0.08;
    z-index: 20;
    transition: opacity 0.25s ease, background 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}

.reader-nav-arrow:hover {
    opacity: 0.95;
    background: rgba(59, 130, 246, 0.9);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
    transform: translateY(-50%) scale(1.1);
}

.reader-nav-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.reader-nav-arrow.prev {
    left: 12px;
}

.reader-nav-arrow.next {
    right: 12px;
}

.reader-content-frame {
    width: 100%;
    max-width: 900px;
    height: 100%;
    padding: 20px 40px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
}

#epub-viewer {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 12px;
}

/* Spodní panel postupu */
.reader-bottom-bar {
    height: 52px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #64748b;
    z-index: 10;
}

/* Odkaz na pokročilý slovník ve spodní liště čtečky */
.reader-dict-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #4f46e5;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(79, 70, 229, 0.09);
    border: 1px solid rgba(79, 70, 229, 0.18);
    transition: all 0.2s ease;
    cursor: pointer;
}

.reader-dict-link:hover {
    color: #ffffff;
    background: #4f46e5;
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.28);
    transform: translateY(-1px);
}

.reader-app.theme-dark .reader-dict-link {
    color: #a5b4fc;
    background: rgba(165, 180, 252, 0.14);
    border-color: rgba(165, 180, 252, 0.25);
}

.reader-app.theme-dark .reader-dict-link:hover {
    color: #0f172a;
    background: #a5b4fc;
    border-color: #a5b4fc;
    box-shadow: 0 4px 12px rgba(165, 180, 252, 0.35);
}

.reader-app.theme-sepia .reader-dict-link {
    color: #6d28d9;
    background: rgba(109, 40, 217, 0.08);
    border-color: rgba(109, 40, 217, 0.18);
}

.reader-app.theme-sepia .reader-dict-link:hover {
    color: #ffffff;
    background: #6d28d9;
    border-color: #6d28d9;
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.25);
}

/* Skrýt duplicitní plovoucí tlačítko slovníčku na stránce čtení */
body.cteni-page .slovnicek-floating-btn {
    display: none !important;
}

.reader-progress-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-grow: 1;
    max-width: 500px;
}

.reader-progress-slider {
    flex-grow: 1;
    height: 6px;
    accent-color: #3b82f6;
    cursor: pointer;
}

/* Postranní panel obsahu (TOC) */
.reader-toc-drawer {
    position: absolute;
    top: 64px;
    left: 0;
    bottom: 52px;
    width: 320px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.08);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 30;
    display: flex;
    flex-direction: column;
}

.reader-toc-drawer.open {
    transform: translateX(0);
}

.reader-toc-header {
    padding: 18px 20px;
    border-bottom: 1px solid #f1f5f9;
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: #0f172a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reader-toc-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 12px 10px;
    list-style: none;
    margin: 0;
}

.reader-toc-item {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 4px;
}

.reader-toc-item:hover {
    background: #eff6ff;
    color: #2563eb;
}

/* Panel nastavení čtení */
.reader-settings-panel {
    position: absolute;
    top: 74px;
    right: 20px;
    width: 300px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    padding: 20px;
    z-index: 35;
    display: none;
    flex-direction: column;
    gap: 16px;
}

.reader-settings-panel.open {
    display: flex;
}

.settings-group-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 800;
    color: #94a3b8;
    margin-bottom: 6px;
}

.theme-options {
    display: flex;
    gap: 8px;
}

.theme-btn {
    flex: 1;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    text-align: center;
    transition: all 0.2s ease;
}

.theme-btn.light {
    background: #f8fafc;
    color: #0f172a;
    border-color: #e2e8f0;
}

.theme-btn.sepia {
    background: #fbf0d9;
    color: #5f4b32;
    border-color: #ecd9b5;
}

.theme-btn.dark {
    background: #1e293b;
    color: #f8fafc;
    border-color: #334155;
}

.theme-btn.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.font-size-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 6px 12px;
}

.font-size-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    color: #3b82f6;
    padding: 4px 10px;
}

.font-size-display {
    font-weight: 700;
    font-size: 0.95rem;
    color: #334155;
}

/* Načítací spinner */
.reader-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 15;
    background: rgba(255, 255, 255, 0.9);
    padding: 25px 35px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responzivita */
@media (max-width: 768px) {
    .cteni-hero {
        padding: 26px 22px;
    }

    .cteni-hero-title {
        font-size: 1.8rem;
    }

    .books-grid {
        grid-template-columns: 1fr;
    }

    .reader-content-frame {
        padding: 10px 15px;
    }

    .reader-nav-arrow {
        width: 36px;
        height: 48px;
        font-size: 1.8rem;
        opacity: 0.12;
    }

    .reader-nav-arrow.prev { left: 4px; }
    .reader-nav-arrow.next { right: 4px; }

    .reader-bottom-bar {
        padding: 0 12px;
        gap: 10px;
    }

    .reader-dict-link {
        padding: 5px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .reader-toc-drawer {
        width: 85%;
    }
}
