@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #f7fcf9;
    --text-color: #064e3b;
    --accent-emerald: #10b981;
    --deep-emerald: #064e3b;
    --gold-color: #d4af37;
    --gold-light: #fcd34d;
    --cream-bg: #fffbeb;
    --quran-font: 'Amiri', serif;
    --ui-font: 'Outfit', sans-serif;
    --card-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(6, 78, 59, 0.1);
    --shadow-premium: 0 10px 40px rgba(6, 78, 59, 0.08);
}

/* 1. Dark Theme */
body.dark-mode {
    --bg-color: #12241e;
    /* Deep Forest Green */
    --card-bg: rgba(20, 36, 30, 0.9);
    --text-color: #e0e7e1;
    --accent-emerald: #34d399;
    --deep-emerald: #064e3b;
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.4);
    --cream-bg: #1a2e26;
}

/* 2. Sepia (Paper) Theme */
body.theme-sepia {
    --bg-color: #f4ecdb;
    /* Warm Paper */
    --card-bg: rgba(253, 246, 227, 0.9);
    --text-color: #5b4636;
    /* Deep Brown Text */
    --accent-emerald: #8c6a00;
    --deep-emerald: #433422;
    --glass-border: rgba(91, 70, 54, 0.15);
    --shadow-premium: 0 10px 30px rgba(67, 52, 34, 0.1);
    --cream-bg: #efe3c9;
    --gold-color: #a67c00;
}

/* 3. Amoled (Deep Night) Theme */
body.theme-amoled {
    --bg-color: #000000;
    /* Pitch Black */
    --card-bg: #111111;
    --text-color: #ffffff;
    --accent-emerald: #ffcc00;
    /* Gold accents look better on black */
    --deep-emerald: #000000;
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-premium: 0 0 0 transparent;
    --cream-bg: #1a1a1a;
    --gold-color: #ffcc00;
}

body {
    font-family: var(--ui-font), sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, hsla(161, 75%, 20%, 0.05) 0, transparent 50%),
        radial-gradient(at 100% 100%, hsla(45, 75%, 50%, 0.05) 0, transparent 50%);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    direction: rtl;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
}

body.theme-amoled {
    background-image: none !important;
}

header {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-premium);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    padding-bottom: 100px;
    /* Prevent player bar overlap */
}

h1,
h2,
h3 {
    margin-top: 0;
}

.selection-wrapper {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 2.5rem 1.5rem;
    border-radius: 24px;
    box-shadow: var(--shadow-premium);
    text-align: center;
    max-width: 600px;
    /* narrowed for better look */
    margin: 3rem auto;
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

.selection-wrapper h3 {
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    color: var(--gold-color);
}

.custom-select-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

select {
    width: 100%;
    padding: 1rem 1.5rem;
    font-family: var(--ui-font);
    font-size: 1.1rem;
    border: 2px solid #eee;
    border-radius: 8px;
    appearance: none;
    /* Hide default arrow */
    background-color: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
}

select:focus {
    outline: none;
    border-color: var(--gold-color);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.select-arrow {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-color);
    font-size: 0.8rem;
}

body.dark-mode select {
    background-color: #333;
    border-color: #444;
}


.card {
    background: var(--card-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 16px;
    padding: 1.8rem;
    box-shadow: var(--shadow-premium);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    text-align: center;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--gold-color);
    box-shadow: 0 20px 40px rgba(6, 78, 59, 0.12);
}

.icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    padding: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.icon-btn:hover,
.icon-btn.active {
    background: var(--gold-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(212, 175, 55, 0.2);
}

.surah-number {
    display: inline-block;
    width: 32px;
    height: 32px;
    line-height: 32px;
    background: var(--cream-bg);
    border-radius: 50%;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--gold-color);
    border: 1px solid var(--gold-color);
    font-size: 0.9rem;
}

/* Reading View */
.ayah-container {
    background-color: var(--card-bg);
    margin-bottom: 1rem;
    padding: 1.5rem;
    border-radius: 8px;
    position: relative;
    border-right: 4px solid transparent;
}

.ayah-container {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-bottom: 2rem;
    padding: 2.5rem;
    border-radius: 24px;
    position: relative;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-premium);
    transition: all 0.4s ease;
}

