:root {
    --primary-color: #0f172a;
    /* Slate 900 */
    --secondary-color: #1e293b;
    /* Slate 800 */
    --accent-color: #fbbf24;
    /* Amber 400 */
    --text-color: #f1f5f9;
    /* Slate 100 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --font-heading: 'Cairo', sans-serif;
    --font-quran: 'Amiri', serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--primary-color);
    color: var(--text-color);
    font-family: var(--font-heading);
    overflow-x: hidden;
    min-height: 100vh;
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 40px;
}

/* Logo styles handled inline or simplified */
.logo-container {
    display: flex;
    align-items: center;
}

.logo-icon {
    width: 75px;
    height: auto;
    filter: drop-shadow(0 0 2px rgba(251, 191, 36, 0.5));
}

.bottom-nav-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    margin-bottom: 2px;
    filter: drop-shadow(0 0 1px rgba(251, 191, 36, 0.3));
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 0.8s ease-out;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.hero p {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Surah Grid */
.surah-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    animation: fadeInUp 1s ease-out;
}

.surah-card {
    background: var(--secondary-color);
    padding: 30px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.surah-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-color);
}

.surah-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--accent-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: center;
}

.surah-card:hover::before {
    transform: scaleX(1);
}

.card-number {
    background: rgba(251, 191, 36, 0.1);
    color: var(--accent-color);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 20px;
    font-family: var(--font-quran);
}

.card-title {
    font-size: 1.8rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.card-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Views Management */
.view {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.view.active {
    display: block;
    opacity: 1;
}

.view.hidden {
    display: none;
    opacity: 0;
}

/* Surah Detail View */
.surah-header-sticky {
    position: sticky;
    top: 20px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px 25px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    /* Stack vertically */
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 100;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    gap: 15px;
    /* Space between title and player */
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
    padding: 10px;
}

.icon-btn:hover {
    color: var(--accent-color);
}

/* Surah Name - Top Center */
#current-surah-name {
    font-size: 1.5rem;
    color: var(--accent-color);
    position: static;
    /* Reset absolute */
    transform: none;
    margin: 0;
    order: 1;
    /* First item */
}

/* Audio Controls - Bottom Full Width */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    /* Full width */
    justify-content: center;
    max-width: 600px;
    /* Limit width */
    order: 2;
    /* Second item */
}

/* Back Button - Top Right */
#back-btn {
    position: absolute;
    right: 25px;
    top: 20px;
    /* Align with top padding */
    left: auto;
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--text-muted);
    border-radius: 5px;
    padding: 5px 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

#back-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.play-btn {
    background: var(--accent-color);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary-color);
    font-size: 1.2rem;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.play-btn:hover {
    transform: scale(1.1);
}

.play-btn .fa-play {
    transform: rotate(180deg);
    margin-right: 3px;
    /* Visual correction for centering */
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: monospace;
}

input[type="range"] {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

/* Quran Text */
.surah-text {
    background: var(--secondary-color);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.basmala {
    font-family: var(--font-quran);
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: var(--accent-color);
    position: relative;
    padding-bottom: 20px;
}

.basmala::after {
    content: '۞';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.1);
}

.verse {
    font-family: var(--font-quran);
    font-size: 2.2rem;
    line-height: 2.2;
    margin-bottom: 0;
    display: inline;
    color: var(--text-color);
}

.verse-number {
    display: inline-block;
    font-size: 1.2rem;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    margin: 0 10px;
    font-family: sans-serif;
    vertical-align: middle;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Nav Links */
.nav-links {
    display: flex;
    gap: 15px;
    background: rgba(30, 41, 59, 0.5);
    padding: 5px;
    border-radius: 30px;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-family: var(--font-heading);
    transition: all 0.3s ease;
}

.nav-btn.active,
.nav-btn:hover {
    background: var(--accent-color);
    color: var(--primary-color);
    font-weight: bold;
}

/* Adhkar Grid */
.adhkar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    animation: fadeInUp 1s ease-out;
}

.adhkar-card {
    background: var(--secondary-color);
    padding: 25px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.adhkar-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.adhkar-icon {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.adhkar-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.adhkar-content {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 50px;
}

.adhkar-item {
    background: var(--secondary-color);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    border-right: 4px solid var(--accent-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.adhkar-text {
    font-family: var(--font-quran);
    font-size: 1.5rem;
    line-height: 2;
    margin-bottom: 15px;
}

.adhkar-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
    margin-top: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-wrap: wrap;
    gap: 10px;
}

.adhkar-count {
    background: rgba(251, 191, 36, 0.1);
    color: var(--accent-color);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    display: none;
    /* Hidden for now as count data is not parsed accurately in new dataset */
}

.adhkar-source {
    color: #94a3b8;
    /* Slate 400 */
    font-size: 0.85rem;
    font-style: italic;
    text-align: left;
    flex: 1;
    /* Take remaining space */
}

#current-adhkar-category {
    font-size: 1.5rem;
    color: var(--accent-color);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    margin: 0;
}

#adhkar-back-btn {
    position: absolute;
    right: 25px;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--text-muted);
    border-radius: 5px;
    padding: 5px 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
}

#adhkar-back-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}


/* Bottom Navigation */
.bottom-nav {
    display: none;
    /* Hidden by default on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    /* Primary color with transparency */
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 20px);
    /* Handle notch/home bar */
}

