:root {
    --primary: #c2996b;
    --primary-light: #d4b08c;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Themes */
body.theme-dark,
body {
    --bg-dark: #0f172a;
    --bg-dark-glass: rgba(15, 23, 42, 0.9);
    --bg-page: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    /* Mukabele Colors */
    --mukabele-base: #f8fafc;
    /* Whiteish */
    --mukabele-paint: #fbbf24;
    /* Yellow */
}

body.theme-light {
    --bg-dark: #ffffff;
    --bg-dark-glass: rgba(255, 255, 255, 0.9);
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: rgba(0, 0, 0, 0.08);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    /* Mukabele Colors */
    --mukabele-base: #1e293b;
    /* Dark */
    --mukabele-paint: #10b981;
    /* Greenish/Emerald */
}

body.theme-midnight {
    --bg-dark: #020617;
    --bg-dark-glass: rgba(2, 6, 23, 0.9);
    --bg-page: #020617;
    --bg-card: #0f172a;
    --text-main: #f1f5f9;
    --text-muted: #64748b;
    --border: rgba(255, 255, 255, 0.05);
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    /* Mukabele Colors */
    --mukabele-base: #ffffff;
    --mukabele-paint: #fbbf24;
    /* Yellow */
}

body.theme-sepia {
    --bg-dark: #f4ecdb;
    --bg-dark-glass: rgba(244, 236, 219, 0.9);
    --bg-page: #f4ecdb;
    --bg-card: #ece2c6;
    --text-main: #433422;
    --text-muted: #7f6e5d;
    --border: rgba(67, 52, 34, 0.1);
    --card-shadow: 0 10px 30px rgba(67, 52, 34, 0.05);
    /* Mukabele Colors */
    --mukabele-base: #433422;
    /* Dark Brown */
    --mukabele-paint: #b91c1c;
    /* Red */
}

body.theme-emerald {
    --bg-dark: #022c22;
    /* Deepest Forest Emerald */
    --bg-dark-glass: rgba(2, 44, 34, 0.95);
    --bg-page: #011f18;
    /* Dark Night Green */
    --bg-card: rgba(6, 78, 59, 0.4);
    --text-main: #f0fdf4;
    --text-muted: #10b981;
    --primary: #fbbf24;
    /* Golden Amber */
    --primary-light: #fef3c7;
    --border: rgba(251, 191, 36, 0.2);
    --card-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    --mukabele-base: #f0fdf4;
    --mukabele-paint: #fbbf24;
}

body.theme-ruby {
    --bg-dark: #450a0a;
    /* Deepest Ruby/Bordeaux */
    --bg-dark-glass: rgba(69, 10, 10, 0.95);
    --bg-page: #270505;
    /* Dark Night Bordeaux */
    --bg-card: rgba(127, 29, 29, 0.4);
    --text-main: #fef2f2;
    --text-muted: #fca5a5;
    --primary: #fbbf24;
    /* Golden Amber */
    --primary-light: #fef3c7;
    --border: rgba(251, 191, 36, 0.2);
    --card-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    --mukabele-base: #fef2f2;
    --mukabele-paint: #fbbf24;
}

/* Emerald & Ruby Theme UI Fixes */
/* Emerald & Ruby Theme UI Fixes REMOVED main-play override */

/* Standard Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.hidden {
    display: none !important;
}

#app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: var(--bg-dark);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 0;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.logo-link {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.sidebar-header .logo-img {
    height: 50px;
    width: auto;
    display: block;
}

.sidebar-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.7rem;
    font-weight: 500;
}

.nav-tabs {
    display: flex;
    background: rgba(128, 128, 128, 0.1);
    border-radius: 10px;
    padding: 3px;
    margin-top: 1.5rem;
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    border-radius: 8px;
    transition: 0.2s;
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.search-box {
    margin: 1rem 1.5rem;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    outline: none;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    fill: var(--text-muted);
}

.surah-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem 200px;
}

.surah-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    margin-bottom: 0.4rem;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
}

.surah-item:hover {
    background: var(--bg-card);
}

.surah-item.active {
    background: rgba(194, 153, 107, 0.12) !important;
    border: 1px solid var(--primary);
    box-shadow: inset 4px 0 0 var(--primary);
    transform: translateX(5px);
}

.surah-item.active .num {
    background: var(--primary) !important;
    color: white !important;
    font-weight: 800;
}

.surah-item.active .name {
    color: var(--primary) !important;
    font-weight: 800;
}

.surah-item .num {
    width: 32px;
    height: 32px;
    background: rgba(194, 153, 107, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 700;
    margin-right: 1rem;
}

.surah-item .info .name {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.2;
}

.surah-item .info .sub-name {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.surah-item .info .meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Sidebar Brand Logo Overlay */
.sidebar-brand-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    transition: var(--transition);
}

