/* ============================================================
   Verse Feed — Quran Verse Card Feed System
   ============================================================
   Brand: Quranic Insights | by eBlessings
   Design tokens:
     parchment-light   #fdf8f0
     card-bg           #ffffff
     card-border       rgba(180, 160, 120, 0.2)
     card-shadow       0 2px 12px rgba(0, 0, 0, 0.06)
     gold              #c9a84c
     emerald           #0d5c3a
     sepia-text        #5a4a3a
     sepia-muted       #8B7355
     purple            #8E44AD
     arabic-font       'Amiri Quran', 'Scheherazade New', 'Amiri', serif
   ============================================================ */


/* ============================================================
   1. FEED CONTAINER
   ============================================================ */

.verse-feed {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px 120px;
}


/* ============================================================
   2. FEED HEADER (sticky controls)
   ============================================================ */

.feed-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fdf8f0;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(180, 160, 120, 0.12);
    margin-bottom: 12px;
}

.feed-sura-title {
    font-family: 'Amiri', serif;
    font-size: 1.4rem;
    color: #5a4a3a;
    margin: 0;
    padding: 10px 0 2px;
    line-height: 1.3;
}

.feed-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.feed-view-toggle {
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(180, 160, 120, 0.3);
    flex-shrink: 0;
}

.feed-view-btn {
    padding: 4px 12px;
    font-size: 0.75rem;
    border: none;
    background: transparent;
    color: #8B7355;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-weight: 500;
    line-height: 1.4;
}

.feed-view-btn:hover {
    background: rgba(13, 92, 58, 0.06);
    color: #5a4a3a;
}

.feed-view-btn.active {
    background: #0d5c3a;
    color: #fff;
}

.feed-learning-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: #8B7355;
    flex-shrink: 0;
}

.feed-learning-toggle .form-check-input:checked {
    background-color: #0d5c3a;
    border-color: #0d5c3a;
}

.feed-progress {
    font-size: 0.72rem;
    color: #8B7355;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}


/* ============================================================
   3. VERSE CARD (collapsed state)
   ============================================================ */

.feed-card {
    background: #fff;
    border: 1px solid rgba(180, 160, 120, 0.2);
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
    content-visibility: auto;
    contain-intrinsic-size: 0 200px;
}

.feed-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-color: rgba(201, 168, 76, 0.4);
}

.feed-card.feed-card-active {
    border-left: 3px solid #c9a84c;
}

.feed-card.active-playing {
    border-left: 3px solid #0d5c3a;
    box-shadow: 0 4px 20px rgba(13, 92, 58, 0.15);
}


/* ============================================================
   4. CARD HEADER
   ============================================================ */

.feed-card-header {
    display: flex;
    align-items: center;
    padding: 10px 16px 0;
    gap: 8px;
}

.feed-card-ref {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 26px;
    padding: 0 10px;
    border: 1.5px solid #c9a84c;
    border-radius: 13px;
    background: rgba(201, 168, 76, 0.08);
    font-family: 'Amiri', serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: #5a4a3a;
    white-space: nowrap;
    user-select: none;
    flex-shrink: 0;
}

.feed-card-maslow-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.feed-card-header-spacer {
    flex: 1;
}

.feed-card-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(180, 160, 120, 0.25);
    background: transparent;
    color: #8B7355;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.feed-card-btn:hover {
    border-color: #c9a84c;
    background: rgba(201, 168, 76, 0.08);
    color: #5a4a3a;
}

.feed-card-btn.feed-bookmarked {
    color: #c9a84c;
    border-color: #c9a84c;
    background: rgba(201, 168, 76, 0.12);
}

.feed-card-btn.feed-play-btn {
    border-color: #0d5c3a;
    color: #0d5c3a;
}

.feed-card-btn.feed-play-btn:hover {
    background: rgba(13, 92, 58, 0.08);
}

.feed-expand-btn {
    transition: transform 0.3s;
}

.feed-card.expanded .feed-expand-btn {
    transform: rotate(180deg);
}


/* ============================================================
   5. CARD BODY
   ============================================================ */

.feed-card-body {
    padding: 12px 20px 8px;
}

.feed-card-bismillah {
    text-align: center;
    font-family: 'Amiri Quran', 'Amiri', serif;
    font-size: 1.3rem;
    color: #0d5c3a;
    padding: 8px 0;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(13, 92, 58, 0.1);
}

.feed-card-arabic {
    text-align: center;
    font-family: 'Amiri Quran', 'Scheherazade New', 'Amiri', serif;
    font-size: 1.8rem;
    line-height: 2.2;
    color: #1a1a1a;
    direction: rtl;
    padding: 12px 0 8px;
    word-spacing: 6px;
}

