/* ============================================================
   FLOATING SETTINGS MENU
   ============================================================ */
.settings-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}
.settings-toggle {
    background: white;
    color: #374151;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.settings-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.settings-toggle .settings-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}
.settings-popup {
    display: none;
    position: absolute;
    bottom: 60px;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 15px;
    min-width: 150px;
    border: 1px solid #e2e8f0;
    font-family: 'Segoe UI', system-ui, sans-serif !important;
}
.settings-popup.open { display: block; }
.settings-popup .label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #4b5563;
    display: block;
    margin-bottom: 8px;
}
.settings-popup .btn-source {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    text-decoration: none;
    color: #4b5563;
    background: white;
    font-weight: 500;
    font-size: 0.9rem;
    margin-right: 4px;
    margin-bottom: 6px;
    transition: all 0.2s;
    font-family: 'Segoe UI', system-ui, sans-serif !important;
}
.settings-popup .btn-source:hover { background: #f1f5f9; }
.settings-popup .btn-source.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.settings-popup .btn-source.translit-active {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}
.settings-popup .btn-source-reset {
    border-color: transparent !important;
    background: transparent !important;
    color: #6b7280 !important;
}
.settings-popup .separator {
    border-top: 1px solid #e2e8f0;
    margin: 10px 0;
}
.settings-popup .close-btn {
    position: absolute;
    top: 6px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #9ca3af;
}
.settings-popup .close-btn:hover { color: #4b5563; }
.settings-popup .source-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

/* ============================================================
   SETTINGS HINT
   ============================================================ */
.settings-hint {
    position: fixed;
    bottom: 30px;
    right: 76px;
    background: #1e293b;
    color: white;
    font-size: 0.85rem;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    max-width: 240px;
    line-height: 1.4;
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 9998;
}
.settings-hint.visible {
    opacity: 1;
    transform: translateX(0);
}
.settings-hint::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #1e293b;
}
html[dir="rtl"] .settings-hint {
    right: auto;
    left: 76px;
    transform: translateX(-10px);
}
html[dir="rtl"] .settings-hint.visible { transform: translateX(0); }
html[dir="rtl"] .settings-hint::after {
    right: auto;
    left: -6px;
    border-left-color: transparent;
    border-right-color: #1e293b;
}

/* ============================================================
   SCROLL TOP BUTTON
   ============================================================ */
.scroll-top-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    transition: opacity 0.3s, transform 0.2s, box-shadow 0.2s;
    opacity: 0;
    pointer-events: none;
    z-index: 999;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
}
.scroll-top-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
.scroll-top-btn .scroll-top-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
}

/* ============================================================
   READING PROGRESS BAR
   ============================================================ */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: #f59e0b;
    z-index: 9999;
    transition: width 0.1s ease-out;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(0,0,0,0.15);
}

/* ============================================================
   FLOATING RESUME BUTTON (rechtsonder)
   ============================================================ */
.floating-resume-btn {
    position: fixed;
    bottom: 145px;
    right: 20px;
    z-index: 999;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    background: #f59e0b;
    color: #fff;
    border: none;
    border-radius: 22px;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(245, 158, 11, 0.45);
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s, opacity 0.2s;
    line-height: 1;
}
.floating-resume-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(245, 158, 11, 0.55);
    background: #d97706;
}
.floating-resume-btn.is-hidden {
    display: none !important;
}
.floating-resume-icon {
    height: 16px;
    width: auto;
    display: block;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}
.floating-resume-label {
    line-height: 1;
}
html[dir="rtl"] .floating-resume-btn {
    right: auto;
    left: 20px;
}

@media (max-width: 768px) {
    .floating-resume-btn {
        bottom: 135px;
        right: 14px;
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    html[dir="rtl"] .floating-resume-btn {
        right: auto;
        left: 14px;
    }
}

/* ============================================================
   CONTINUE BARS (reading + listening)
   ============================================================ */
.continue-bars-wrap {
    display: flex;
    gap: 12px;
    max-width: 1000px;
    margin: 0 auto 20px;
    padding: 0 20px;
    box-sizing: border-box;
    animation: fadeInUp 0.3s ease;
}
.continue-bar {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    border-left: 4px solid var(--primary-color);
    text-decoration: none;
    color: #374151;
    font-size: 0.9rem;
    line-height: 1.3;
    transition: background 0.15s, border-left-color 0.15s;
    box-sizing: border-box;
}
.continue-bar[hidden] { display: none; }
.continue-bar:hover {
    background: #f9fafb;
    border-left-color: #4338ca;
}
.continue-listening-bar {
    border-left-color: #f59e0b;
}
.continue-listening-bar:hover {
    border-left-color: #d97706;
}
.continue-bar-label {
    color: #6b7280;
    font-weight: 600;
    flex-shrink: 0;
}
.continue-bar-title {
    font-weight: 600;
    color: #111827;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.continue-bar-icon {
    height: 22px;
    width: auto;
    flex-shrink: 0;
    display: block;
    transition: transform 0.15s;
    opacity: 0.85;
}
.continue-bar:hover .continue-bar-icon {
    transform: translateX(4px);
    opacity: 1;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .continue-bars-wrap {
        flex-direction: column;
        gap: 8px;
        padding: 0 12px;
    }
}

/* ============================================================
   WELCOME / HELP MODAL
   ============================================================ */
.welcome-modal {
    position: fixed;
    inset: 0;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.welcome-modal[hidden] { display: none; }
.welcome-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease;
}
.welcome-modal-content {
    position: relative;
    background: #fff;
    border-radius: 14px;
    padding: 26px 28px 22px;
    max-width: 500px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    animation: noteModalIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}
.welcome-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
    font-family: inherit;
}
.welcome-modal-close:hover { color: #374151; }
.welcome-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 8px;
    padding-right: 24px;
}
.welcome-modal-intro {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.5;
    margin-bottom: 16px;
}
.welcome-modal-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.welcome-modal-list li {
    font-size: 0.95rem;
    color: #374151;
    line-height: 1.45;
}
.welcome-modal-tip {
    background: #fef9c3;
    border-left: 4px solid #f59e0b;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #78350f;
    line-height: 1.45;
    margin-bottom: 20px;
}
.welcome-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.welcome-modal-got-it {
    padding: 10px 22px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}
.welcome-modal-got-it:hover { filter: brightness(0.92); }
.welcome-modal-got-it:active { transform: scale(0.97); }

@media (max-width: 600px) {
    .welcome-modal-content { padding: 20px; }
    .welcome-modal-actions { justify-content: stretch; }
    .welcome-modal-got-it { flex: 1; }
}