.ayah-container.active {
    border: 1px solid var(--gold-color);
    background: rgba(212, 175, 55, 0.03);
    box-shadow: 0 15px 40px rgba(212, 175, 55, 0.1);
}

.ayah-text {
    font-family: 'Amiri Quran', serif;
    font-size: 2.2rem;
    line-height: 2.2;
    color: var(--text-color);
    margin-bottom: 20px;
    word-wrap: break-word;
    animation: fadeInAyah 0.6s ease-out;
}

@keyframes fadeInAyah {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.dark-mode .ayah-text {
    color: var(--gold-light);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.ayah-translation {
    color: var(--text-color);
    opacity: 0.85;
    font-size: 1.15rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-weight: 400;
    text-align: center;
}

body.dark-mode .ayah-translation {
    color: #cbd5e1;
    /* Clearer gray-blue in dark mode */
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 1rem;
}

.action-btn {
    background: rgba(6, 78, 59, 0.05);
    border: 1px solid rgba(6, 78, 59, 0.1);
    color: var(--deep-emerald);
    flex: 1;
    min-width: 100px;
    padding: 0.8rem 1rem;
    font-weight: 600;
    box-shadow: none;
}

body.dark-mode .action-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.action-btn:hover,
.action-btn.active {
    background: var(--gold-color);
    color: white;
    border-color: var(--gold-color);
}

.theme-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: var(--transition);
}

.theme-btn.light {
    background: #fff;
}

.theme-btn.dark {
    background: #121212;
}

.theme-btn.sepia {
    background: #f4ecd8;
}

.theme-btn.amoled {
    background: #000;
}

.theme-btn:hover {
    transform: scale(1.1);
}

/* Focus Mode */
body.focus-mode header,
body.focus-mode .navigation-controls,
body.focus-mode .action-buttons,
body.focus-mode .selection-wrapper,
body.focus-mode .surah-info-card,
body.focus-mode .quick-settings-bar,
body.focus-mode hr {
    display: none !important;
}

/* Exit Focus Button (FAB) */
.exit-focus-btn {
    display: none;
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 5000;
    padding: 0.8rem 1.5rem;
    background: var(--gold-color);
    color: white;
    border: none;
    border-radius: 50px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(5px);
}

body.focus-mode .exit-focus-btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.focus-mode .container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.focus-mode .ayah-container {
    max-width: 800px;
    padding: 40px;
    background: transparent;
    box-shadow: none;
    text-align: center;
}

body.focus-mode .ayah-text {
    font-size: 3rem;
}

button {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 0.7rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--ui-font);
    color: var(--text-color);
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

button:hover {
    background: var(--gold-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.3);
    border-color: var(--gold-color);
}

.volume-control {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: rgba(6, 78, 59, 0.03);
    padding: 1rem;
    border-radius: 50px;
}

.volume-icon {
    font-size: 1.2rem;
    opacity: 0.7;
}

/* Updated Player bar layout */
.player-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: var(--card-bg);
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1000;
    border: 1px solid rgba(212, 175, 55, 0.2);
    transition: var(--transition);
}

/* Audio Visualizer */
.visualizer-container {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 30px;
    padding: 0 10px;
}

.vis-bar {
    width: 3px;
    height: 5px;
    background: var(--gold-color);
    border-radius: 3px;
    transition: height 0.2s ease;
}

.vis-bar.active {
    animation: wave 1s ease-in-out infinite;
}

@keyframes wave {

    0%,
    100% {
        height: 5px;
    }

    50% {
        height: 25px;
    }
}

#play-pause-btn {
    width: 55px;
    height: 55px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.4rem;
    background: var(--gold-color);
    color: white;
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
    border: none;
    flex-shrink: 0;
}

#play-pause-btn:hover {
    transform: scale(1.1);
    background: var(--gold-light);
}

.player-bar-surah {
    justify-content: space-between;
}