.sidebar-brand-link {
    display: block;
    transition: var(--transition);
    opacity: 0.7;
}

.sidebar-brand-link:hover {
    opacity: 1;
    transform: translateY(-5px);
}

.sidebar-brand-img {
    max-width: 140px;
    height: auto;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.2));
}

/* Content Area */
.content-view {
    flex: 1;
    overflow-y: auto;
    padding: 3rem;
    background-color: var(--bg-page);
}

.view-item {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Landing View Styles */
.hero-content {
    padding: 3rem 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-bismillah {
    font-family: 'Amiri', serif;
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.hero-badge {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    background: rgba(194, 153, 107, 0.1);
    border: 1px solid rgba(194, 153, 107, 0.2);
    border-radius: 50px;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.hero-title span {
    color: var(--primary);
}

.hero-desc {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 500px;
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* Continue Card */
.continue-card {
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    margin-bottom: 3rem;
    animation: slideUp 0.6s ease;
}

.continue-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
}

.continue-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

#lastSurahName {
    font-size: 1.2rem;
    font-weight: 800;
}

#lastVerseNum {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.continue-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.continue-btn:hover {
    transform: scale(1.05);
    background: var(--primary-light);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.surah-grid-main {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
    padding-bottom: 150px;
    /* Footer altında kalmaması için */
}

@media (min-width: 1400px) {
    .surah-grid-main {
        grid-template-columns: repeat(7, 1fr);
    }
}

.grid-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.grid-card .num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.2rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.grid-card .name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display: block;
    line-height: 1.2;
}

.grid-card .sub-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.grid-card .meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.grid-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.grid-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.grid-card:hover::after {
    transform: scaleX(1);
}

/* Detail View Header */
.detail-header {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 24px;
    border: 1px solid var(--border);
    margin-bottom: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--card-shadow);
}

.title-wrap {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.surah-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    opacity: 0.5;
}

#detailTitle {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: 'Playfair Display', serif;
}

.badge-group {
    display: flex;
    gap: 0.75rem;
}

.badge {
    padding: 0.5rem 1.2rem;
    background: rgba(194, 153, 107, 0.1);
    border-radius: 50px;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid rgba(194, 153, 107, 0.2);
}

/* Verse List */
.verse-list {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding-bottom: 180px;
}

.verse-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 3rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.5s ease,
        border-color 0.5s ease,
        background-color 0.5s ease;
    position: relative;
}

.v-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.v-card-actions {
    display: flex;
    gap: 1rem;
}

.v-action-btn {
    background: rgba(128, 128, 128, 0.1);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.v-action-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.v-action-btn.selected {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
}

/* Share Menu Styles */
.share-menu {
    position: absolute;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.6rem;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    z-index: 10000;
    width: 260px;
    /* Fixed width to prevent excessive stretching */
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(10px);
}

.share-menu-header {
    display: block;
    padding: 0.4rem 1rem;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
    opacity: 0.8;
}

.share-menu-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: var(--transition);
}

.share-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.share-menu-item.whatsapp svg {
    color: #25d366;
    /* Sadece ikon yeşil kalsın ki ayırt edilsin */
    opacity: 0.8;
}

.share-menu-item.whatsapp:hover {
    color: #25d366;
}

.share-menu-item.copy {
    border-top: 1px solid var(--border);
    margin-top: 0.3rem;
    padding-top: 0.8rem;
    color: var(--text-muted);
}

.share-menu-item.copy:hover {
    color: var(--primary);
}

/* Toast Notification */
.toast-notice {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--primary);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.9rem;
    z-index: 3000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.4s ease;
    pointer-events: none;
}

