* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    direction: rtl;
}

header {
    background: #1a237e;
    color: white;
    padding: 1.5rem;
    text-align: center;
}

header h1 { font-size: 1.4rem; font-weight: 600; }
header .back { color: white; text-decoration: none; display: inline-block; margin-bottom: 0.5rem; opacity: 0.8; }

main { max-width: 900px; margin: 0 auto; padding: 1.5rem; }

/* חיפוש */
.search-box { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.search-box input { flex: 1; padding: 0.7rem 1rem; border: 1px solid #ddd; border-radius: 8px; font-size: 1rem; direction: rtl; }
.search-box button { padding: 0.7rem 1.5rem; background: #1a237e; color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; }

/* קטגוריות */
.categories { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.7rem; }
.categories a { padding: 0.3rem 0.8rem; background: white; border: 1px solid #ddd; border-radius: 20px; text-decoration: none; color: #555; font-size: 0.85rem; }
.categories a.active { background: #1a237e; color: white; border-color: #1a237e; }
.categories a.cat-hidden { display: none; }
.categories.expanded a.cat-hidden { display: inline-block; }
.cat-toggle { padding: 0.3rem 0.8rem; background: #f0f0f0; border: 1px solid #ccc; border-radius: 20px; font-size: 0.85rem; cursor: pointer; color: #1a237e; font-weight: 600; }
.cat-toggle:hover { background: #e0e0e0; }

/* שפות */
.languages { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.languages a { padding: 0.3rem 0.8rem; background: white; border: 1px solid #e0e0e0; border-radius: 20px; text-decoration: none; color: #555; font-size: 0.85rem; }
.languages a.active { background: #e65100; color: white; border-color: #e65100; }
.lessons-count { color: #777; margin-bottom: 1rem; font-size: 0.9rem; }

/* באנר אורח קבוע */
.guest-topbar {
    background: #fff3e0;
    color: #e65100;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 1px solid #ffcc80;
}
.guest-topbar a { color: #1a237e; font-weight: 700; text-decoration: underline; }

/* באנר גישה ציבורית */
.public-topbar {
    background: #e3f2fd;
    color: #1565c0;
    text-align: center;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 1px solid #90caf9;
}
.public-topbar a { color: #1a237e; font-weight: 700; text-decoration: underline; }

/* באנר גישה מוגבלת בדף שיעור */
.public-access-banner {
    background: linear-gradient(135deg, #fff8e1, #fff3e0);
    border: 1px solid #ffcc80;
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    margin: 1rem auto;
    max-width: 900px;
}
.public-access-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    direction: rtl;
}
.public-access-icon { font-size: 2rem; }
.public-access-content strong { color: #e65100; display: block; margin-bottom: 0.2rem; }
.public-access-content p { color: #555; font-size: 0.9rem; margin: 0; }
.public-access-content a { color: #1a237e; font-weight: 700; text-decoration: underline; }

/* כרטיסי שיעורים */
.lessons { display: flex; flex-direction: column; gap: 1rem; }
.lesson-card { background: white; padding: 1.2rem; border-radius: 10px; text-decoration: none; color: inherit; box-shadow: 0 1px 3px rgba(0,0,0,0.1); transition: box-shadow 0.2s; }
.lesson-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.15); }
.lesson-card h2 { font-size: 1.1rem; margin-bottom: 0.4rem; color: #1a237e; }
.lesson-meta { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.tag { background: #e8eaf6; color: #1a237e; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.8rem; text-decoration: none; }
.date { color: #888; font-size: 0.85rem; }
.lesson-lang { background: #fff3e0; color: #e65100; padding: 0.15rem 0.5rem; border-radius: 10px; font-size: 0.75rem; font-weight: bold; }
.lesson-summary { color: #555; font-size: 0.9rem; }

/* עמוד שיעור */
.lesson-page .lesson-info { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.lesson-page .summary { background: white; padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; border-right: 4px solid #1a237e; }

/* =============================================
   נגן אודיו
   ============================================= */
.player-container {
    background: #1a237e;
    color: white;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(26, 35, 126, 0.3);
}

.player-top {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.play-btn:hover { background: rgba(255,255,255,0.2); border-color: white; }
.play-btn:active { transform: scale(0.93); }

.player-middle {
    flex: 1;
    min-width: 0;
}

.progress-bar {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.progress-bar::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
}

.player-time {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.player-bottom {
    margin-top: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.speed-controls {
    display: flex;
    gap: 0.3rem;
}

.speed-btn {
    padding: 0.3rem 0.65rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    background: transparent;
    font-size: 0.8rem;
    cursor: pointer;
    color: rgba(255,255,255,0.8);
    transition: all 0.2s;
}

.speed-btn:hover { border-color: white; color: white; }
.speed-btn.active { background: white; color: #1a237e; border-color: white; font-weight: 600; }

/* Volume — desktop only, vertical popup on hover */
.volume-desktop {
    position: relative;
    display: flex;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.3rem;
    transition: transform 0.2s;
}

.icon-btn:hover {
    transform: scale(1.15);
}

.volume-slider-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #283593;
    border-radius: 8px;
    padding: 0.8rem 0.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
    margin-bottom: 8px;
}

.volume-desktop:hover .volume-slider-popup {
    opacity: 1;
    visibility: visible;
}

.volume-bar-vertical {
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    writing-mode: vertical-lr;
    direction: rtl;
    width: 6px;
    height: 80px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.volume-bar-vertical::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
}

.volume-bar-vertical::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
}

/* =============================================
   תמלול מסונכרן
   ============================================= */
.synced-transcript {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.synced-transcript h2 { margin-bottom: 1rem; color: #1a237e; font-size: 1.1rem; }

.transcript-lines {
    max-height: 60vh;
    overflow-y: auto;
    line-height: 2.2;
    padding: 0.5rem;
    scroll-behavior: smooth;
}

.cue {
    display: inline;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.25s;
}

.cue:hover { background: #e8eaf6; }

.cue.active {
    background: #fff176;
    color: #1a237e;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(255, 241, 118, 0.5);
    padding: 0.2rem 0.4rem;
}

/* תמלול רגיל */
.transcript { background: white; padding: 1.5rem; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.transcript h2 { margin-bottom: 1rem; color: #1a237e; }
.transcript-text { white-space: pre-wrap; line-height: 1.8; }

/* =============================================
   טופס משוב
   ============================================= */
.feedback-section {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(26, 35, 126, 0.08);
    margin-top: 2rem;
    border: 1px solid #e8eaf6;
    position: relative;
    overflow: hidden;
}

.feedback-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #1a237e, #3949ab, #5c6bc0);
}

.feedback-section h2 {
    color: #1a237e;
    font-size: 1.25rem;
    margin-bottom: 0.4rem;
    font-weight: 700;
}

.feedback-section .feedback-subtitle {
    color: #777;
    font-size: 0.9rem;
    margin-bottom: 1.3rem;
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feedback-rating {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: #f5f5ff;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    border: 1px solid #e8eaf6;
}

.feedback-rating label {
    font-size: 1rem;
    color: #333;
    font-weight: 500;
}

.star-rating {
    display: flex;
    gap: 0.15rem;
    direction: ltr;
}

.star-rating .star {
    font-size: 2.2rem;
    color: #ddd;
    cursor: pointer;
    transition: color 0.15s, transform 0.2s;
    user-select: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.star-rating .star:hover,
.star-rating .star.hover {
    color: #ffca28;
    transform: scale(1.2);
}

.star-rating .star.active {
    color: #ff8f00;
    text-shadow: 0 2px 8px rgba(255, 143, 0, 0.3);
}

.feedback-input {
    padding: 0.85rem 1.2rem;
    border: 2px solid #e8eaf6;
    border-radius: 12px;
    font-size: 1rem;
    direction: rtl;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.feedback-input:focus {
    border-color: #3949ab;
    outline: none;
    box-shadow: 0 0 0 4px rgba(26, 35, 126, 0.08);
}

.feedback-textarea {
    padding: 0.85rem 1.2rem;
    border: 2px solid #e8eaf6;
    border-radius: 12px;
    font-size: 1rem;
    direction: rtl;
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
    line-height: 1.7;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.feedback-textarea:focus {
    border-color: #3949ab;
    outline: none;
    box-shadow: 0 0 0 4px rgba(26, 35, 126, 0.08);
}

.feedback-textarea::placeholder,
.feedback-input::placeholder {
    color: #aaa;
}

.feedback-submit {
    padding: 0.9rem 2.5rem;
    background: linear-gradient(135deg, #1a237e, #3949ab);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    align-self: flex-start;
    box-shadow: 0 4px 12px rgba(26, 35, 126, 0.25);
}

.feedback-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 35, 126, 0.35);
}

.feedback-submit:active {
    transform: translateY(0);
}

.feedback-submit:disabled {
    background: #bdbdbd;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.feedback-message {
    font-size: 0.95rem;
    padding: 0.6rem 0;
    min-height: 1.5em;
    font-weight: 500;
}

.feedback-message.success {
    color: #2e7d32;
    background: #e8f5e9;
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    border: 1px solid #a5d6a7;
}

.feedback-message.error {
    color: #c62828;
    background: #ffebee;
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    border: 1px solid #ef9a9a;
}

/* דפדוף */
.pagination { display: flex; justify-content: center; gap: 0.3rem; margin-top: 1.5rem; flex-wrap: wrap; }
.pagination a { padding: 0.5rem 0.8rem; background: white; border: 1px solid #ddd; border-radius: 6px; text-decoration: none; color: #333; font-size: 0.9rem; }
.pagination a.active { background: #1a237e; color: white; border-color: #1a237e; }

/* צ'אט CTA בדף הראשי */
.chat-cta {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #1a237e, #3949ab);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 14px;
    text-decoration: none;
    margin-bottom: 1.2rem;
    box-shadow: 0 3px 12px rgba(26, 35, 126, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}
.chat-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 35, 126, 0.35);
}
.chat-cta-icon { font-size: 1.8rem; flex-shrink: 0; }
.chat-cta-text { flex: 1; }
.chat-cta-text strong { display: block; font-size: 1.1rem; margin-bottom: 0.15rem; }
.chat-cta-text span { font-size: 0.85rem; opacity: 0.85; }
.chat-cta-arrow { font-size: 1.4rem; opacity: 0.7; flex-shrink: 0; }

.refresh-btn { text-decoration: none; font-size: 1rem; margin-right: 0.5rem; opacity: 0.6; transition: opacity 0.2s; }
.refresh-btn:hover { opacity: 1; }

/* =============================================
   מובייל
   ============================================= */
/* =============================================
   כפתורי נגישות צפים (חיפוש + תרגום)
   ============================================= */
.accessibility-fab {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    z-index: 9000;
}

.fab-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}

.fab-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.fab-btn:active {
    transform: scale(0.95);
}

.fab-search {
    background: #1a237e;
    color: white;
}

.fab-translate {
    background: #00695c;
    color: white;
}

/* חלון חיפוש בדף — ממוקם בתחתית מעל כפתורי FAB */
.page-search-overlay {
    display: none;
    position: fixed;
    bottom: 5.5rem;
    left: 1rem;
    right: 1rem;
    background: white;
    padding: 0.6rem 0.8rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    border-radius: 12px;
    z-index: 9500;
    direction: rtl;
    animation: slideUp 0.2s ease;
}

.page-search-overlay.active {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.page-search-overlay input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.7rem;
    border: 2px solid #1a237e;
    border-radius: 8px;
    font-size: 0.95rem;
    direction: rtl;
    outline: none;
}

.page-search-overlay input:focus {
    border-color: #3949ab;
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.15);
}

.page-search-info {
    font-size: 0.75rem;
    color: #666;
    white-space: nowrap;
    flex-shrink: 0;
}

.page-search-nav {
    display: flex;
    gap: 0.2rem;
    flex-shrink: 0;
}

.page-search-nav button {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.page-search-nav button:hover {
    background: #e0e0e0;
}

.page-search-close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    background: #ffebee;
    color: #c62828;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.page-search-close:hover {
    background: #ffcdd2;
}

.search-highlight {
    background: #fff176;
    border-radius: 2px;
}

.search-highlight.current {
    background: #ff9800;
    color: white;
    border-radius: 2px;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 600px) {
    header { padding: 1rem; }
    header h1 { font-size: 1.1rem; }
    main { padding: 0.7rem; }
    .search-box { flex-direction: column; }
    .search-box button { width: 100%; }

    /* נגן מובייל */
    .player-container {
        padding: 0.8rem 1rem;
        border-radius: 10px;
    }

    .player-top {
        gap: 0.6rem;
    }

    .play-btn {
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
        border-width: 2px;
    }

    .progress-bar {
        height: 10px;
        border-radius: 5px;
    }

    .progress-bar::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }

    .progress-bar::-moz-range-thumb {
        width: 22px;
        height: 22px;
    }

    .player-time {
        font-size: 0.8rem;
        margin-top: 0.3rem;
    }

    .player-bottom {
        margin-top: 0.6rem;
    }

    .speed-controls {
        width: 100%;
        gap: 0.25rem;
    }

    .speed-btn {
        flex: 1;
        text-align: center;
        padding: 0.5rem 0.3rem;
        font-size: 0.85rem;
        border-radius: 8px;
    }

    /* הסתרת ווליום במובייל */
    .volume-desktop {
        display: none;
    }

    /* תמלול מובייל */
    .synced-transcript {
        padding: 1rem;
        border-radius: 10px;
    }

    .synced-transcript h2 {
        font-size: 1rem;
        margin-bottom: 0.7rem;
    }

    .transcript-lines {
        max-height: 55vh;
        line-height: 2.4;
        font-size: 1.05rem;
        padding: 0.3rem;
    }

    .cue {
        padding: 0.25rem 0.4rem;
        border-radius: 6px;
    }

    .cue.active {
        background: #fff176;
        color: #1a237e;
        font-weight: 700;
        padding: 0.3rem 0.5rem;
        box-shadow: 0 2px 12px rgba(255, 241, 118, 0.7);
    }

    .lesson-page .summary {
        font-size: 0.9rem;
        padding: 0.8rem;
    }

    /* FAB מובייל */
    .accessibility-fab {
        bottom: 1rem;
        left: 1rem;
    }

    .fab-btn {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    /* חיפוש מובייל */
    .page-search-overlay {
        bottom: 4.5rem;
        left: 0.5rem;
        right: 0.5rem;
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .page-search-overlay input {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }

    .page-search-info {
        font-size: 0.65rem;
    }

    .page-search-nav button {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }

    .page-search-close {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }

    /* משוב מובייל */
    .feedback-section {
        padding: 1.5rem 1.2rem;
        margin-top: 1.5rem;
        border-radius: 12px;
    }

    .feedback-section h2 {
        font-size: 1.1rem;
    }

    .feedback-rating {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.7rem 1rem;
    }

    .star-rating .star {
        font-size: 2.5rem;
    }

    .feedback-submit {
        width: 100%;
        text-align: center;
        padding: 1rem;
        font-size: 1.1rem;
    }
}

@media (max-width: 380px) {
    .speed-btn {
        font-size: 0.75rem;
        padding: 0.45rem 0.2rem;
    }

    .play-btn {
        width: 46px;
        height: 46px;
    }

    .transcript-lines {
        font-size: 1rem;
        line-height: 2.2;
    }
}
