:root {
    --gold: #A67C00;
    --gold-light: rgba(166, 124, 0, 0.1);
    --gold-dark: #8a6700;
    --bg: #FDFCF8;
    --card: #FFFFFF;
    --text: #1A1A1A;
    --text-muted: #666;
    --border: #E8E2D5;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 12px;
}

.dark-theme {
    --gold: #D4AF37;
    --gold-light: rgba(212, 175, 55, 0.1);
    --gold-dark: #b8941f;
    --bg: #121212;
    --card: #1E1E1E;
    --text: #F0F0F0;
    --text-muted: #aaa;
    --border: #333;
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: 0.3s;
}
.container { max-width: 800px; margin: 0 auto; padding: 15px; }


.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.header-btn {
    padding: 6px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}
.header-btn:hover { border-color: var(--gold); color: var(--gold); }
.header-btn i { font-size: 0.9rem; }

/* Text size buttons */
.text-size-btns {
    display: flex;
    gap: 2px;
}
.text-size-btns .header-btn {
    padding: 6px 8px;
    font-weight: bold;
}

/* Search */
.search-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}
#searchInput {
    width: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.85rem;
    transition: width 0.3s, padding 0.3s;
    outline: none;
}
#searchInput.expanded {
    width: 180px;
    padding: 8px 12px;
    margin-left: 8px;
}

.category-buttons, .index-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
}
.category-btn, .index-btn {
    padding: 8px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s;
    flex: 0 0 auto;
}
.category-btn.active, .index-btn.active {
    background: var(--gold);
    color: white;
    border-color: var(--gold);
}

/* ===== PAGE TITLE ===== */
.page-title {
    text-align: center;
    margin: 20px 0 10px;
}
.page-title .arabic {
    font-family: 'Amiri', serif;
    font-size: 2rem;
    color: var(--gold);
}