/* View Toggle Buttons */
.view-toggle {
    display: flex;
    background: var(--bg-color);
    padding: 4px;
    border-radius: 30px;
    border: 1.5px solid var(--gold-color);
    gap: 4px;
}

.view-btn {
    border-radius: 25px !important;
    padding: 6px 18px !important;
    border: none !important;
    background: transparent !important;
    color: var(--text-color) !important;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--ui-font);
    transition: all 0.25s ease;
}

.view-btn:hover {
    background-color: rgba(212, 175, 55, 0.15) !important;
    color: var(--gold-color) !important;
}

.view-btn.active {
    background: var(--gold-color) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
}

/* Tajweed Colors Example (simple version) */
.tajweed-ghunnah {
    color: #17b978;
}

.tajweed-madd {
    color: #3498db;
}

.tajweed-qalqalah {
    color: #e74c3c;
}

body.dark-mode .ayah-translation,
body.theme-amoled .ayah-translation {
    color: #e0e0e0;
    /* lightened for better readability */
}

body.dark-mode .action-btn,
body.theme-amoled .action-btn {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .action-btn:hover,
body.theme-amoled .action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--gold-color);
}

/* Dark mode specifically */
body.dark-mode .ayah-tafsir {
    color: #ccc;
}

.navigation-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin: 2rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.navigation-controls button {
    padding: 0.8rem 2.5rem;
    background: var(--deep-emerald);
    color: white;
    border: none;
    border-radius: 50px;
}

.navigation-controls button:hover {
    background: var(--accent-emerald);
}

.controls.centered {
    justify-content: center;
    margin-top: 1.5rem;
}

#single-ayah-container {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 4px solid var(--gold-color);
    text-align: center;
    padding: 1rem;
    margin: 0 auto;
    max-width: 800px;
}

/* ============================================
   Responsive Design - Mobile First
   ============================================ */

/* Tablets */
@media (max-width: 1024px) {
    .container {
        padding: 1.5rem;
        max-width: 97%;
    }
}

/* ============================================
   Mobile Devices (≤ 768px)
   ============================================ */