.feed-card-ornament {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid #c9a84c;
    color: #c9a84c;
    font-family: 'Amiri', serif;
    font-size: 0.72rem;
    font-weight: 700;
    margin: 0 auto;
    background: rgba(201, 168, 76, 0.06);
}

.feed-card-translation {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #34495E;
    padding: 8px 0;
    font-style: italic;
    text-align: center;
    position: relative;
}

.feed-card-attribution {
    text-align: right;
    font-size: 0.75rem;
    color: #8B7355;
    padding: 0 0 4px;
    font-style: italic;
}


/* ============================================================
   6. CARD TAGS (footer strip)
   ============================================================ */

.feed-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 16px 10px;
    border-top: 1px solid rgba(180, 160, 120, 0.1);
}

.feed-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    border: 1px solid;
    white-space: nowrap;
}

.feed-tag-maslow {
    border-color: currentColor;
}

.feed-tag-emotion {
    border-color: #c9a84c;
    color: #8B7355;
    background: rgba(201, 168, 76, 0.06);
}

.feed-tag-character {
    border-color: rgba(180, 160, 120, 0.3);
    color: #5a4a3a;
    background: rgba(180, 160, 120, 0.06);
    cursor: pointer;
}

.feed-tag-character:hover {
    border-color: #c9a84c;
}


/* ============================================================
   7. CARD DRAWER (expanded content)
   ============================================================ */

.feed-card-drawer {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease 0.05s,
                padding 0.4s ease;
    padding: 0 20px;
    border-top: 0 solid rgba(180, 160, 120, 0.1);
}

.feed-card.expanded .feed-card-drawer {
    max-height: 3000px;
    opacity: 1;
    padding: 12px 20px 16px;
    border-top-width: 1px;
}

.drawer-section {
    margin-bottom: 12px;
}

.drawer-section:last-child {
    margin-bottom: 0;
}

.drawer-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #8B7355;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}


/* ============================================================
   8. DRAWER: TRANSLITERATION
   ============================================================ */

.drawer-transliteration {
    font-style: italic;
    color: #8E44AD;
    font-size: 0.92rem;
    line-height: 1.6;
    text-align: center;
    padding: 8px 12px;
    background: rgba(142, 68, 173, 0.06);
    border-radius: 8px;
}


/* ============================================================
   9. DRAWER: WORD-BY-WORD TABLE
   ============================================================ */

.drawer-wbw-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.drawer-wbw-table th {
    color: #8B7355;
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    padding: 4px 6px;
    border-bottom: 1px solid rgba(180, 160, 120, 0.2);
}

.drawer-wbw-table td {
    padding: 6px;
    border-bottom: 1px solid rgba(180, 160, 120, 0.08);
}

.drawer-wbw-table .wbw-ar {
    font-family: 'Amiri', serif;
    font-size: 1.1rem;
    direction: rtl;
    text-align: right;
    color: #1a1a1a;
}

.drawer-wbw-table .wbw-tr {
    font-style: italic;
    color: #8E44AD;
}

.drawer-wbw-table .wbw-en {
    color: #34495E;
}

.drawer-wbw-table .wbw-root {
    color: #8B7355;
    font-family: monospace;
    font-size: 0.72rem;
}

.drawer-wbw-table .wbw-pos {
    color: #8B7355;
    font-size: 0.68rem;
}

/* Learning mode: click-through highlighting */
.drawer-wbw-table td.wbw-active {
    background: rgba(201, 168, 76, 0.15);
    box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.3);
    border-radius: 4px;
}


/* ============================================================
   10. DRAWER: MASLOW MINI-BARS
   ============================================================ */

.drawer-needs {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.drawer-need-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.drawer-need-label {
    width: 56px;
    font-size: 0.68rem;
    color: #8B7355;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.drawer-need-bar {
    flex: 1;
    height: 5px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
}

.drawer-need-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.drawer-need-val {
    width: 16px;
    font-size: 0.65rem;
    font-weight: 600;
    text-align: right;
}


/* ============================================================
   11. DRAWER: PSYCHE BADGES
   ============================================================ */

.drawer-psyche-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.drawer-psyche-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 600;
    border: 1px solid;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.drawer-psyche-badge .badge-label {
    font-size: 0.6rem;
    color: #8B7355;
    font-weight: 400;
}


/* ============================================================
   12. DRAWER: SCENE
   ============================================================ */

.drawer-scene {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.drawer-scene-chip {
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.68rem;
    background: rgba(180, 160, 120, 0.08);
    color: #5a4a3a;
    border: 1px solid rgba(180, 160, 120, 0.15);
}

.drawer-scene-chip i {
    font-size: 0.6rem;
    margin-right: 3px;
    color: #8B7355;
}

.drawer-sounds {
    font-style: italic;
    font-size: 0.75rem;
    color: #8B7355;
    margin-top: 4px;
}


/* ============================================================
   13. DRAWER: ENRICHMENT (collapsible sections)
   ============================================================ */

.drawer-enrichment-item {
    margin-bottom: 8px;
}

.drawer-enrichment-item:last-child {
    margin-bottom: 0;
}

.drawer-enrichment-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: #5a4a3a;
    padding: 4px 0;
    user-select: none;
}

.drawer-enrichment-toggle i {
    font-size: 0.65rem;
    color: #c9a84c;
    transition: transform 0.2s;
}

.drawer-enrichment-item.open .drawer-enrichment-toggle i {
    transform: rotate(90deg);
}

.drawer-enrichment-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #34495E;
    padding-left: 18px;
}

