/* Quran Browser Styles */

/* Navigation */
.main-nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.nav-link.active {
    color: var(--accent-primary);
    background: rgba(88, 166, 255, 0.1);
}

.logo {
    text-decoration: none;
    color: inherit;
}

/* Quran Layout */
.quran-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 200px);
}

/* Surah Sidebar */
.surah-sidebar {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1rem;
    height: fit-content;
    max-height: calc(100vh - 150px);
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    margin-bottom: 1rem;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

/* Quick Navigation (Surah + Ayah) */
.quick-nav {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.quick-nav-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quick-nav-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.quick-nav-field label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.quick-nav-field.surah-field {
    width: 100%;
}

.quick-nav-field.ayah-field {
    position: relative;
}

/* Ayah row: ayah field + go button side by side */
.quick-nav-ayah-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.quick-nav-ayah-row .quick-nav-field.ayah-field {
    flex: 0 0 auto;
    width: 70px;
}

/* Select dropdowns */
.quick-nav-field select {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 100%;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.5rem center;
    padding-left: 1.8rem;
}

[dir="ltr"] .quick-nav-field select {
    background-position: right 0.5rem center;
    padding-left: 0.6rem;
    padding-right: 1.8rem;
}

.quick-nav-field select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
}

.quick-nav-field select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quick-go-btn {
    padding: 0.5rem 1.25rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.quick-go-btn:hover:not(:disabled) {
    background: var(--accent-hover, #4a90d9);
    transform: translateY(-1px);
}

.quick-go-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.surah-search {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.surah-search:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.surah-search::placeholder {
    color: var(--text-muted);
}

/* Bookmarks */
.bookmarks-bar {
    margin-top: 0.75rem;
}

.bookmarks-toggle {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bookmarks-toggle:hover {
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.bookmarks-panel {
    margin-top: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem;
    max-height: 240px;
    overflow: auto;
}

.bookmarks-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.6rem 0;
    border-radius: 999px;
}

.bookmarks-subtitle {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    margin-bottom: 0.4rem;
}

.bookmarks-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bookmark-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
}

.bookmark-link {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
}

.bookmark-sub {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.1rem;
}

.bookmark-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.bookmark-action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.bookmark-action-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

/* Search */
.search-panel {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.panel-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.6rem;
}

.search-field label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.search-input {
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
}

.search-filters {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 0.25rem 0 0.5rem;
}

.filter-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
}

.filter-item input {
    width: 16px;
    height: 16px;
}

.search-actions {
    display: flex;
    justify-content: flex-end;
}

.search-clear {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-clear:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.search-status {
    margin-top: 0.6rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    min-height: 1.2em;
}

.search-results {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-result {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

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

.search-result:hover {
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.search-result-title {
    font-weight: 800;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.search-result-sub {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.ayah-item.highlight {
    outline: 2px solid var(--accent-primary);
    outline-offset: 4px;
}

/* Surah List */
.surah-list {
    overflow-y: auto;
    flex: 1;
    padding-left: 0.5rem;
}

.surah-list::-webkit-scrollbar {
    width: 6px;
}

.surah-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.surah-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.surah-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Button reset for surah items */
button.surah-item {
    width: 100%;
    border: none;
    background: transparent;
    text-align: inherit;
    font-family: inherit;
}

.surah-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
}

.surah-item:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

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

.surah-item.active {
    background: rgba(88, 166, 255, 0.15);
    border-inline-end: 3px solid var(--accent-primary);
}

.surah-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.surah-item.active .surah-number {
    background: var(--accent-primary);
    color: white;
}

.surah-info {
    flex: 1;
    min-width: 0;
}

.surah-name-ar {
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.surah-name-en-small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.surah-ayah-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Quran Content */
.quran-content {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 2rem;
}

/* Surah Header */
.surah-header {
    text-align: center !important;
    padding: 1.5rem 0 2rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    direction: ltr;
}

.surah-title {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.surah-title h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin: 0 auto 0.5rem auto;
    font-weight: 600;
    text-align: center !important;
    direction: rtl;
    width: 100%;
}

.surah-name-en {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
    display: block;
    margin: 0 auto 0.5rem auto;
    text-align: center !important;
    direction: ltr;
    width: 100%;
}

.surah-meta {
    margin-top: 0.25rem;
    width: 100%;
    text-align: center;
}

.meta-item {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: inline-block;
    direction: ltr;
}

.surah-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.9rem;
    width: 100%;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 700;
    font-size: 0.85rem;
}

.action-btn:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Bismillah */
.bismillah {
    text-align: center;
    font-size: 1.5rem;
    color: var(--accent-primary);
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: rgba(88, 166, 255, 0.05);
    border-radius: 8px;
    font-family: 'Traditional Arabic', 'Scheherazade', serif;
}

/* Ayahs Container */
.ayahs-container {
    min-height: 400px;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.welcome-message h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Ayah Item */
.ayah-item {
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.ayah-item.is-bookmarked::after {
    content: "★";
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    left: auto;
    font-size: 0.9rem;
    color: var(--accent-primary);
    opacity: 0.95;
    pointer-events: none;
}

[dir="rtl"] .ayah-item.is-bookmarked::after {
    right: auto;
    left: 0.75rem;
}

.ayah-item:hover {
    background: var(--bg-input);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Ayah Popup Menu */
.ayah-menu {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    left: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    z-index: 100;
    min-width: 200px;
    animation: menuFadeIn 0.2s ease;
}

[dir="ltr"] .ayah-menu {
    right: auto;
    left: 0.5rem;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ayah-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s ease;
    text-align: start;
}

.ayah-menu-item:hover {
    background: var(--bg-secondary);
}

.ayah-menu-item:active {
    transform: scale(0.98);
}

.menu-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.menu-label {
    flex: 1;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

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

.ayah-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ayah-number {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 600;
    flex-shrink: 0;
}

.ayah-text {
    font-size: 1.4rem;
    line-height: 2.2;
    color: var(--text-primary);
    font-family: 'Traditional Arabic', 'Scheherazade', 'Amiri', serif;
    direction: rtl;
    text-align: right;
}

.ayah-translation {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    direction: ltr;
    text-align: left;
}

.ayah-meta {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.meta-jummal {
    color: var(--accent-secondary);
    font-weight: 600;
    background: rgba(46, 204, 113, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

/* Surah Navigation */
.surah-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.nav-btn:hover:not(:disabled) {
    background: var(--bg-input);
    border-color: var(--accent-primary);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-arrow {
    font-size: 1.2rem;
    color: var(--accent-primary);
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Attribution Note */
.attribution-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 900px) {
    .quran-layout {
        grid-template-columns: 1fr;
    }

    .surah-sidebar {
        position: relative;
        top: 0;
        max-height: 300px;
    }

    .main-nav {
        display: none;
    }

    .quran-content {
        padding: 1rem;
    }

    .ayah-text {
        font-size: 1.2rem;
    }

    .bismillah {
        font-size: 1.2rem;
    }
}

@media (max-width: 600px) {
    .surah-header .surah-title h1 {
        font-size: 1.5rem;
    }

    .surah-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .surah-nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-btn {
        justify-content: center;
    }
}
