:root {
    --primary-color: #EAB308;
    /* Gold tone */
    --primary-hover: #CA8A04;
    --bg-color: #F8F9FA;
    --text-color: #333;
    --text-light: #666;
    --border-color: #E0E0E0;
    --white: #FFFFFF;
    --font-tr: 'Inter', sans-serif;
    --font-ar: 'Amiri', serif;
}

* {
    box-sizing: border-box;
    outline: none;
}

body {
    font-family: var(--font-tr);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Top Bar */
.top-bar {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 8px 0;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Main Header */
header {
    background-color: var(--white);
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}

.logo img {
    max-height: 50px;
    width: auto;
}

.logo span {
    display: none;
    /* Hide text if we act purely on image, or keep it if side-by-by. User said "use the logo", implies replacing text usually. I'll hide text for now or remove it in HTML. Let's support image sizing here. */
}

.search-bar {
    flex-grow: 1;
    max-width: 600px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background-color: #f8f9fa;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.search-bar input:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 100px;
    justify-content: flex-end;
}

.btn-forum {
    background-color: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

/* Navigation Menu */
.bottom-nav {
    background-color: var(--white);
    border-bottom: 1px solid #eee;
    padding: 0;
}

.nav-links {
    display: flex;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 30px;
    position: relative;
    z-index: 100;
}

.nav-links li {
    position: relative;
}

.nav-links li a {
    display: block;
    padding: 15px 0;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-links li a:hover {
    color: var(--primary-color);
}



/* Dropdown Menu */
.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 10px 0;
    min-width: 220px;
    z-index: 1000;
    list-style: none;
}

.submenu li {
    width: 100%;
}

.submenu li a {
    padding: 10px 20px;
    display: block;
    color: #333;
    font-size: 0.9rem;
    white-space: nowrap;
}

.submenu li a:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

.has-submenu:hover .submenu {
    display: block;
}

/* Hero Section */
.hero {
    background-color: var(--white);
    padding: 40px 0;
    margin-bottom: 30px;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.daily-verse {
    background-color: #f0fdf4;
    border-left: 5px solid var(--primary-color);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.daily-verse h3 {
    color: var(--primary-color);
    margin-top: 0;
}

.arabic-text {
    font-family: var(--font-ar);
    font-size: 1.8rem;
    text-align: right;
    direction: rtl;
    margin-bottom: 10px;
    color: var(--text-color);
    line-height: 2;
}

/* Surah Grid */
.surah-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.surah-card {
    background-color: var(--white);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 160px;
}

.surah-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.surah-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.surah-number {
    background-color: var(--primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.surah-card:hover .surah-number {
    background-color: var(--primary-hover);
    color: white;
    transform: rotate(360deg);
}

.surah-titles {
    flex-grow: 1;
}

.surah-name-ar {
    font-family: var(--font-ar);
    font-size: 1.4rem;
    color: var(--text-color);
    text-align: right;
}

.surah-name-tr {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
}

.surah-meaning {
    color: var(--text-light);
    font-size: 0.9rem;
}

.surah-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #888;
    margin-top: 15px;
}

.revelation-type {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Surah Detail Page */
.surah-detail-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 30px 0;
}

.verse-item {
    background-color: var(--white);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.verse-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.verse-number {
    background-color: var(--primary-color-light);
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
}

.verse-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.verse-arabic {
    font-family: var(--font-ar);
    font-size: 2rem;
    text-align: right;
    direction: rtl;
    line-height: 2.2;
}

.verse-transliteration {
    color: var(--text-light);
    font-style: italic;
    font-size: 1rem;
}

.verse-translation {
    font-size: 1.1rem;
    color: var(--text-color);
    line-height: 1.6;
}

/* Loading Overlay */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (min-width: 768px) {
    .surah-detail-container {
        grid-template-columns: 300px 1fr;
    }

    .sidebar {
        position: sticky;
        top: 20px;
        height: fit-content;
    }
}

/* View Toggle */
.view-toggle {
    display: inline-flex;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    /* Slightly more rounded */
    padding: 6px;
    gap: 5px;
}

.view-toggle button {
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: transparent;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    color: #94a3b8;
    /* Lighter gray for inactive */
    font-weight: 600;
    font-family: var(--font-tr);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.view-toggle button svg {
    width: 20px;
    height: 20px;
}

.view-toggle button.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(234, 179, 8, 0.2);
}

.view-toggle button:hover:not(.active) {
    color: #64748b;
}

/* List View Overrides */
.surah-grid.list-view {
    grid-template-columns: 1fr;
}

.surah-grid.list-view .surah-card {
    flex-direction: row;
    align-items: center;
    min-height: auto;
    padding: 20px 30px;
}

.surah-grid.list-view .surah-header {
    margin-bottom: 0;
    gap: 30px;
    flex: 0 0 auto;
    width: 250px;
    /* Fixed width for alignment */
    justify-content: flex-start;
}

.surah-grid.list-view .surah-titles {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 15px;
}

.surah-grid.list-view .surah-name-ar {
    margin-bottom: 0;
    order: 2;
    /* Arabic after Turkish in list view if desired, or keep as is */
}

.menu-item {
    position: relative;
}

/* Açılan Menü */
.submenu {
    position: absolute;
    top: 100%;
    /* calc(100% + 8px) yerine */
    left: 0;

    background: #fff;
    min-width: 260px;
    list-style: none;
    padding: 8px;
    display: none;

    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, .06);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .08);
    z-index: 999;
}

/* Hover olunca aç */
.menu-item:hover .submenu {
    display: block;
}

/* Linkler */
.submenu li a {
    display: block;
    padding: 10px 14px;
    color: #111;
    text-decoration: none;
    border-radius: 10px;
    transition: all .15s ease;
}

.submenu li a:hover {
    background: rgba(0, 0, 0, .05);
    transform: translateX(2px);
}

/* Responsive Styles */
@media (max-width: 900px) {
    .container {
        padding: 0 15px;
    }

    /* Header Stack */
    .header-inner {
        flex-wrap: wrap;
        gap: 15px 0;
        justify-content: space-between;
    }

    .logo {
        flex: 1;
        min-width: auto;
    }

    .header-actions {
        flex: 0 0 auto;
    }

    .search-bar {
        order: 3;
        width: 100%;
        max-width: none;
        margin: 10px 0 0 0;
        flex-basis: 100%;
    }

    .btn-forum span {
        display: inline-block;
    }

    /* Mobile Menu Button */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        padding: 5px;
        cursor: pointer;
        color: #333;
    }

    /* Mobile Navigation Drawer */
    .bottom-nav {
        display: none;
        /* Hidden by default on mobile */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: var(--white);
        z-index: 3000;
        padding: 60px 20px 20px;
        /* Space for close button */
        overflow-y: auto;
    }

    .bottom-nav.active {
        display: block;
    }

    /* Close Button for Menu (Optional, or reuse toggle) */
    /* We can just rely on the layout or add a close button inside JS generated or just click outside/toggle */

    .nav-links {
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0;
        overflow-x: visible;
        /* Reset horizontal scroll */
        padding: 0;
    }

    .nav-links li {
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
    }

    .nav-links li a {
        padding: 15px 0;
        font-size: 1.1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Dropdowns in Mobile Menu */
    .submenu {
        position: static;
        /* Stack naturally */
        box-shadow: none;
        border: none;
        border-left: 2px solid #eee;
        padding-left: 15px;
        margin-left: 10px;
        width: auto;
        max-height: none;
        border-radius: 0;
        transform: none;
        display: none;
        visibility: visible;
        background: #fafafa;
    }

    /* When active, show submenu */
    .menu-item.active .submenu,
    .kunye-menu.active .submenu {
        display: block;
        position: static;
        transform: none;
    }
}

@media (min-width: 901px) {
    .mobile-menu-btn {
        display: none;
    }
}

@media (max-width: 768px) {

    /* Navigation - Horizontal Scroll */
    .bottom-nav .container {
        padding: 0;
    }

    .nav-links {
        justify-content: flex-start;
        overflow-x: auto;
        padding: 0 15px;
        gap: 20px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links li a {
        white-space: nowrap;
        padding: 12px 0;
    }

    /* Mobile Menu Dropdowns */
    .submenu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 60vh;
        overflow-y: auto;
        border-radius: 20px 20px 0 0;
        padding: 20px;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
        z-index: 2000;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        display: block;
        visibility: hidden;
    }

    .has-submenu:hover .submenu,
    .kunye-menu:hover .submenu {
        display: none;
    }

    .menu-item.active .submenu,
    .kunye-menu.active .submenu {
        display: block;
        transform: translateY(0);
        visibility: visible;
    }

    /* List View Mobile Fixes */
    .surah-grid.list-view .surah-card {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        padding: 15px;
        gap: 15px;
        height: auto;
    }

    .surah-grid.list-view .surah-header {
        width: auto;
        flex: 1;
        margin-bottom: 0;
        gap: 10px;
    }

    .surah-grid.list-view .surah-titles {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .surah-grid.list-view .surah-name-ar {
        display: block;
        font-size: 1.2rem;
    }

    .surah-grid.list-view .surah-footer {
        width: auto;
        margin-top: 0;
        font-size: 0.8rem;
        gap: 10px;
        flex-direction: column;
        align-items: flex-end;
    }

    /* Surah Detail Fixes */
    .surah-detail-container {
        grid-template-columns: 1fr;
    }

    .verse-header {
        flex-direction: row;
        align-items: center;
    }

    .sidebar {
        position: static;
        order: -1;
    }
}

/* Custom Toast Notification */
.custom-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #222;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 0.95rem;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Inter', sans-serif;
}

.custom-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}