.drawer-enrichment-item.open .drawer-enrichment-content {
    max-height: 500px;
    padding-top: 4px;
}


/* ============================================================
   14. DRAWER: AUDIO BUTTONS
   ============================================================ */

.drawer-audio {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.drawer-audio .audio-trigger-btn {
    height: 30px;
    padding: 0 14px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
}


/* ============================================================
   15. DRAWER: ACTIONS ROW
   ============================================================ */

.drawer-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid rgba(180, 160, 120, 0.1);
}

.drawer-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.72rem;
    color: #8B7355;
    border: 1px solid rgba(180, 160, 120, 0.25);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.drawer-action-btn:hover {
    border-color: #c9a84c;
    color: #5a4a3a;
}

.drawer-action-btn i {
    font-size: 0.65rem;
}


/* ============================================================
   16. LEARNING MODE
   ============================================================ */

.verse-feed.learning-mode .feed-card-translation {
    filter: blur(8px);
    cursor: pointer;
    user-select: none;
    transition: filter 0.3s ease;
}

.verse-feed.learning-mode .feed-card-translation.revealed {
    filter: none;
    cursor: default;
}

.verse-feed.learning-mode .feed-card-translation::after {
    content: 'Tap to reveal';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.72rem;
    color: #8B7355;
    font-style: normal;
    opacity: 1;
    pointer-events: none;
}

.verse-feed.learning-mode .feed-card-translation.revealed::after {
    opacity: 0;
}

/* Auto-show transliteration in learning mode */
.verse-feed.learning-mode .drawer-transliteration-peek {
    display: block;
}

.feed-repeat-control {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(180, 160, 120, 0.3);
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 0.7rem;
}

.feed-repeat-control button {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #8B7355;
    cursor: pointer;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.feed-repeat-control button:hover {
    background: rgba(201, 168, 76, 0.1);
}

.feed-repeat-count {
    min-width: 14px;
    text-align: center;
    font-weight: 700;
    color: #5a4a3a;
}


/* ============================================================
   17. FEED SENTINEL (infinite scroll trigger)
   ============================================================ */

.feed-sentinel {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feed-sentinel-loading {
    font-size: 0.78rem;
    color: #8B7355;
}

.feed-sentinel-loading i {
    animation: feed-spin 1s linear infinite;
    margin-right: 6px;
}

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


/* ============================================================
   18. RESPONSIVE: below 768px
   ============================================================ */

@media (max-width: 768px) {
    .feed-card-arabic {
        font-size: 1.5rem;
    }

    .feed-card-body {
        padding: 10px 14px 6px;
    }

    .feed-card-header {
        padding: 8px 12px 0;
    }

    .feed-card-tags {
        padding: 4px 12px 8px;
    }

    .drawer-wbw-table .wbw-root,
    .drawer-wbw-table .wbw-pos {
        display: none;
    }
}


/* ============================================================
   19. RESPONSIVE: below 480px
   ============================================================ */

@media (max-width: 480px) {
    .verse-feed {
        padding: 0 8px 100px;
    }

    .feed-card {
        border-radius: 12px;
        margin-bottom: 8px;
    }

    .feed-card-arabic {
        font-size: 1.3rem;
        line-height: 2;
    }

    .feed-card-translation {
        font-size: 0.88rem;
    }

    .feed-card-btn {
        width: 26px;
        height: 26px;
        font-size: 0.65rem;
    }

    .feed-card-ref {
        height: 24px;
        font-size: 0.75rem;
        min-width: 46px;
    }
}


/* ============================================================
   20. PRINT
   ============================================================ */

@media print {
    .feed-header,
    .feed-card-header .feed-card-btn,
    .feed-card-drawer,
    .feed-card-tags,
    .feed-sentinel {
        display: none !important;
    }

    .feed-card {
        break-inside: avoid;
        border: none;
        box-shadow: none;
        margin-bottom: 20px;
    }
}