.toast-notice.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.verse-card.active {
    border-color: var(--primary);
    border-width: 2px;
    transform: scale(1.03) translateY(-10px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    background: var(--bg-dark-glass);
    z-index: 10;
}

.v-item.arap {
    font-family: var(--fontArap, 'Amiri'), serif;
    font-size: var(--fontSizeArap, 2.2rem);
    text-align: right;
    line-height: 2.2;
    margin-bottom: 2rem;
    transition: color 0.4s ease;
}

body.theme-emerald .v-item.arap,
body.theme-ruby .v-item.arap,
body.theme-emerald .hero-title span,
body.theme-ruby .hero-title span,
body.theme-emerald .hero-bismillah,
body.theme-ruby .hero-bismillah {
    background: linear-gradient(135deg, #fbbf24 0%, #fcd34d 25%, #f59e0b 50%, #fbbf24 75%, #fcf3d7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    font-weight: 700;
}

.v-item.pron {
    font-family: var(--fontPron, inherit);
    font-size: var(--fontSizePron, 1.4rem);
    font-weight: 700;
    border-left: 5px solid var(--primary);
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.v-item.mean {
    font-family: var(--fontMean, inherit);
    font-size: var(--fontSizeMean, 1.2rem);
    color: var(--text-muted);
    line-height: 1.8;
}

/* Juz Separator Styling */
.juz-separator {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    padding: 5rem 0 3rem;
    margin: 2rem 0;
}

.juz-separator::before,
.juz-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--primary), transparent);
    opacity: 0.5;
}

.juz-separator span {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 8px;
    font-family: 'Playfair Display', serif;
    white-space: nowrap;
}

/* PLAYER FOOTER - THE CRITICAL PART */
.player-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-dark-glass);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 1.5rem 2.5rem;
    /* Increased padding */
    z-index: 1000;
    box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.4);
    min-height: 110px;
    /* Modern height */
    display: flex;
    align-items: center;
}

.player-container {
    max-width: 1500px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.player-main-controls {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.player-info {
    min-width: 200px;
}

#playerSurahName {
    font-weight: 800;
    color: var(--primary);
    font-size: 1.2rem;
    display: block;
}

#playerVerseInfo {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Standardized Player UI */
.player-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    position: relative;
}

/* Base style for all control containers */
.loop-group,
.speed-wrap,
.scroll-toggle,
.settings-toggle {
    background: rgba(128, 128, 128, 0.08) !important;
    border: none !important;
    border-radius: 12px !important;
    height: 52px !important;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.volume-wrap {
    background: rgba(128, 128, 128, 0.08) !important;
    border: none !important;
    border-radius: 12px !important;
    height: 52px !important;
    width: 52px !important;
    /* Square fixed width for perfect centering */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition);
}

.scroll-toggle,
.settings-toggle {
    width: 52px !important;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
}

.loop-select,
.speed-select {
    background: transparent !important;
    border: none !important;
    color: var(--text-main) !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    height: 100% !important;
    padding: 0 1rem !important;
    cursor: pointer;
    outline: none !important;
}

.loop-select option,
.speed-select option {
    background: var(--bg-card);
    color: var(--text-main);
}

.audio-btn.main-play {
    width: 170px !important;
    height: 52px !important;
    background: #dc2626 !important;
    color: white !important;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    cursor: pointer;
}

.audio-btn.main-play:hover {
    background: #ef4444 !important;
    transform: scale(1.02);
}

.mute-btn {
    background: transparent !important;
    border: none !important;
    color: var(--primary);
    width: 100% !important;
    height: 100% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Perfect icon centering */
    cursor: pointer;
    padding: 0 !important;
}

.volume-popover {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    width: 46px;
    /* Fixed width for perfect calibration */
    height: 140px;
    /* Fixed height */
    border-radius: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover Bridge: Connection between icon and popover to prevent immediate disappearance */
.volume-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 30px;
    /* Stronger bridge connection */
    background: transparent;
}

/* Arrow indicator */
.volume-popover::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--bg-card);
}

.volume-wrap:hover .volume-popover {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 5px;
    background: var(--border);
    border-radius: 5px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    margin: 0;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--bg-card);
}

/* Loop & Control Specifics */
.control-group:not(:last-child)::after {
    content: '';
    width: 1px;
    height: 30px;
    background: var(--border);
    margin-left: 0.5rem;
    opacity: 0.3;
}

.scroll-toggle.active,
.settings-toggle.active {
    color: var(--primary);
    border-color: var(--primary) !important;
    background: rgba(194, 153, 107, 0.12) !important;
}

.settings-toggle:hover {
    transform: rotate(30deg);
}