@media (max-width: 768px) {

    /* ---- Layout ---- */
    body {
        font-size: 15px;
    }

    .container {
        padding: 0.5rem 0.75rem;
        padding-bottom: 90px;
        margin-top: 0;
    }

    /* ---- Header ---- */
    header {
        padding: 0.5rem 0.75rem;
        position: sticky;
        top: 0;
        z-index: 200;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    header h2,
    #surah-title {
        font-size: 0.95rem;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 160px;
    }

    header img {
        height: 32px !important;
        margin-left: 8px !important;
    }

    header button {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    /* ---- Grid (Surah List) ---- */
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .card {
        padding: 0.8rem 0.6rem;
        border-radius: 10px;
    }

    .card h3 {
        font-size: 1rem;
        margin: 0.3rem 0;
    }

    .card p,
    .card small {
        font-size: 0.75rem;
        margin: 0;
    }

    .surah-number {
        width: 32px;
        height: 32px;
        line-height: 32px;
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    /* ---- Selection / Search ---- */
    .selection-wrapper {
        padding: 1.5rem 1rem;
        margin: 1rem auto;
    }

    .custom-select-container {
        max-width: 100%;
    }

    /* ---- Single Ayah View ---- */
    #single-ayah-container {
        padding: 1.2rem 0.8rem;
        min-height: 200px;
        border-right-width: 3px;
    }

    .ayah-text {
        font-size: 1.35rem;
        line-height: 2.0;
    }

    .ayah-translation {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .ayah-tafsir {
        font-size: 0.85rem;
        padding: 0.6rem;
    }

    /* ---- Navigation ---- */
    .navigation-controls {
        gap: 0.6rem;
        margin-bottom: 1rem;
        flex-wrap: nowrap;
    }

    .navigation-controls button {
        flex: 1;
        padding: 0.65rem 0.5rem;
        font-size: 0.9rem;
        min-height: 44px;
        /* Touch target */
    }

    #current-ayah-num {
        font-size: 0.85rem;
        white-space: nowrap;
        min-width: 60px;
        text-align: center;
    }

    /* ---- Action Buttons (Play, Bookmark, etc.) ---- */
    .controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .controls.centered {
        justify-content: center;
        margin-top: 1rem;
    }

    .controls button {
        flex: 1;
        min-width: 100px;
        padding: 0.7rem 0.5rem;
        font-size: 0.85rem;
        min-height: 44px;
    }

    /* ---- Player Bar ---- */
    .player-bar {
        width: calc(100% - 2rem);
        max-width: 100%;
        padding: 0.45rem 0.75rem;
        bottom: 0.75rem;
        border-radius: 20px;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.4rem;
        align-items: center;
        justify-content: flex-start;
        min-height: unset;
    }

    #play-pause-btn {
        width: 42px;
        height: 42px;
        min-width: 42px;
        font-size: 1.1rem;
        flex-shrink: 0;
    }

    .player-bar-surah {
        padding-bottom: 0;
    }

    /* Info text in player bar */
    .playback-info {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }

    .player-surah-name {
        font-size: 0.78rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .player-ayah-num {
        font-size: 0.7rem;
        opacity: 0.7;
    }

    /* Visualizer — hide on very small screens to save space */
    .visualizer-container {
        display: none;
    }

    /* View toggle — compact pills */
    .view-toggle {
        justify-content: center;
        width: auto;
        flex-shrink: 0;
        border-width: 1px;
        padding: 2px;
        gap: 2px;
    }

    .view-btn {
        flex: unset;
        text-align: center;
        padding: 5px 9px !important;
        font-size: 0.72rem !important;
        white-space: nowrap;
    }

    .player-bar>div,
    .player-bar>button {
        width: auto;
    }

    .player-bar-surah>div,
    .player-bar-surah>button {
        width: auto;
    }

    .action-btn {
        min-width: 44px;
        font-size: 0.82rem;
        padding: 0.5rem 0.65rem;
    }

    /* ---- Full Surah View - Mushaf Mobile ---- */
    .full-surah-container {
        padding: 0.8rem 0.6rem;
        font-size: 1.1rem;
        line-height: 2.0;
        border-radius: 10px;
        word-spacing: 1px;
        margin-bottom: 1rem;
    }

    .surah-number-inline {
        width: 26px;
        height: 26px;
        font-size: 0.75rem;
        margin: 0 4px;
    }

    /* ---- Surah Title ---- */
    #surah-title {
        font-size: 1.2rem;
        text-align: center;
        padding: 0.5rem;
    }

    /* ---- Continue Reading Card ---- */
    .continue-card {
        flex-direction: row;
        padding: 1rem 1.2rem;
        gap: 0.8rem;
    }

    .continue-info h4 {
        font-size: 1rem;
    }

    .continue-info p {
        font-size: 0.85rem;
    }

    /* ---- Modal ---- */
    .modal-content {
        margin: 5% auto;
        padding: 1.2rem;
        border-radius: 16px;
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .setting-item select {
        font-size: 1rem;
        padding: 0.7rem;
    }

    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* ---- Audio Disc ---- */
    .audio-disc {
        font-size: 2.5rem;
    }

    /* ---- Range Slider ---- */
    input[type=range] {
        width: 100%;
        max-width: 200px;
    }
}

/* ============================================
   Small Mobile (≤ 480px)
   ============================================ */
@media (max-width: 480px) {

    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .ayah-text {
        font-size: 1.2rem;
        line-height: 1.95;
    }

    .full-surah-container {
        font-size: 1.0rem;
        line-height: 1.9;
        padding: 0.7rem 0.5rem;
        word-spacing: 0;
    }

    .view-btn {
        padding: 4px 7px !important;
        font-size: 0.68rem !important;
    }

    .navigation-controls button {
        font-size: 0.8rem;
        padding: 0.55rem 0.3rem;
    }

    .player-bar {
        gap: 0.4rem;
    }

    .player-bar button {
        font-size: 0.8rem;
        padding: 0.5rem 0.6rem;
    }

    .surah-number-inline {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }

    header h2 {
        font-size: 1rem;
    }
}

/* ============================================
   PWA Safe Area (iOS notch/home indicator)
   ============================================ */
@supports (padding: env(safe-area-inset-bottom)) {
    .player-bar {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    .container {
        padding-bottom: calc(130px + env(safe-area-inset-bottom));
    }
}

/* ============================================
   Full Surah View - Mushaf Style
   ============================================ */

.full-surah-container {
    background-color: var(--card-bg);
    padding: 3rem 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    direction: rtl;
    text-align: justify;
    text-justify: inter-word;
    font-family: 'Amiri', serif !important;
    font-size: 2.2rem;
    line-height: 3.2;
    margin-bottom: 2rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    word-spacing: 4px;
}

.clickable-ayah {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 6px;
    display: inline;
    transition: background-color 0.25s ease, color 0.25s ease;
    position: relative;
}

.clickable-ayah:hover {
    background-color: rgba(212, 175, 55, 0.12);
    color: var(--gold-color);
}

.active-ayah-highlight {
    background-color: rgba(212, 175, 55, 0.25) !important;
    color: var(--gold-color) !important;
    box-shadow: 0 2px 0 var(--gold-color);
    border-radius: 6px;
}

.surah-number-inline {
    font-family: var(--ui-font) !important;
    font-size: 0.85rem;
    color: var(--gold-color);
    border: 1.5px solid var(--gold-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 6px;
    font-weight: 700;
    vertical-align: middle;
    background: var(--card-bg);
    flex-shrink: 0;
    line-height: 1;
}

/* Continue Reading Card */
.continue-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--gold-color) 0%, #b8860b 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    text-decoration: none;
}

.continue-card-premium {
    background: linear-gradient(135deg, var(--gold-color) 0%, var(--accent-emerald) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: right;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.continue-card-premium:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(16, 185, 129, 0.3);
}

.continue-icon {
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.2);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
}

.continue-info {
    flex: 1;
}

.continue-info h4 {
    margin: 3px 0;
    font-size: 1.3rem;
}

.continue-info p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.continue-arrow {
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 10px;
}

/* Dark Mode Adjustments */
body.dark-mode .surah-number-inline {
    background: var(--deep-emerald);
}

body.dark-mode select {
    background-color: var(--deep-emerald);
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .modal-content {
    background-color: var(--bg-color);
    border: 1px solid var(--glass-border);
}

body.dark-mode .view-toggle {
    background: #1a1a1a;
}

/* ============================================
   Animations
   ============================================ */
@keyframes pulse-gold {
    0% {
        box-shadow: 0 0 5px rgba(212, 175, 55, 0.2);
        border-color: rgba(212, 175, 55, 0.4);
    }

    50% {
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
        border-color: rgba(212, 175, 55, 1);
    }

    100% {
        box-shadow: 0 0 5px rgba(212, 175, 55, 0.2);
        border-color: rgba(212, 175, 55, 0.4);
    }
}

.playing-highlight {
    animation: pulse-gold 2s infinite ease-in-out;
    border-width: 2px !important;
}

/* Volume Slider */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: rgba(6, 78, 59, 0.1);
    border-radius: 10px;
    outline: none;
    cursor: pointer;
}

body.dark-mode input[type=range] {
    background: rgba(255, 255, 255, 0.1);
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--gold-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.3);
    border: 2px solid white;
}

