/* Bible Here - Bible-specific styles */

/* ============================================
   Verse display
   ============================================ */
.bible-verse {
    line-height: 1.8;
    margin-bottom: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    transition: background-color 0.2s ease;
}

.bible-verse:hover {
    background-color: var(--bg-secondary);
}

.bible-verse-selectable {
    cursor: pointer;
    user-select: none;
}

.bible-verse-selectable:hover {
    background-color: rgba(255, 193, 7, 0.1);
}

.bible-verse-selected {
    background-color: rgba(255, 193, 7, 0.15) !important;
    border-left: 3px solid #ffc107;
    padding-left: 0.5rem;
}

.verse-checkbox {
    display: inline-flex;
    align-items: center;
    margin-right: 0.4rem;
    vertical-align: middle;
}

.verse-checkbox input[type="checkbox"] {
    width: 1.1em;
    height: 1.1em;
    cursor: pointer;
    accent-color: var(--accent-primary, #8B4513);
}

.verse-number {
    font-size: 0.75em;
    color: var(--accent-primary);
    vertical-align: super;
    margin-right: 2px;
    font-weight: bold;
}

.verse-content {
    color: var(--text-primary);
}

/* ============================================
   Search highlight — verse-level (P5-2)
   ============================================ */
.bible-verse-highlighted {
    background-color: #fff3cd;
    border-left: 3px solid var(--badge-warning);
    padding-left: 0.75rem;
    animation: highlight-pulse 2s ease-in-out 3;
}

@keyframes highlight-pulse {
    0%, 100% { background-color: #fff3cd; }
    50% { background-color: #ffe69c; }
}

.bible-highlight-bar,
.search-highlight-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: var(--highlight-bg);
    border: 1px solid var(--accent-primary);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.bible-verse-highlight,
mark.bible-verse-highlight {
    background-color: #ffc107;
    color: var(--text-primary);
    padding: 1px 3px;
    border-radius: 2px;
}

/* ============================================
   Chapter title
   ============================================ */
.bible-chapter-content {
    overflow-x: auto;
}

.chapter-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--accent-primary);
}

/* ============================================
   Book selector
   ============================================ */
.bible-book-selector,
.book-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.book-selector select,
.bible-book-selector select {
    flex: 1;
    min-width: 120px;
}

/* Quick jump buttons */
.quick-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.quick-jump .btn {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
}

/* Chapter navigation */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    margin: 0.5rem 0;
}

.chapter-nav .btn {
    min-width: 100px;
}

/* ============================================
   Search
   ============================================ */
.bible-search-page {
    max-width: 960px;
    margin: 0 auto;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-input-group input {
    flex: 1;
}

.bible-search-results {
    margin-top: 0.5rem;
}

.search-result-card {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-result-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.search-result-reference {
    font-weight: bold;
    color: var(--accent-primary);
    margin-bottom: 0.25rem;
}

.search-result-content {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Relevance stars */
.relevance-stars { color: var(--badge-warning); }

/* ============================================
   Bookmark page & list (P5-5)
   ============================================ */
.bible-bookmark-page {
    max-width: 960px;
    margin: 0 auto;
}

.bible-bookmark-list {
    margin-bottom: 1rem;
}

.bible-bookmark-group {
    margin-bottom: 1.5rem;
}

.bible-bookmark-group-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.bookmark-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}

.bookmark-item:last-child { border-bottom: none; }

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

.bookmark-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   Game page (P5-1)
   ============================================ */
.bible-game-page {
    max-width: 720px;
    margin: 0 auto;
}

.bible-game-menu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.bible-game-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bible-game-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.bible-game-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(60%);
}

.bible-game-card.disabled:hover {
    transform: none;
    box-shadow: none;
}

.bible-game-card-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--accent-primary);
}

/* Game playing state */
.bible-game-playing {
    max-width: 600px;
    margin: 0 auto;
}

.bible-game-progress,
.game-progress {
    height: 6px;
    background-color: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.bible-game-progress-bar,
.game-progress-bar {
    height: 100%;
    background-color: var(--accent-primary);
    transition: width 0.3s ease;
}

/* Question card */
.bible-game-question-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.bible-game-question-header {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.bible-game-question-content {
    font-size: 1.15rem;
    line-height: 1.8;
    font-style: italic;
    text-align: center;
    padding: 1rem 0;
    color: var(--text-primary);
}

.bible-game-question-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 0.5rem;
}

/* Game options */
.bible-game-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.bible-game-option,
.game-option {
    padding: 1rem;
    margin: 0.5rem 0;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    text-align: center;
    font-size: 1.1rem;
    background-color: var(--bg-card);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.bible-game-option:hover,
.game-option:hover {
    border-color: var(--accent-primary);
    background-color: var(--bg-secondary);
}

.bible-game-option.correct,
.game-option.correct {
    border-color: var(--badge-success);
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--badge-success);
    font-weight: 600;
}

.bible-game-option.incorrect,
.game-option.incorrect {
    border-color: #DC3545;
    background-color: rgba(220, 53, 69, 0.1);
    color: #DC3545;
}

.bible-game-option.disabled,
.game-option.disabled {
    pointer-events: none;
    opacity: 0.5;
}

/* Game feedback */
.bible-game-feedback {
    text-align: center;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: var(--border-radius);
}

/* Game result screen */
.bible-game-result {
    text-align: center;
    padding: 2rem 1rem;
}

.bible-game-result-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Wrong answer review */
.bible-wrong-answer-list {
    text-align: left;
    margin-top: 1.5rem;
}

.bible-wrong-answer-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.bible-wrong-answer-item:last-child {
    border-bottom: none;
}

.bible-wrong-answer-verse {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 0.25rem;
}

/* ============================================
   Settings page (P5-4)
   ============================================ */
.bible-settings-page {
    max-width: 960px;
    margin: 0 auto;
}

.bible-settings-panel {
    margin-bottom: 1rem;
}

.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* Theme grid & cards */
.bible-theme-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bible-theme-card,
.theme-card {
    display: inline-block;
    width: 120px;
    height: 80px;
    margin: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.bible-theme-card:hover,
.theme-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.bible-theme-card.active,
.theme-card.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary);
}