/* Settings Slide-up Panel */
.settings-panel {
    position: fixed;
    bottom: 85px;
    /* Above Footer */
    left: 0;
    right: 0;
    background: var(--bg-dark-glass);
    backdrop-filter: blur(25px);
    border-top: 1px solid var(--border);
    border-radius: 30px 30px 0 0;
    z-index: 999;
    padding: 2rem;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.4);
    transform: translateY(125%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
    max-height: 85vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.settings-panel::-webkit-scrollbar {
    width: 6px;
}

.settings-panel::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.settings-panel.active {
    transform: translateY(0);
    visibility: visible;
}

.settings-panel-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Settings Slide-up Panel REBORN */
.panel-close-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: var(--transition);
}

.panel-close-btn:hover {
    opacity: 1;
    color: var(--primary);
    transform: translateY(3px);
}

.settings-panel-content {
    max-width: 900px;
    margin: 0 auto;
}

.settings-sections {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 3rem;
    padding-bottom: 1rem;
}

.section-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
    opacity: 0.9;
    text-transform: uppercase;
}

.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-card {
    background: rgba(128, 128, 128, 0.05);
    border: 1px solid var(--border);
    padding: 1rem 1.2rem;
    border-radius: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.setting-card.col-flex {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
}

.setting-card .s-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.font-select {
    background: rgba(128, 128, 128, 0.08) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.font-select:hover {
    border-color: var(--primary) !important;
    background: rgba(128, 128, 128, 0.12) !important;
}

.font-select option {
    background: var(--bg-card);
    color: var(--text-main);
}

.setting-card .s-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.lang-title {
    margin-top: 2rem;
}

.lang-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.8rem;
}

@media (max-width: 600px) {
    .lang-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 400px) {
    .lang-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.lang-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: rgba(128, 128, 128, 0.1);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.lang-btn:hover {
    transform: scale(1.15) translateY(-2px);
    background: rgba(128, 128, 128, 0.15);
}

.lang-btn.active {
    border-color: var(--primary);
    background: rgba(194, 153, 107, 0.2);
    box-shadow: 0 0 15px rgba(194, 153, 107, 0.3);
    transform: scale(1.1);
}

/* Switch Toggle UI */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(128, 128, 128, 0.2);
    transition: .4s;
    border: 1px solid var(--border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Tajweed Coloring Classes */
.tj-med {
    color: #f44336;
}

/* Red - Med */
.tj-idgham {
    color: #4caf50;
}

/* Green - Idgham */
.tj-ihfa {
    color: #ff9800;
}

/* Orange - Ihfa */
.tj-ghunna {
    color: #2196f3;
}

/* Blue - Ghunna */
.theme-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.theme-btn:hover {
    transform: scale(1.1);
}

.theme-btn.active {
    border-color: var(--primary);
    transform: scale(1.1);
}

.theme-btn.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Loop & Repetition Controls */
/* End of Loop Cleanup */

#rangeInputs span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.player-extra-controls {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.player-settings {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.5rem 1.2rem;
    background: rgba(128, 128, 128, 0.05);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.s-type {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
}

.btn-group {
    display: flex;
    gap: 1px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.font-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--bg-card);
    color: var(--text-main);
    font-weight: 800;
    cursor: pointer;
}

.font-btn:hover {
    background: var(--primary);
    color: white;
}

.player-themes {
    display: flex;
    gap: 1rem;
    padding-left: 2rem;
    border-left: 1px solid var(--border);
}

.theme-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.2s;
    border: 2px solid transparent;
}

.theme-btn.active {
    transform: scale(1.2);
    border-color: var(--primary);
}

.theme-btn.dark {
    background: #0f172a;
}

.theme-btn.light {
    background: #ffffff;
    border: 1px solid #ddd;
}

.theme-btn.midnight {
    background: #020617;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-btn.sepia {
    background: #f4ecdb;
    border: 1px solid #433422;
}

.theme-btn.emerald {
    background: #022c22;
    border: 1px solid #fbbf24;
}

.theme-btn.ruby {
    background: #450a0a;
    border: 1px solid #fbbf24;
}

/* --- GLOBAL RESPONSIVE ISOLATION --- */
.mobile-header {
    display: none;
    height: 70px;
    background: var(--bg-dark-glass);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1500;
}

.mobile-logo .logo-img {
    height: 50px;
    width: auto;
    display: block;
}

.menu-toggle {
    background: rgba(194, 153, 107, 0.1);
    border: 1px solid rgba(194, 153, 107, 0.2);
    color: var(--primary);
    cursor: pointer;
    padding: 10px;
    border-radius: 14px;
    /* More rounded corners */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.menu-toggle svg {
    width: 28px !important;
    height: 28px !important;
}

.menu-toggle:active {
    background: rgba(194, 153, 107, 0.2);
    transform: scale(0.95);
}

.sidebar-close {
    display: none;
}

/* --- PROFESSIONAL RESPONSIVE MASTER ARCHITECTURE (PRO UI) --- */
@media (max-width: 1024px) {
    .mobile-header {
        display: flex;
        height: 60px;
    }

    #app {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 360px;
        /* Increased from 300px */
        max-width: 90%;
        height: 100vh;
        background: var(--bg-dark);
        z-index: 4000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.6);
        display: flex;
        flex-direction: column;
        padding-top: 1rem;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 1rem;
        right: 1rem;
        width: 48px;
        height: 48px;
        background: rgba(194, 153, 107, 0.1) !important;
        border: 1px solid rgba(194, 153, 107, 0.2) !important;
        border-radius: 14px !important;
        color: var(--primary) !important;
        font-size: 1.8rem;
        z-index: 4100;
        cursor: pointer;
        transition: var(--transition);
    }

    .sidebar-close:active {
        transform: scale(0.95);
        background: rgba(194, 153, 107, 0.2) !important;
    }

    /* --- ELITE FLOATING ISLAND PLAYER (PRO UI) --- */
    .player-footer {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        background: var(--bg-dark-glass) !important;
        backdrop-filter: blur(30px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(30px) saturate(180%) !important;
        border-top: 1px solid var(--border) !important;
        border-right: none !important;
        border-left: none !important;
        border-bottom: none !important;
        border-radius: 24px 24px 0 0 !important;
        padding: 16px 20px !important;
        padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
        z-index: 4000;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3) !important;
        display: flex !important;
    }

    .player-container {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .player-main-controls {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .player-info {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--border);
    }

    #playerSurahName {
        font-size: 0.85rem;
        font-weight: 700;
        color: var(--primary);
        letter-spacing: 0.3px;
    }

    #playerVerseInfo {
        font-size: 0.75rem;
        font-weight: 500;
        color: var(--text-main);
        opacity: 0.6;
    }

    .player-controls {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 5px;
    }

    /* Navigation Group (Selects) */
    .nav-group {
        display: flex;
        flex: 1.2;
        gap: 6px;
        justify-content: flex-start;
    }

    .loop-group {
        flex: 1;
        min-width: 0;
    }

    .loop-select,
    .speed-select {
        width: 100% !important;
        height: 100% !important;
        background: transparent !important;
        border: none !important;
        border-radius: 12px !important;
        color: var(--text-main) !important;
        font-size: 0.75rem !important;
        font-weight: 700 !important;
        padding: 0 8px !important;
        -webkit-appearance: none;
        appearance: none;
        text-align: center;
        box-shadow: none !important;
        outline: none !important;
    }

    /* CENTER GROUP: Play Button */
    .main-group {
        justify-self: center;
        display: flex;
        align-items: center;
        gap: 12px;
        flex: 0 0 auto;
    }

    .audio-btn.main-play {
        width: 54px !important;
        height: 54px !important;
        background: var(--primary) !important;
        border-radius: 50% !important;
        box-shadow: 0 8px 30px rgba(194, 153, 107, 0.5) !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        border: none !important;
        transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
        flex-shrink: 0 !important;
    }

    .audio-btn.main-play:active {
        transform: scale(0.92);
    }

    .audio-btn.main-play svg {
        width: 26px !important;
        height: 26px !important;
        fill: white !important;
        margin: 0 !important;
    }

    .audio-btn.main-play.playing svg {
        margin-left: 0 !important;
    }

    .audio-btn.main-play span {
        display: none !important;
    }

    .scroll-toggle {
        width: 38px !important;
        height: 38px !important;
        border-radius: 12px !important;
        background: rgba(255, 255, 255, 0.05) !important;
    }

    /* Config Right Group */
    .config-group {
        display: flex;
        flex: 1;
        gap: 6px;
        justify-content: flex-end;
        align-items: center;
    }

    .speed-wrap {
        width: 60px;
    }

    .settings-toggle {
        width: 38px !important;
        height: 38px !important;
        border-radius: 12px !important;
        background: rgba(255, 255, 255, 0.05) !important;
    }

    .volume-wrap {
        display: none !important;
    }

    /* Bottom Sheet Refined */
    .settings-panel {
        position: fixed;
        bottom: -100%;
        left: 0;
        right: 0;
        height: 75vh;
        background: var(--bg-dark);
        border-radius: 35px 35px 0 0;
        z-index: 5000;
        padding: 2.5rem 1.5rem;
        box-shadow: 0 -25px 80px rgba(0, 0, 0, 0.8);
    }

    .settings-panel.active {
        bottom: 0;
    }

    /* --- ADDED: Settings Panel Content Styles --- */
    .settings-panel-content {
        height: 100%;
        overflow-y: auto;
        padding-bottom: 40px;
        /* Space for scrolling */
    }

    .settings-sections {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .section-title {
        color: var(--primary);
        font-size: 0.75rem;
        font-weight: 800;
        letter-spacing: 1.5px;
        margin-bottom: 12px;
        text-transform: uppercase;
        opacity: 0.8;
    }

    .setting-card {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 16px;
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .s-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .s-name {
        font-weight: 700;
        color: var(--text-main);
        font-size: 0.95rem;
    }

    .btn-group {
        display: flex;
        gap: 8px;
    }

    .font-btn {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.05);
        color: var(--text-main);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        cursor: pointer;
    }

    .font-select {
        width: 100%;
        height: 48px;
        background: rgba(0, 0, 0, 0.3) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 12px;
        color: var(--text-main);
        padding: 0 16px;
        font-size: 0.95rem;
        cursor: pointer;
        appearance: none;
    }

    /* Theme Grid specific */
    .theme-grid {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        /* 6 columns for 6 themes */
        gap: 12px;
    }

    .theme-btn {
        width: 100%;
        aspect-ratio: 1 / 1;
        border-radius: 50%;
        position: relative;
        cursor: pointer;
        border: 2px solid transparent;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background-clip: padding-box;
    }

    /* Ensure checkmark is centered if it exists */
    .theme-btn::after {
        display: none;
    }

    .theme-btn.active::after {
        content: '✓';
        display: block;
        color: white;
        font-weight: 800;
        font-size: 1.2rem;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    }

    .theme-btn.active {
        box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--primary);
        transform: scale(0.95);
    }

    /* Individual Theme Colors (Backgrounds) */
    .theme-btn.dark {
        background: #0f172a;
    }

    .theme-btn.light {
        background: #ffffff;
    }

    .theme-btn.midnight {
        background: #020617;
    }

    .theme-btn.sepia {
        background: #f4ecdb;
    }

    .theme-btn.emerald {
        background: #022c22;
    }

    .theme-btn.ruby {
        background: #450a0a;
    }
}