.bottom-nav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-family: var(--font-heading);
    cursor: pointer;
    transition: all 0.3s ease;
}

.bottom-nav-btn i {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.bottom-nav-btn.active {
    color: var(--accent-color);
}


/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        /* Hide top nav links on mobile */
    }

    .bottom-nav {
        display: flex;
        /* Show bottom nav on mobile */
    }

    .app-container {
        padding-bottom: 80px;
        /* Space for bottom nav */
    }

    .navbar {
        margin-bottom: 20px;
        flex-direction: row;
        /* Keep logo and reciter info, but no nav links */
        justify-content: center;
        /* Center logo if strictly logo only, but we have reciter info too */
    }

    .navbar .logo {
        margin-bottom: 0;
        /* Reset if needed */
    }


    #adhkar-back-btn {
        position: absolute;
        right: 15px;
        /* Moved to right for mobile as well */
        left: auto;
        top: 15px;
        transform: none;
        background-color: var(--accent-color);
        color: var(--primary-color);
        width: 35px;
        height: 35px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
        padding: 0;
        border: none;
    }

    #adhkar-back-btn i {
        transform: rotate(180deg);
        /* Flip arrow for RTL generic icon if needed, or use left arrow */
    }

    .adhkar-item {
        padding: 15px;
    }

    .adhkar-text {
        font-size: 1.3rem;
    }

    .hero h2 {
        font-size: 1.8rem;
    }

    .surah-header-sticky {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        top: 0;
        /* Keep sticky on mobile */
        margin-bottom: 20px;
        border-radius: 0 0 15px 15px;
        /* Rounded only at bottom */
    }

    /* Make header elements more compact on mobile */
    #current-surah-name {
        order: -1;
        /* Name at top */
        font-size: 1.2rem;
        position: static;
        transform: none;
        width: auto;
    }

    .audio-controls {
        width: 100%;
        flex-direction: row;
        /* Keep row */
        gap: 10px;
    }

    .progress-container {
        font-size: 0.7rem;
    }

    .surah-text {
        padding: 20px 15px;
    }

    .verse {
        font-size: 1.5rem;
        /* Smaller font for mobile readability */
        line-height: 2;
    }

    .verse-number {
        width: 30px;
        height: 30px;
        line-height: 30px;
        font-size: 1rem;
        margin: 0 5px;
    }

    .basmala {
        font-size: 1.8rem;
        margin-bottom: 30px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.5rem;
    }

    .surah-grid {
        grid-template-columns: 1fr;
        /* Force single column */
    }

    #back-btn {
        position: absolute;
        right: 15px;
        top: 15px;
        left: auto;
        background-color: var(--accent-color);
        color: var(--primary-color);
        width: 35px;
        height: 35px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
        padding: 0;
        border: none;
    }

    .surah-grid {
        gap: 15px;
        /* Reduce gap between cards */
    }

    /* Smaller blocks for mobile */
    .surah-card {
        padding: 10px;
        /* Minimal padding */
        border-radius: 12px;
        /* Slightly less rounded */
    }

    .card-title {
        font-size: 1.2rem;
        margin-bottom: 5px;
    }

    .card-number {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .card-info {
        font-size: 0.8rem;
    }
}