.theme-card-name {
    position: absolute;
    bottom: 0;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    padding: 2px;
    background: rgba(0,0,0,0.5);
    color: #fff;
}

/* Custom color picker */
.form-control-color {
    width: 3rem;
    height: 3rem;
    padding: 0.25rem;
    border-radius: var(--border-radius);
    cursor: pointer;
}

/* ============================================
   Export dialog (P5-3)
   ============================================ */
.bible-export-backdrop,
.export-dialog-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fade-in 0.2s ease;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.bible-export-dialog,
.export-dialog {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: slide-up 0.25s ease;
}

.bible-export-dialog.show {
    display: block;
}

@keyframes slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.bible-export-content {
    padding: 0;
}

.bible-export-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.bible-export-body {
    padding: 1.5rem;
}

.bible-export-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    animation: toast-in 0.3s ease;
}

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Confirmation dialog */
.confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.confirm-dialog {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    animation: slide-up 0.25s ease;
}

/* Random verse */
.random-verse-card {
    background: var(--bg-card);
    border-left: 4px solid var(--accent-primary);
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-style: italic;
}

.random-verse-reference {
    text-align: right;
    margin-top: 0.75rem;
    font-style: normal;
    color: var(--accent-primary);
    font-size: 0.9rem;
}

/* ============================================
   Responsive design (P5-6)
   ============================================ */
@media (max-width: 768px) {
    .container { padding: 0.5rem; }
    .chapter-nav .btn { min-width: 80px; font-size: 0.85rem; }

    .bible-theme-card,
    .theme-card { width: 90px; height: 60px; }

    /* Game options stack vertically on mobile */
    .bible-game-options {
        grid-template-columns: 1fr;
    }

    .game-option,
    .bible-game-option {
        font-size: 1rem;
        padding: 0.75rem;
    }

    /* Quick jump buttons wrap */
    .quick-jump {
        gap: 0.2rem;
    }

    .quick-jump .btn {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }

    /* Statistics tables scroll horizontally */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Search highlight bar stacks */
    .bible-highlight-bar,
    .search-highlight-bar {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    /* Bookmark filter controls wrap */
    .bible-bookmark-page .btn-group {
        flex-wrap: wrap;
    }

    /* Game menu cards */
    .bible-game-menu {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .book-selector,
    .bible-book-selector { flex-direction: column; }
    .search-input-group { flex-direction: column; }

    /* Narrower export dialog on small screens */
    .bible-export-dialog,
    .export-dialog { width: 95%; padding: 1rem; }

    .chapter-title { font-size: 1.25rem; }
}

/* ============================================
   Accessibility (P5-7)
   ============================================ */

/* Focus styles for interactive elements */
.bible-game-option:focus-visible,
.game-option:focus-visible,
.theme-card:focus-visible,
.bible-theme-card:focus-visible,
.search-result-card:focus-visible,
.bookmark-item:focus-visible,
.bible-game-card:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 25%, transparent);
}

.page-link:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -1px;
}

/* ============================================
   Dark theme (night mode) adjustments (P5-8)
   ============================================ */
[data-theme="night"] .bible-verse-highlighted {
    background-color: #3a2e00;
    border-left-color: #d29922;
}

[data-theme="night"] .bible-verse-highlight,
[data-theme="night"] mark.bible-verse-highlight,
[data-theme="night"] mark {
    background-color: #5c4a00;
    color: #f0e6c0;
}

[data-theme="night"] .search-result-card {
    background-color: var(--bg-card);
}

[data-theme="night"] .export-dialog,
[data-theme="night"] .bible-export-dialog {
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

[data-theme="night"] .game-option.correct,
[data-theme="night"] .bible-game-option.correct {
    background-color: rgba(63, 185, 80, 0.15);
    border-color: #3fb950;
    color: #3fb950;
}

[data-theme="night"] .game-option.incorrect,
[data-theme="night"] .bible-game-option.incorrect {
    background-color: rgba(248, 81, 73, 0.15);
    border-color: #f85149;
    color: #f85149;
}

[data-theme="night"] .confirm-dialog,
[data-theme="night"] .bible-export-dialog {
    border: 1px solid var(--border-color);
}

[data-theme="night"] .theme-card-name {
    background: rgba(0,0,0,0.7);
}

[data-theme="night"] .table-light {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

[data-theme="night"] .table-light th,
[data-theme="night"] .table-light td {
    color: var(--text-primary) !important;
}

[data-theme="night"] .bg-light {
    background-color: var(--bg-secondary) !important;
}

[data-theme="night"] .alert-success {
    background-color: rgba(63, 185, 80, 0.15);
    border-color: #3fb950;
    color: #3fb950;
}

[data-theme="night"] .alert-danger {
    background-color: rgba(248, 81, 73, 0.15);
    border-color: #f85149;
    color: #f85149;
}

[data-theme="night"] .alert-info {
    background-color: rgba(88, 166, 255, 0.15);
    border-color: #58a6ff;
    color: #58a6ff;
}