@media (max-width: 600px) {
    .verse-card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }

    .v-item.arap {
        font-size: var(--fontSizeArap) !important;
    }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

/* Verse Notes Styles */
.v-note-display {
    margin-top: 1rem;
    padding: 0.8rem;
    background: rgba(194, 153, 107, 0.08);
    border-left: 3px solid var(--primary);
    border-radius: 6px;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-muted);
}

.v-note-display strong {
    color: var(--primary);
    font-weight: 700;
    margin-right: 5px;
}

.note-btn.has-note {
    color: var(--primary) !important;
}

.note-btn.has-note svg {
    filter: drop-shadow(0 0 5px rgba(194, 153, 107, 0.4));
}

/* Image Share Card Styles */
.share-card-template {
    width: 600px;
    height: 600px;
    background-color: var(--bg-page);
    background-image: radial-gradient(circle at center, var(--bg-card) 0%, var(--bg-page) 120%);
    color: var(--text-main);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 4px solid var(--primary);
    border-radius: 30px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    position: relative;
    overflow: hidden;
}

.share-card-template::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    opacity: 0.1;
    z-index: 0;
    pointer-events: none;
}

.sc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border);
    padding-bottom: 25px;
    z-index: 1;
}

.sc-surah {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Playfair Display', serif;
}

