/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.app-header {
    background: #c41e3a;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.app-header h1 {
    font-size: 1.2rem;
    color: white;
    font-weight: 700;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.header-icon {
    font-size: 1.5rem;
    color: white;
}

/* Header tools area */
.header-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tool group holds clusters + theme toggle */
.tool-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* A cluster = bordered group of related buttons */
.tool-cluster {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.25);
}

.btn-tool {
    background: transparent;
    border: none;
    color: white;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    transition: background 0.15s;
    font-family: inherit;
}

.btn-tool:not(:last-child) {
    border-right: 1px solid rgba(255,255,255,0.2);
}

.btn-tool:hover {
    background: rgba(255,255,255,0.25);
}

.btn-tool:active {
    background: rgba(255,255,255,0.35);
}

.btn-tool.active {
    background: rgba(255,255,255,0.3);
}

.btn-tool .material-icons {
    font-size: 1rem;
}

/* Divider between clusters */
.tool-group .tool-cluster + .tool-cluster {
    margin-left: 0.1rem;
}

.btn-theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

.btn-theme-toggle .material-icons {
    font-size: 1.2rem;
}

.btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.28);
}

.btn-theme-toggle:active {
    background: rgba(255, 255, 255, 0.38);
}

.theme-icon {
    display: inline-block;
    transition: transform 0.5s ease;
}