body.dark-mode input[type=range]::-webkit-slider-thumb {
    border-color: var(--deep-emerald);
}

input[type=range]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--gold-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

/* Audio Disc Animation */
/* Unused Skeuomorphic styles removed */

/* ============================================
   Modal Styles (Premium Glassmorphism)
   ============================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeInModal 0.3s ease-out;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--card-bg);
    margin: 8% auto;
    padding: 2.5rem;
    border-radius: 28px;
    width: 90%;
    max-width: 460px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    border: 1px solid var(--glass-border);
    animation: slideUpModal 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpModal {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.close-btn,
.close {
    position: absolute;
    left: 20px;
    top: 20px;
    font-size: 1.5rem;
    color: var(--text-color);
    opacity: 0.5;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.close-btn:hover,
.close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.modal h3 {
    text-align: center;
    margin-bottom: 2rem;
    font-family: var(--quran-font);
    color: var(--gold-color);
    font-size: 1.8rem;
}

.setting-item {
    background: rgba(0, 0, 0, 0.03);
    padding: 1.2rem;
    border-radius: 16px;
    margin-bottom: 1.2rem;
    border: 1px solid transparent;
    transition: var(--transition);
    display: flex;
    /* Added flex to help with alignment */
    flex-direction: column;
    justify-content: center;
}