.sc-verse {
    font-size: 20px;
    opacity: 0.8;
    color: var(--text-muted);
    font-weight: 600;
}

.sc-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 1;
    gap: 35px;
    padding: 20px 0;
}

.sc-arap {
    font-family: 'Amiri', serif;
    font-size: 36px;
    line-height: 2;
    color: var(--text-main);
    direction: rtl;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sc-mean {
    font-size: 22px;
    line-height: 1.6;
    color: var(--text-muted);
    font-weight: 500;
}

.sc-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    font-size: 14px;
    z-index: 1;
    margin-top: 20px;
}

/* Tajweed Legend Styles */
.tajweed-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.tj-item {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tj-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    display: inline-block;
}

.dot.med {
    background: #f44336;
}

.dot.idgham {
    background: #4caf50;
}

.dot.ghunna {
    background: #2196f3;
}

.dot.ihfa {
    background: #ff9800;
}

/* Tajweed Colors for Dark Themes (Emerald & Ruby) to ensure visibility */
body.theme-emerald .tj-med,
body.theme-ruby .tj-med {
    color: #ff8a80 !important;
    /* Neon Light Red */
    text-shadow: 0 0 12px rgba(255, 138, 128, 0.6);
}

body.theme-emerald .tj-idgham,
body.theme-ruby .tj-idgham {
    color: #69f0ae !important;
    /* Neon Green */
    text-shadow: 0 0 12px rgba(105, 240, 174, 0.6);
}