/* ===== GRID & CARDS ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 20px;
}
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
    transition: 0.3s;
}
.card:hover { border-color: var(--gold); }
.card.playing {
    border: 2px solid var(--gold);
    box-shadow: 0 0 0 2px var(--gold-light);
    background: linear-gradient(145deg, var(--gold-light), transparent);
}

/* ===== ARABIC TEXT ===== */
.text-ar {
    font-family: 'Amiri', serif;
    font-size: 1.8rem;
    line-height: 2.2;
    text-align: right;
    margin: 15px 0;
    color: #8B7355;
    font-weight: 700;
    border-bottom: 1px dashed rgba(139, 115, 85, 0.2);
    padding-bottom: 10px;
}
.dark-theme .text-ar { color: #D4AF37; }

/* ===== TRANSLATIONS ===== */
.translation, .text-ar-mal.translation {
    color: #2C3E50;
    font-size: 1rem;
    line-height: 1.8;
    margin: 15px 0;
    padding: 12px 18px;
    background: linear-gradient(145deg, #F9F7F5, #FFFFFF);
    border-left: 4px solid #A67C00;
    border-radius: 0 12px 12px 0;
    font-family: 'Inter', sans-serif;
    position: relative;
}
.dark-theme .translation, .dark-theme .text-ar-mal.translation {
    color: #E8E6E1;
    background: linear-gradient(145deg, #1E1E1E, #252525);
    border-left-color: #D4AF37;
}
.translation::before {
    content: '"';
    font-size: 2rem;
    color: rgba(166, 124, 0, 0.2);
    position: absolute;
    top: -5px;
    left: 10px;
    font-family: serif;
}

/* ===== TOOLTIPS ===== */
.word-tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 2px dotted #A67C00;
    cursor: pointer;
    color: #8B4513;
    font-weight: 700;
    padding: 0 2px;
    transition: 0.2s;
    background: linear-gradient(120deg, rgba(166, 124, 0, 0.05), transparent);
    border-radius: 4px 4px 0 0;
}
.dark-theme .word-tooltip {
    color: #F4C542;
    border-bottom-color: #D4AF37;
}
.word-tooltip:hover { background: rgba(166, 124, 0, 0.1); }
.word-meaning {
    visibility: hidden;
    position: absolute;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: #2C3E50;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    opacity: 0;
    transition: 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.dark-theme .word-meaning { background: #D4AF37; color: #121212; }
.word-tooltip:hover .word-meaning {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) scale(1);
    bottom: 140%;
}
.word-meaning::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #2C3E50 transparent transparent transparent;
}
.dark-theme .word-meaning::after { border-color: #D4AF37 transparent transparent transparent; }

/* ===== FAVORITE BUTTON ===== */
.fav-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
}
.fav-btn:hover { color: var(--gold); }
.fav-btn.fav { color: var(--gold); }

/* ===== AUDIO BUTTON ===== */
.audio-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
.audio-btn:hover { background: var(--gold-dark); }
.audio-btn.playing { background: #e74c3c; }

/* ===== AUDIO PLAYER ===== */
.audio-player {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 8px 16px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
}
.play-all-btn {
    padding: 8px 20px;
    background: var(--gold);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.play-all-btn.playing { background: #e74c3c; }

/* ===== INFO BADGE ===== */
.info-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(166, 124, 0, 0.08);
    border-radius: 50px;
    color: #8B7355;
    font-size: 0.7rem;
    font-weight: 600;
}
.dark-theme .info-badge {
    background: rgba(212, 175, 55, 0.1);
    color: #E5C87B;
}

/* ===== REFERENCE ===== */
.reference {
    color: #A67C00;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(166, 124, 0, 0.08);
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
}
.dark-theme .reference {
    color: #D4AF37;
    background: rgba(212, 175, 55, 0.1);
}

/* ===== RTL SUPPORT ===== */
[dir="rtl"] .header-left { flex-direction: row-reverse; }
[dir="rtl"] .header-right { flex-direction: row-reverse; }
[dir="rtl"] .translation {
    border-left: none;
    border-right: 4px solid #A67C00;
    border-radius: 12px 0 0 12px;
}
[dir="rtl"] .translation::before {
    left: auto;
    right: 10px;
}
[dir="rtl"] .fav-btn {
    right: auto;
    left: 15px;
}


/* ===== HOMEPAGE STYLES (ADD THESE) ===== */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.hero {
    text-align: center;
    padding: 30px 20px;
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.hub-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 25px 15px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: 0.3s;
}

.hub-card:hover {
    border-color: var(--gold);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(166, 124, 0, 0.1);
}

.hub-icon {
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 15px;
}

.badge {
    background: var(--gold);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: inline-block;
    margin-top: 10px;
}

/* ===== RTL FIXES FOR ADKAR ===== */
[dir="rtl"] .card {
    text-align: right;
}

[dir="rtl"] .info-badge {
    margin-left: 0;
    margin-right: 0;
}

[dir="rtl"] .fav-btn {
    right: auto;
    left: 15px;
}

[dir="rtl"] .translation {
    border-left: none;
    border-right: 4px solid #A67C00;
    border-radius: 12px 0 0 12px;
    padding-left: 18px;
    padding-right: 18px;
}

[dir="rtl"] .translation::before {
    left: auto;
    right: 10px;
    transform: scaleX(-1); /* Flip quote mark for RTL */
}

[dir="rtl"] .text-ar {
    text-align: right;
}

[dir="rtl"] .compact-header .header-left {
    flex-direction: row-reverse;
}

[dir="rtl"] .compact-header .header-right {
    flex-direction: row-reverse;
}

[dir="rtl"] .search-wrapper #searchInput.expanded {
    margin-left: 0;
    margin-right: 8px;
}

.dropdown-panel.show { display: block; }

/* Category / index buttons container */
.category-buttons, .index-buttons {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

/* Individual buttons */
.category-btn, .index-btn {
    padding: 8px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s;
    flex: 0 0 auto;
}
.category-btn:hover, .index-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}
.category-btn.active, .index-btn.active {
    background: var(--gold);
    color: white;
    border-color: var(--gold);
}
.text-ar {
    direction: rtl !important;
    unicode-bidi: embed;
    text-align: right;
}
/* Force correct Arabic rendering */
.text-ar {
    direction: rtl !important;
    unicode-bidi: embed;
    text-align: right;
}

/* Category/index buttons container */
.category-buttons, .index-buttons {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

/* Audio player fixed at bottom */
.audio-player {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 10px 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    gap: 10px;
    z-index: 1000;
}
.play-all-btn {
    padding: 8px 20px;
    background: var(--gold);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.play-all-btn.playing {
    background: #e74c3c;
}

/* Highlight playing card */
.card.playing {
    border: 2px solid var(--gold);
    box-shadow: 0 0 0 3px var(--gold-light);
    background: linear-gradient(145deg, var(--gold-light), transparent);
}
/* Audio player styling */
.audio-player {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 8px 16px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    gap: 10px;
    z-index: 1000;
    align-items: center;
}

.play-all-btn {
    padding: 8px 20px;
    background: var(--gold);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
    justify-content: center;
}

.play-all-btn.playing {
    background: #e74c3c;
}

.audio-control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.audio-control-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.card.playing {
    border: 2px solid var(--gold);
    box-shadow: 0 0 0 3px var(--gold-light);
    background: linear-gradient(145deg, var(--gold-light), transparent);
}

.audio-btn.playing {
    background: #e74c3c;
}
/* ===== HERO SECTION ===== */
.hero {
    text-align: center;
    padding: 30px 20px;
}

.hero .arabic {
    font-family: 'Amiri', serif;
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 10px;
}

.hero .subtitle {
    color: var(--gold);
    opacity: 0.8;
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--card);
    color: var(--text);
    padding: 12px 24px;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-left: 4px solid var(--gold);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 90%;
    text-align: center;
    font-size: 0.9rem;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
/* ===== HUB CARDS ===== */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.hub-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 25px 15px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: 0.3s;
    display: block;
}

.hub-card:hover {
    border-color: var(--gold);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(166, 124, 0, 0.1);
}

.hub-icon {
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 15px;
}

.badge {
    background: var(--gold);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: inline-block;
    margin-top: 10px;
}

/* ===== ARABIC TEXT (ensure global styling) ===== */
.arabic {
    font-family: 'Amiri', serif;
    color: var(--gold);
    line-height: 1.4;
}

/* ===== COMPACT HEADER (Sticky) ===== */
.compact-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 8px;
}

/* ===== DROPDOWN PANEL (Sticky below header) ===== */
.dropdown-panel {
    position: sticky;
    top: 60px;               /* sits just below the header */
    z-index: 99;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 15px;
    margin: 0 12px 10px;
    box-shadow: var(--shadow);
    max-height: 350px;
    overflow-y: auto;
    display: none;            /* hidden by default */
    transition: none;         /* no auto‑close animation */
}

.dropdown-panel.show {
    display: block;           /* shown when toggled */
}

/* ===== CATEGORY / INDEX BUTTONS INSIDE PANEL ===== */
.category-buttons, .index-buttons {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 600px) {
    .compact-header {
        flex-direction: column;
        align-items: stretch;
    }
    .header-left, .header-right {
        justify-content: center;
    }
    #searchInput.expanded {
        width: 140px;
    }
    .grid {
        grid-template-columns: 1fr;
    }
    .text-ar {
        font-size: 1.6rem;
    }
    .dropdown-panel {
        top: 100px;            /* taller header on mobile */
    }
}
.btn.primary {
    background: var(--gold);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}
.btn.primary:hover {
    background: var(--gold-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(166,124,0,0.3);
}