.btn-theme-toggle:hover .theme-icon {
    transform: rotate(-15deg);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 3rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Chapter Selection View */
.chapter-selection {
    background: white;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.chapter-selection h2 {
    text-align: center;
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.chapter-card {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    color: #2c3e50;
    border: none;
    border-radius: 8px;
    padding: 0.85rem 0.6rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    text-align: center;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, rgba(196, 30, 58, 0.05), rgba(196, 30, 58, 0));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chapter-card:hover {
    background: linear-gradient(145deg, #fff, #f8f8f8);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(196, 30, 58, 0.15), 0 3px 8px rgba(0, 0, 0, 0.1);
}

.chapter-card:hover::before {
    opacity: 1;
}

.chapter-card.active {
    background: linear-gradient(145deg, #d32f47, #c41e3a);
    color: white;
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.chapter-card.active::before {
    display: none;
}

.chapter-card:active {
    transform: translateY(0px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: all 0.1s ease;
}

/* Chapter Reading View */
.chapter-reading {
    background: white;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}

.chapter-reading.hidden {
    display: none;
}

.reading-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
}

.reading-header .btn-back {
    display: none; /* removed */
}

.btn-back {
    background: linear-gradient(145deg, #5a6c7d, #4a5c6d);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 4px 12px rgba(74, 92, 109, 0.3), 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.btn-back .material-icons {
    font-size: 1.1rem;
}

.btn-back::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-back:hover {
    background: linear-gradient(145deg, #6a7c8d, #5a6c7d);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 92, 109, 0.4), 0 3px 6px rgba(0, 0, 0, 0.15);
}

.btn-back:hover::before {
    left: 100%;
}

.btn-back:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(74, 92, 109, 0.3);
}

#chapterTitle {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    flex: 1;
}
    font-weight: 600;
    flex: 1;
}

.reading-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-control {
    background: linear-gradient(145deg, #5a6c7d, #4a5c6d);
    color: white;
    border: none;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 44px;
    box-shadow: 0 3px 10px rgba(74, 92, 109, 0.25), 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-control .material-icons {
    font-size: 1.1rem;
}

.btn-control::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn-control:hover {
    background: linear-gradient(145deg, #6a7c8d, #5a6c7d);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 92, 109, 0.35), 0 2px 5px rgba(0, 0, 0, 0.15);
}

.btn-control:hover::after {
    width: 200px;
    height: 200px;
}

.btn-control:active {
    transform: translateY(0) scale(0.96);
    box-shadow: 0 2px 6px rgba(74, 92, 109, 0.3);
}

.btn-control#btnHighlightSelection.active {
    background: linear-gradient(145deg, #ffd700, #ffcd00);
    color: #2c3e50;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-control#btnHighlightSelection.active:hover {
    background: linear-gradient(145deg, #ffe74c, #ffd700);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.5), 0 3px 6px rgba(0, 0, 0, 0.15);
}

.btn-control#btnClearHighlights {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.3), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-control#btnClearHighlights:hover {
    background: linear-gradient(145deg, #ff5e4d, #e74c3c);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4), 0 2px 5px rgba(0, 0, 0, 0.15);
}

.chapter-content {
    background: white;
    padding: 1.5rem 0;
    border-radius: 0;
    margin-bottom: 1.5rem;
    min-height: 300px;
    box-shadow: none;
}

.chapter-content .verse {
    margin-bottom: 0;
    padding: 0.6rem 0.5rem;
    border-left: none;
    padding-left: 0.5rem;
    transition: background 0.2s ease;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    border-radius: 4px;
    line-height: 1.8;
}

.chapter-content .verse:hover {
    background: #f5f5f5;
}

/* Touch/tap highlight — fires on all touch devices */
.chapter-content .verse:active,
.chapter-content .verse.tapped {
    background: #fde8ec;
}

.chapter-content .verse.highlighted {
    background: #ffeb3b;
    padding-left: 0.5rem;
    margin-left: -0.5rem;
}

.chapter-content .verse.highlighted .verse-number {
    color: #d32f2f;
}

/* Line spacing variations — 10 levels
   line-height = space between wrapped lines INSIDE a verse
   padding     = space BETWEEN verses                        */
.chapter-content.spacing-xxtight .verse   { line-height: 1.3; padding-top: 0.1rem;  padding-bottom: 0.1rem;  }
.chapter-content.spacing-xtight .verse    { line-height: 1.4; padding-top: 0.2rem;  padding-bottom: 0.2rem;  }
.chapter-content.spacing-compact .verse   { line-height: 1.5; padding-top: 0.35rem; padding-bottom: 0.35rem; }
.chapter-content.spacing-normal .verse    { line-height: 1.7; padding-top: 0.55rem; padding-bottom: 0.55rem; }
.chapter-content.spacing-relaxed .verse   { line-height: 1.9; padding-top: 0.8rem;  padding-bottom: 0.8rem;  }
.chapter-content.spacing-loose .verse     { line-height: 2.1; padding-top: 1.1rem;  padding-bottom: 1.1rem;  }
.chapter-content.spacing-xloose .verse    { line-height: 2.3; padding-top: 1.5rem;  padding-bottom: 1.5rem;  }
.chapter-content.spacing-xxloose .verse   { line-height: 2.6; padding-top: 2.0rem;  padding-bottom: 2.0rem;  }
.chapter-content.spacing-xxxloose .verse  { line-height: 2.9; padding-top: 2.6rem;  padding-bottom: 2.6rem;  }
.chapter-content.spacing-xxxxloose .verse { line-height: 3.3; padding-top: 3.2rem;  padding-bottom: 3.2rem;  }

.chapter-content .verse-number {
    font-weight: bold;
    color: #c41e3a;
    margin-right: 0.5rem;
    font-size: 1rem;
    min-width: 20px;
    flex-shrink: 0;
    padding-top: 0.05rem;
}

.chapter-content .verse-text {
    color: #333;
    font-size: 1rem;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    line-height: inherit;
}

.chapter-content .verse-text::selection {
    background: #ffeb3b;
    color: #333;
}

.chapter-content .verse-text::-moz-selection {
    background: #ffeb3b;
    color: #333;
}

/* Highlight mark element */
.chapter-content mark {
    background: #ffeb3b;
    color: #333;
    padding: 2px 0;
    border-radius: 2px;
}

/* Font size variations — 6 levels */
.chapter-content.font-small .verse-text    { font-size: 0.75rem; }
.chapter-content.font-medium .verse-text   { font-size: 1rem;    }
.chapter-content.font-large .verse-text    { font-size: 1.3rem;  }
.chapter-content.font-xlarge .verse-text   { font-size: 1.6rem;  }
.chapter-content.font-xxlarge .verse-text  { font-size: 2rem;    }
.chapter-content.font-xxxlarge .verse-text { font-size: 2.5rem;  }

/* Chapter Navigation */
.chapter-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-nav {
    background: linear-gradient(145deg, #5a6c7d, #4a5c6d);
    color: white;
    border: none;
    padding: 0.85rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    max-width: 180px;
    box-shadow: 0 4px 12px rgba(74, 92, 109, 0.3), 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.btn-nav .material-icons {
    font-size: 1.2rem;
}

.btn-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-nav:hover {
    background: linear-gradient(145deg, #6a7c8d, #5a6c7d);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(74, 92, 109, 0.4), 0 3px 6px rgba(0, 0, 0, 0.15);
}

.btn-nav:hover::before {
    left: 100%;
}

.btn-nav:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(74, 92, 109, 0.3);
}

.btn-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    background: linear-gradient(145deg, #95a5b5, #85959d);
    box-shadow: 0 2px 6px rgba(74, 92, 109, 0.2);
}

.btn-nav:disabled:hover {
    transform: none;
    box-shadow: 0 2px 6px rgba(74, 92, 109, 0.2);
}

/* Footer */
.app-footer {
    background: #f5f5f5;
    padding: 1rem;
    text-align: center;
    color: #666;
    border-top: 1px solid #ddd;
    margin-top: 2rem;
    font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.5rem;
    }

    .header-content {
        padding: 0;
    }

    .btn-theme-toggle {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    .chapter-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
        gap: 0.4rem;
    }

    .chapter-card {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
        min-height: 42px;
        border-radius: 6px;
    }

    .chapter-selection,
    .chapter-reading {
        padding: 0;
    }

    .reading-header {
        gap: 0.5rem;
    }

    #chapterTitle {
        width: 100%;
        padding: 0 70px;
    }

    .chapter-navigation {
        flex-direction: column;
    }

    .btn-nav {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem;
    }

    .app-header {
        padding: 1rem;
    }

    .app-header h1 {
        font-size: 1.3rem;
    }

    .btn-theme-toggle {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }

    .chapter-content {
        padding: 1rem 0;
    }

    .chapter-grid {
        grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
        gap: 0.3rem;
    }

    .chapter-card {
        padding: 0.7rem 0.4rem;
        font-size: 0.85rem;
        min-height: 40px;
        border-radius: 6px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chapter-card,
.verse {
    animation: fadeIn 0.3s ease;
}


/* ============================================ */
/* DARK MODE STYLES */
/* ============================================ */

/* Dark mode color variables */
body.dark-mode {
    background: #1a1a2e;
    color: #e0e0e0;
}

/* Dark mode container */
body.dark-mode .container {
    background: #1a1a2e;
}

/* Dark mode header */
body.dark-mode .app-header {
    background: #16213e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

body.dark-mode .btn-theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

body.dark-mode .btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}
/* Dark mode chapter selection */
body.dark-mode .chapter-selection {
    background: transparent;
}

body.dark-mode .chapter-selection h2 {
    color: #e0e0e0;
}

/* Dark mode chapter cards */
body.dark-mode .chapter-card {
    background: linear-gradient(145deg, #2d3748, #1f2937);
    color: #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
}

body.dark-mode .chapter-card::before {
    background: linear-gradient(145deg, rgba(99, 179, 237, 0.1), rgba(99, 179, 237, 0));
}

body.dark-mode .chapter-card:hover {
    background: linear-gradient(145deg, #374151, #2d3748);
    box-shadow: 0 6px 20px rgba(99, 179, 237, 0.2), 0 3px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .chapter-card.active {
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Dark mode chapter reading */
body.dark-mode .chapter-reading {
    background: transparent;
}

body.dark-mode #chapterTitle {
    color: #e0e0e0;
}

/* Dark mode control buttons */
body.dark-mode .btn-back {
    background: linear-gradient(145deg, #374151, #2d3748);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .btn-back:hover {
    background: linear-gradient(145deg, #4b5563, #374151);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 3px 6px rgba(0, 0, 0, 0.3);
}

body.dark-mode .btn-control {
    background: linear-gradient(145deg, #374151, #2d3748);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.2);
}

body.dark-mode .btn-control:hover {
    background: linear-gradient(145deg, #4b5563, #374151);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 2px 5px rgba(0, 0, 0, 0.3);
}

body.dark-mode .btn-control#btnHighlightSelection.active {
    background: linear-gradient(145deg, #fbbf24, #f59e0b);
    color: #1a1a2e;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .btn-control#btnHighlightSelection.active:hover {
    background: linear-gradient(145deg, #fcd34d, #fbbf24);
    box-shadow: 0 5px 15px rgba(251, 191, 36, 0.5), 0 3px 6px rgba(0, 0, 0, 0.3);
}

body.dark-mode .btn-control#btnClearHighlights {
    background: linear-gradient(145deg, #ef4444, #dc2626);
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.4), 0 1px 3px rgba(0, 0, 0, 0.2);
}

body.dark-mode .btn-control#btnClearHighlights:hover {
    background: linear-gradient(145deg, #f87171, #ef4444);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.5), 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Dark mode chapter content */
body.dark-mode .chapter-content {
    background: transparent;
}

body.dark-mode .chapter-content .verse:hover {
    background: rgba(55, 65, 81, 0.3);
}

body.dark-mode .chapter-content .verse:active,
body.dark-mode .chapter-content .verse.tapped {
    background: rgba(239, 68, 68, 0.15);
}

body.dark-mode .chapter-content .verse.highlighted {
    background: rgba(251, 191, 36, 0.25);
}

body.dark-mode .chapter-content .verse.highlighted .verse-number {
    color: #fbbf24;
}

body.dark-mode .chapter-content .verse-number {
    color: #60a5fa;
}

body.dark-mode .chapter-content .verse-text {
    color: #d1d5db;
}

body.dark-mode .chapter-content .verse-text::selection {
    background: rgba(251, 191, 36, 0.4);
    color: #e0e0e0;
}

body.dark-mode .chapter-content mark {
    background: rgba(251, 191, 36, 0.4);
    color: #e0e0e0;
}

/* Dark mode navigation buttons */
body.dark-mode .btn-nav {
    background: linear-gradient(145deg, #374151, #2d3748);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .btn-nav:hover {
    background: linear-gradient(145deg, #4b5563, #374151);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 3px 6px rgba(0, 0, 0, 0.3);
}

body.dark-mode .btn-nav:disabled {
    background: linear-gradient(145deg, #1f2937, #111827);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Dark mode footer */
body.dark-mode .app-footer {
    background: #16213e;
    border-top-color: #374151;
    color: #9ca3af;
}

/* Dark mode transition */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.chapter-card,
.btn-back,
.btn-control,
.btn-nav,
.chapter-content .verse,
.app-header,
.app-footer {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================ */
/* BIBLE SITE — ADDITIONAL STYLES               */
/* ============================================ */

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    gap: 1rem;
    font-size: 1.1rem;
    color: #c41e3a;
}
body.dark-mode .loading-overlay {
    background: rgba(26,26,46,0.92);
    color: #60a5fa;
}
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #ddd;
    border-top-color: #c41e3a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
body.dark-mode .loading-spinner {
    border-color: #374151;
    border-top-color: #60a5fa;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Search Bar */
.search-bar {
    margin-bottom: 1rem;
    position: relative;
}
.search-bar .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 1.2rem;
    pointer-events: none;
}
.search-bar input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    background: #fff;
    color: #333;
}
.search-bar input:focus {
    border-color: #c41e3a;
}
body.dark-mode .search-bar input {
    background: #1f2937;
    border-color: #374151;
    color: #e0e0e0;
}
body.dark-mode .search-bar input:focus {
    border-color: #60a5fa;
}
body.dark-mode .search-bar .search-icon {
    color: #6b7280;
}

/* Testament Tabs */
.testament-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
}
.tab-btn {
    background: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
    font-family: inherit;
}
.tab-btn:hover {
    background: #e0e0e0;
    color: #333;
}
.tab-btn.active {
    background: #c41e3a;
    color: #fff;
    border-color: #c41e3a;
}
body.dark-mode .tab-btn {
    background: #2d3748;
    color: #9ca3af;
}
body.dark-mode .tab-btn:hover {
    background: #374151;
    color: #e0e0e0;
}
body.dark-mode .tab-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

/* Book Grid → List */
.book-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.book-card {
    background: #fff;
    border: none;
    border-bottom: 1px solid #eee;
    border-radius: 0;
    padding: 0.85rem 1rem;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: none;
    transition: background 0.15s;
    font-family: inherit;
}
.book-card:first-child { border-radius: 10px 10px 0 0; border-top: 1px solid #eee; }
.book-card:last-child  { border-radius: 0 0 10px 10px; }
.book-card:hover {
    background: #fdf0f2;
    transform: none;
    box-shadow: none;
}
.book-card .book-num {
    font-size: 0.8rem;
    color: #c41e3a;
    font-weight: 700;
    min-width: 28px;
    text-align: right;
}
.book-card .book-name-am {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1a202c;
}
body.dark-mode .book-card {
    background: #1f2937;
    border-bottom-color: #374151;
    border-top-color: #374151;
    box-shadow: none;
}
body.dark-mode .book-card:hover {
    background: #2d3748;
    box-shadow: none;
    transform: none;
}
body.dark-mode .book-card .book-num  { color: #60a5fa; }
body.dark-mode .book-card .book-name-am { color: #e0e0e0; }

.no-results {
    color: #888;
    text-align: center;
    padding: 2rem;
}

.back-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    position: relative;
}
.back-bar .btn-back {
    position: absolute;
    left: 0;
}
.back-bar h2 {
    color: #333;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    width: 100%;
    padding: 0 90px; /* space for the back button */
}
body.dark-mode .back-bar h2 { color: #e0e0e0; text-align: center; }

.select-label {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    text-align: center;
}
body.dark-mode .select-label { color: #9ca3af; }

/* Chapter Selection base (reset for reuse) */
.chapter-selection {
    background: transparent !important;
    box-shadow: none !important;
    padding-top: 0 !important;
}

/* Reading header title (smaller on mobile) */
.reading-header {
    gap: 0.75rem;
}
.reading-header h2 {
    font-size: 1.15rem;
    text-align: center;
}

/* Section title inside chapter */
.section-title {
    color: #c41e3a;
    font-size: 1rem;
    font-weight: 700;
    margin: 1.5rem 0 0.5rem;
    padding-bottom: 0.3rem;
    text-align: center;
}
body.dark-mode .section-title {
    color: #f87171;
}

/* Header actions row */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}



/* ── Header toolbar responsive ── */
@media (max-width: 600px) {
    .app-header { padding: 0.6rem 1rem; }
    .app-header h1 { font-size: 1rem; }
    .header-icon { font-size: 1.2rem; }
    .btn-tool { min-width: 30px; height: 30px; padding: 0.3rem 0.45rem; font-size: 0.8rem; }
    .btn-tool .material-icons { font-size: 0.9rem; }
    .btn-theme-toggle { width: 32px; height: 32px; }
    .btn-theme-toggle .material-icons { font-size: 1rem; }
}

/* Touch responsiveness — instant tap, no delay */
.chapter-content .verse {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    cursor: pointer;
    transition: background 0.12s ease;
}

/* ══════════════════════════════════════════════
   SETTINGS BAR — drops below header
══════════════════════════════════════════════ */
.settings-bar {
    background: #a8172e;
    border-top: 1px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.55rem 1rem;
}
body.dark-mode .settings-bar {
    background: #111827;
    border-top-color: rgba(255,255,255,0.08);
}

.sbar-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-right: 1px solid rgba(255,255,255,0.2);
}
.sbar-group:last-child { border-right: none; }

.sbar-label {
    color: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
}
.sbar-label .material-icons { font-size: 1.1rem; }

.sbar-cluster {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.12);
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-stool {
    background: transparent;
    border: none;
    color: #fff;
    padding: 0.38rem 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    transition: background 0.15s;
    font-family: inherit;
}
.btn-stool:not(:last-child) { border-right: 1px solid rgba(255,255,255,0.2); }
.btn-stool:hover  { background: rgba(255,255,255,0.22); }
.btn-stool:active { background: rgba(255,255,255,0.35); }
.btn-stool .material-icons { font-size: 1rem; }

.sbar-val {
    padding: 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    min-width: 52px;
    text-align: center;
    white-space: nowrap;
}

/* Active state on gear button when bar is open */
.btn-header-tool {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.btn-header-tool:hover  { background: rgba(255,255,255,0.28); }
.btn-header-tool.active { background: rgba(255,255,255,0.35); border-color: rgba(255,255,255,0.5); }
.btn-header-tool .material-icons { font-size: 1.2rem; }

/* ══════════════════════════════════════════════
   COLOUR PICKER (touch) — centered modal
══════════════════════════════════════════════ */
.color-picker-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 299;
}
.color-picker {
    position: fixed;
    z-index: 300;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.28);
    padding: 1.2rem 1.4rem 1.4rem;
    width: 300px;
    /* Center on screen */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid #eee;
}
body.dark-mode .color-picker { background: #1f2937; border-color: #374151; }

.color-picker-title {
    font-size: 1rem;
    font-weight: 700;
    color: #444;
    margin-bottom: 1rem;
    text-align: center;
}
body.dark-mode .color-picker-title { color: #e0e0e0; }

.color-swatches {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.swatch {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.swatch:hover, .swatch:active { transform: scale(1.18); border-color: #333; }

.swatch-clear {
    background: #f3f4f6 !important;
    border-color: #ddd !important;
    color: #999;
    box-shadow: none;
}
.swatch-clear .material-icons { font-size: 1.2rem; color: #888; }
body.dark-mode .swatch-clear { background: #374151 !important; border-color: #4b5563 !important; }

/* ══ Verse colour highlights — left border + soft background ══ */
.verse.verse-hl-yellow  { background: #FFFDE7 !important; border-left: 4px solid #FFD600 !important; padding-left: 0.6rem !important; }
.verse.verse-hl-green   { background: #F1FFF4 !important; border-left: 4px solid #4CAF50 !important; padding-left: 0.6rem !important; }
.verse.verse-hl-blue    { background: #E8F4FD !important; border-left: 4px solid #2196F3 !important; padding-left: 0.6rem !important; }
.verse.verse-hl-pink    { background: #FFF0F6 !important; border-left: 4px solid #E91E8C !important; padding-left: 0.6rem !important; }
.verse.verse-hl-orange  { background: #FFF8F0 !important; border-left: 4px solid #FF6D00 !important; padding-left: 0.6rem !important; }
.verse.verse-hl-purple  { background: #F5F0FF !important; border-left: 4px solid #7C3AED !important; padding-left: 0.6rem !important; }

body.dark-mode .verse.verse-hl-yellow  { background: rgba(255,214,0,0.12)    !important; border-left: 4px solid #FFD600 !important; padding-left: 0.6rem !important; }
body.dark-mode .verse.verse-hl-green   { background: rgba(76,175,80,0.12)    !important; border-left: 4px solid #4CAF50 !important; padding-left: 0.6rem !important; }
body.dark-mode .verse.verse-hl-blue    { background: rgba(33,150,243,0.12)   !important; border-left: 4px solid #2196F3 !important; padding-left: 0.6rem !important; }
body.dark-mode .verse.verse-hl-pink    { background: rgba(233,30,140,0.12)   !important; border-left: 4px solid #E91E8C !important; padding-left: 0.6rem !important; }
body.dark-mode .verse.verse-hl-orange  { background: rgba(255,109,0,0.12)    !important; border-left: 4px solid #FF6D00 !important; padding-left: 0.6rem !important; }
body.dark-mode .verse.verse-hl-purple  { background: rgba(124,58,237,0.12)   !important; border-left: 4px solid #7C3AED !important; padding-left: 0.6rem !important; }

/* Touch tap flash */
.verse.tapped { background: rgba(196,30,58,0.08) !important; }

/* Remove hover background on touch devices */
@media (pointer: coarse) {
    .chapter-content .verse:hover { background: transparent; }
}

/* ══════════════════════════════════════════════
   READING TITLE BLOCK
══════════════════════════════════════════════ */
.reading-title-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    flex: 1;
    padding: 0;
}

.reading-book-name {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.45rem;
    font-weight: 800;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
    justify-content: center;
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    transition: background 0.15s;
    line-height: 1.3;
}
.reading-book-name:hover { background: rgba(196,30,58,0.07); }
body.dark-mode .reading-book-name { color: #f3f4f6; }
body.dark-mode .reading-book-name:hover { background: rgba(96,165,250,0.1); }

.reading-chapter-num {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: #c41e3a;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    text-align: center;
    justify-content: center;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    transition: background 0.15s;
}
.reading-chapter-num:hover { background: rgba(196,30,58,0.07); }
body.dark-mode .reading-chapter-num { color: #f87171; }
body.dark-mode .reading-chapter-num:hover { background: rgba(248,113,113,0.1); }

.picker-caret {
    font-size: 1rem !important;
    opacity: 0.6;
}

/* ══════════════════════════════════════════════
   PICKER OVERLAYS (full-screen modal)
══════════════════════════════════════════════ */
.picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 400;
    display: flex;
    align-items: center;     /* center vertically */
    justify-content: center;
    padding: 1rem;
}

.picker-modal {
    background: #fff;
    border-radius: 15px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.18);
}
.picker-modal-sm {
    max-height: 60vh;
}
body.dark-mode .picker-modal {
    background: #1f2937;
}

.picker-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem 0.6rem;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
body.dark-mode .picker-modal-header { border-bottom-color: #374151; }

.picker-modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1a202c;
}
body.dark-mode .picker-modal-title { color: #f3f4f6; }

.picker-close-btn {
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
}
.picker-close-btn:hover { background: #e5e7eb; }
.picker-close-btn .material-icons { font-size: 1.1rem; }
body.dark-mode .picker-close-btn { background: #374151; color: #e0e0e0; }
body.dark-mode .picker-close-btn:hover { background: #4b5563; }

/* Testament tabs inside picker */
.picker-testament-tabs {
    display: flex;
    padding: 0.6rem 1rem 0;
    gap: 0.5rem;
    flex-shrink: 0;
}
.picker-tab {
    flex: 1;
    padding: 0.5rem;
    border: none;
    border-radius: 8px;
    background: #f3f4f6;
    color: #555;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.picker-tab.active { background: #c41e3a; color: #fff; }
.picker-tab:hover:not(.active) { background: #e5e7eb; }
body.dark-mode .picker-tab { background: #374151; color: #9ca3af; }
body.dark-mode .picker-tab.active { background: #c41e3a; color: #fff; }
body.dark-mode .picker-tab:hover:not(.active) { background: #4b5563; }

/* Book picker search */
.picker-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
body.dark-mode .picker-search-wrap { border-bottom-color: #374151; }
.picker-search-wrap .material-icons { color: #aaa; font-size: 1.1rem; }
.picker-search-wrap input {
    border: none;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
    flex: 1;
    background: transparent;
    color: #333;
}
body.dark-mode .picker-search-wrap input { color: #e0e0e0; }

/* Book list */
.picker-list {
    overflow-y: auto;
    flex: 1;
    padding: 0.3rem 0;
}

.picker-book-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1.2rem;
    background: none;
    border: none;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.12s;
}
.picker-book-item:hover  { background: #fdf0f2; }
.picker-book-item.active { background: #fde8ec; }
body.dark-mode .picker-book-item { border-bottom-color: #374151; }
body.dark-mode .picker-book-item:hover  { background: rgba(248,113,113,0.08); }
body.dark-mode .picker-book-item.active { background: rgba(248,113,113,0.15); }

.picker-book-num {
    font-size: 0.8rem;
    font-weight: 700;
    color: #c41e3a;
    min-width: 26px;
    text-align: right;
}
body.dark-mode .picker-book-num { color: #f87171; }

.picker-book-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1a202c;
}
body.dark-mode .picker-book-name { color: #e0e0e0; }

/* Chapter grid picker */
.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 0.5rem;
    padding: 1rem;
    overflow-y: auto;
}

.picker-ch-btn {
    background: #f4f4f4;
    border: none;
    border-radius: 8px;
    padding: 0.7rem 0.3rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    color: #2c3e50;
    transition: background 0.15s;
    text-align: center;
}
.picker-ch-btn:hover  { background: #fde8ec; color: #c41e3a; }
.picker-ch-btn.active { background: #c41e3a; color: #fff; }
body.dark-mode .picker-ch-btn { background: #2d3748; color: #e0e0e0; }
body.dark-mode .picker-ch-btn:hover  { background: rgba(248,113,113,0.15); color: #f87171; }
body.dark-mode .picker-ch-btn.active { background: #c41e3a; color: #fff; }

/* All page titles bigger and bolder */
.back-bar h2 {
    font-size: 1.5rem !important;
    font-weight: 800 !important;
}
.chapter-selection h2 {
    font-size: 1.5rem !important;
    font-weight: 800 !important;
}
.select-label {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
}
.section-title {
    font-size: 1.1rem !important;
    font-weight: 800 !important;
}