body.theme-emerald .tj-ghunna,
body.theme-ruby .tj-ghunna {
    color: #80d8ff !important;
    /* Neon Light Blue */
    text-shadow: 0 0 12px rgba(128, 216, 255, 0.6);
}

body.theme-emerald .tj-ihfa,
body.theme-ruby .tj-ihfa {
    color: #ffe57f !important;
    /* Neon Yellow */
    text-shadow: 0 0 12px rgba(255, 229, 127, 0.6);
}

/* --- Note Modal --- */
.note-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.note-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.note-modal {
    background: var(--bg-card);
    width: 90%;
    max-width: 500px;
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.note-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.note-modal-overlay.active .note-modal {
    transform: translateY(0) scale(1);
}

.note-modal-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.note-modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.note-modal-subtitle {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.25rem;
}

.note-textarea-wrapper {
    position: relative;
    margin-bottom: 2rem;
}

.note-textarea {
    width: 100%;
    height: 180px;
    background: rgba(15, 23, 42, 0.3);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    transition: all 0.3s ease;
    outline: none;
}

body.theme-light .note-textarea {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.note-textarea:focus {
    border-color: var(--primary);
    background: rgba(194, 153, 107, 0.05);
    box-shadow: 0 0 0 4px rgba(194, 153, 107, 0.15);
}

.note-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.modal-btn {
    padding: 0.8rem 1.8rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-btn-cancel {
    background: transparent;
    color: var(--text-muted);
}

.modal-btn-cancel:hover {
    color: var(--text-main);
    background: rgba(128, 128, 128, 0.1);
}

.modal-btn-save {
    background: var(--primary);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(194, 153, 107, 0.4);
}

.modal-btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(194, 153, 107, 0.5);
    background: var(--primary-light);
    color: #4a3b2a;
}

/* --- REFINED SURAH HEADER (MOBILE FIX) --- */
@media (max-width: 768px) {
    .detail-header {
        padding: 10px 1rem 10px 1rem !important;
        text-align: center;
        margin-bottom: 24px !important;
        /* Added extra space between header and first verse */
        margin-top: 2rem !important;
        /* Separation from top header */
        position: relative;
    }


}

.title-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-bottom: 0.5rem;
    position: relative;
}

.surah-number {
    font-family: 'Playfair Display', serif;
    font-size: 5rem !important;
    font-weight: 900;
    color: var(--primary);
    opacity: 0.08 !important;
    line-height: 0.8;
    position: absolute;
    top: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 0;
    pointer-events: none;
    white-space: nowrap;
}

#detailTitle {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem !important;
    /* Smaller, elegant size */
    font-weight: 700;
    color: var(--primary);
    z-index: 1;
    position: relative;
    text-shadow: none !important;
    /* Removed text-shadow */
    margin: 0 !important;
    line-height: 1.2;
}

.badge-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    z-index: 1;
    position: relative;
    margin-top: 4px;
}

.badge {
    background: rgba(194, 153, 107, 0.1) !important;
    border: 1px solid rgba(194, 153, 107, 0.2) !important;
    color: var(--primary-light) !important;
    font-size: 0.75rem !important;
    font-weight: 600;
    padding: 4px 12px !important;
    border-radius: 20px !important;
    letter-spacing: 0.5px;
    backdrop-filter: blur(5px);
    text-transform: uppercase;
}

/* --- THEME BUTTON PERFECT CIRCLE FIX --- */
/* Override grid gap if necessary to prevent squeezing */
.theme-grid {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 8px !important;
    align-items: center;
}