body.dark-mode .setting-item,
body.theme-amoled .setting-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    /* subtle contrast border */
}

.setting-item:hover {
    border-color: var(--gold-color);
    background: rgba(0, 0, 0, 0.05);
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}

.setting-item select {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1.5px solid var(--glass-border);
    background: var(--bg-color);
    color: var(--text-color);
    font-family: var(--ui-font);
    font-size: 1rem;
    cursor: pointer;
}

/* Premium Range Sliders */
.setting-item input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--glass-border);
    border-radius: 5px;
    outline: none;
    margin: 15px 0;
}

.setting-item input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--gold-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
    transition: 0.2s;
}

.setting-item input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Theme Selector Premium */
.theme-selector {
    display: flex;
    justify-content: space-around;
    padding: 5px 0;
}

.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.theme-btn:hover {
    transform: translateY(-4px) scale(1.1);
}

.theme-btn.active {
    border-color: var(--gold-color);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.theme-btn.light {
    background: #f7fcf9;
    border-color: #e5e7eb;
}

.theme-btn.dark {
    background: #12241e;
}

.theme-btn.sepia {
    background: #f4ecdb;
}

.theme-btn.amoled {
    background: #000000;
}

.theme-btn.auto {
    background: linear-gradient(135deg, #f7fcf9 50%, #12241e 50%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn.auto::after {
    content: 'A';
    color: var(--gold-color);
    font-weight: bold;
    font-size: 1rem;
}

/* Custom Toggle Switch */
.switch {
    display: inline-block;
    width: 45px;
    height: 24px;
    position: relative;
    cursor: pointer;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider.round {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--glass-border);
    transition: .3s;
    border-radius: 34px;
}

.slider.round:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--gold-color);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    text-align: right;
}

@media (max-width: 600px) {
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* ============================================
   PWA Install Banner
   ============================================ */
.pwa-install-banner {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: min(92%, 400px);
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.pwa-install-banner.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.pwa-install-banner .pwa-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.pwa-install-banner .pwa-text {
    flex: 1;
}

.pwa-install-banner .pwa-text strong {
    display: block;
    font-size: 0.92rem;
    color: var(--text-color);
    font-weight: 700;
    margin-bottom: 2px;
}

.pwa-install-banner .pwa-text span {
    font-size: 0.78rem;
    opacity: 0.7;
    color: var(--text-color);
}

.pwa-install-banner .pwa-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}

.pwa-install-banner .btn-install {
    background: var(--gold-color);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--ui-font);
    transition: opacity 0.2s;
}

.pwa-install-banner .btn-install:hover {
    opacity: 0.85;
    transform: none;
    box-shadow: none;
    background: var(--gold-color);
    color: white;
}

.pwa-install-banner .btn-later {
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    cursor: pointer;
    color: var(--text-color);
    font-family: var(--ui-font);
    font-weight: 500;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.pwa-install-banner .btn-later:hover {
    opacity: 1;
    background: transparent;
    transform: none;
    box-shadow: none;
    border-color: var(--glass-border);
    color: var(--text-color);
}

/* ============================================
   SW Update Notification Bar
   ============================================ */
.sw-update-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, var(--deep-emerald) 0%, #0a7a5c 100%);
    color: #fff;
    text-align: center;
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--ui-font);
    z-index: 9999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.sw-update-bar.visible {
    transform: translateY(0);
}

.sw-update-bar .sw-update-dismiss {
    margin-right: auto;
    margin-left: 1rem;
    font-size: 1rem;
    opacity: 0.7;
    cursor: pointer;
    padding: 0 4px;
}