.theme-btn {
    width: 42px !important;
    height: 42px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0 !important;
    margin: 0 auto !important;
    /* Center in grid cell */
}

/* --- USER GUIDE MODAL STYLES --- */
.guide-modal {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: -9999;
    display: none !important;
    opacity: 0;
    visibility: hidden;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    pointer-events: none;
    margin: 0 !important;
}

.guide-modal.active {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    z-index: 99999;
    pointer-events: all;
    justify-content: center !important;
    align-items: center !important;
}

.guide-container {
    background: var(--bg-dark);
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    display: flex;
    overflow: hidden;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    margin: auto;
    /* Ensure it floats */
}

.guide-modal.active .guide-container {
    transform: scale(1);
}

.guide-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(128, 128, 128, 0.1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.guide-close-btn:hover {
    background: var(--primary);
    color: white;
}

/* Guide Sidebar */
.guide-sidebar {
    width: 280px;
    background: rgba(128, 128, 128, 0.03);
    border-right: 1px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.guide-sidebar h3 {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 2rem;
    padding-left: 1rem;
}

.guide-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.guide-nav li {
    padding: 1rem 1.2rem;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
}

.guide-nav li:hover {
    background: rgba(128, 128, 128, 0.05);
    color: var(--text-main);
}

.guide-nav li.active {
    background: rgba(194, 153, 107, 0.1);
    color: var(--primary);
    font-weight: 700;
}

/* Guide Content */
.guide-content {
    flex: 1;
    padding: 3rem 4rem;
    overflow-y: auto;
    position: relative;
}

.guide-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.guide-section.active {
    display: block;
}

.guide-section h2 {
    font-size: 2rem;
    font-family: 'Playfair Display', serif;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.guide-section p {
    color: var(--text-main);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.guide-section ul,
.guide-section ol {
    margin-left: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text-muted);
}

.guide-section li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.guide-section li strong {
    color: var(--primary);
}

.guide-section li em {
    color: var(--text-main);
    font-style: normal;
    font-weight: 600;
}

/* Responsive Guide */
@media (max-width: 900px) {
    .guide-container {
        flex-direction: column;
        height: 90vh;
        width: 95%;
    }

    .guide-sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
    }

    .guide-sidebar h3 {
        display: none;
    }

    .guide-nav {
        flex-direction: row;
        width: max-content;
    }

    .guide-nav li {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .guide-content {
        padding: 2rem;
    }

    .guide-section h2 {
        font-size: 1.5rem;
    }
}

/* Mukabele (Zen) Mode Styles */
.mukabele-toggle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
}

.mukabele-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent);
}

.mukabele-toggle.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.mukabele-view {
    position: absolute;
    top: 100px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: hidden;
    transition: opacity 0.5s ease;
}

.mukabele-container {
    width: 100%;
    max-width: 1000px;
    text-align: center;
    direction: rtl;
}

.mukabele-text {
    font-family: var(--fontArap);
    font-size: calc(var(--fontSizeArap, 2.2rem) * 2.5);
    /* Ayarlardaki boyutun 2.5 katı */
    line-height: 1.6;
    color: var(--text-dim);
    transition: all 0.3s ease;
    word-wrap: break-word;
    text-align: center;
    direction: rtl;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.mukabele-word {
    background: linear-gradient(to left, var(--mukabele-paint) var(--word-progress, 0%), var(--mukabele-base) var(--word-progress, 0%));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    white-space: pre-wrap;
}

/* Zen Mode UI Hiding */
body.mukabele-active .sidebar,
body.mukabele-active .mobile-header,
body.mukabele-active .detail-header .badge-group,
body.mukabele-active .verse-list {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

body.mukabele-active .content-view {
    margin-left: 0 !important;
    padding-top: 0;
}

body.mukabele-active .detail-header {
    background: transparent !important;
    border-bottom: none;
    justify-content: center;
    padding-top: 40px;
    z-index: 101;
}

body.mukabele-active .detail-header .title-wrap {
    transform: scale(1.2);
}

@media (max-width: 1200px) {
    .mukabele-text {
        font-size: calc(var(--fontSizeArap, 2.2rem) * 1.8);
    }
}

@media (max-width: 768px) {
    .mukabele-text {
        font-size: calc(var(--fontSizeArap, 2.2rem) * 1.4);
        line-height: 1.5;
    }
}