:root {
    --primary-color: #00897B;
    --header-bg: #00897B;
    --text-color: #212121;
    --bg-color: #FFFFFF;
    --verse-num-color: #00897B;
    --subheading-color: #666;
    --drawer-bg: #FFFFFF;
    --modal-bg: #FFFFFF;
    --tab-inactive: #BDBDBD;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --verse-hover: rgba(0, 137, 123, 0.05);
}

body.dark-theme {
    --text-color: #E0E0E0;
    --bg-color: #121212;
    --drawer-bg: #1E1E1E;
    --modal-bg: #1E1E1E;
    --subheading-color: #999;
    --verse-num-color: #4DB6AC;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
    min-height: 100vh;
}

@media (min-width: 768px) {
    body {
        border-left: 1px solid #ddd;
        border-right: 1px solid #ddd;
    }
}

header {
    background-color: var(--header-bg);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 2500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

#menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.selector-container {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
}

.header-right {
    display: flex;
    gap: 20px;
}

.header-right button {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

/* Drawer */
.drawer {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background-color: var(--drawer-bg);
    z-index: 4001;
    transition: left 0.3s ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
}

.drawer.open {
    left: 0;
}

.drawer-header {
    height: 180px;
    background-color: #004d40;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#drawer-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.drawer-content {
    padding: 10px 0;
    overflow-y: auto;
    height: calc(100vh - 180px);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

body.dark-theme .loading-overlay {
    background: rgba(18, 18, 18, 0.8);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.spinner-small {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

.local-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    gap: 15px;
    color: var(--subheading-color);
}

.drawer-item {
    padding: 15px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.drawer-item i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    color: #757575;
}

body.dark-theme .drawer-item i {
    color: #BDBDBD;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 4000;
}

.overlay.show {
    display: block;
}

/* Content */
main {
    padding: 20px 24px 80px 24px;
    max-width: 800px;
    margin: 0 auto;
}

#book-title {
    text-align: center;
    font-size: 28px;
    margin-bottom: 20px;
    color: var(--primary-color);
    letter-spacing: 2px;
}

.subheading {
    font-style: italic;
    color: var(--subheading-color);
    margin: 20px 0 10px 0;
    font-size: 16px;
    text-align: center;
}

.verse {
    display: inline;
    margin-right: 4px;
    transition: background-color 0.2s;
    border-radius: 4px;
}

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

.drop-cap {
    float: left;
    font-size: 60px;
    line-height: 50px;
    padding-top: 4px;
    padding-right: 8px;
    padding-left: 3px;
    font-weight: 700;
    color: var(--primary-color);
}

.verse.selected {
    background-color: #B2DFDB;
    color: #004D40;
}

body.dark-theme .verse.selected {
    background-color: #004D40;
    color: #B2DFDB;
}

.verse-num {
    font-weight: 700;
    color: var(--verse-num-color);
    font-size: 14px;
    margin-right: 6px;
    vertical-align: baseline;
}

#chapter-body p {
    margin-bottom: 12px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    height: 100vh;
    background-color: var(--modal-bg);
    z-index: 3000;
    display: none;
}

.modal-partial {
    top: 56px;
    height: calc(100vh - 56px);
    z-index: 3100;
    /* Above regular modal if needed, but definitely above header 2500 */
}

.modal.show {
    display: flex;
    flex-direction: column;
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
}

.tabs {
    display: flex;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 15px;
    font-weight: 500;
    border-bottom: 4px solid transparent;
}

.tab.active {
    border-bottom: 4px solid white;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.tab-content {
    display: none;
}

.tab-content.active-content {
    display: block;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
}

.book-item,
.chapter-item,
.verse-item {
    height: 50px;
    background-color: #E0F2F1;
    color: #00695C;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
}

body.dark-theme .book-item,
body.dark-theme .chapter-item,
body.dark-theme .verse-item {
    background-color: #263238;
    color: #B2DFDB;
}

.grid-section {
    grid-column: 1 / -1;
    margin: 20px 0 10px 0;
    font-weight: 700;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 5px;
    font-size: 18px;
}

.search-input-container {
    display: flex;
    align-items: center;
    padding: 10px;
    gap: 15px;
}

#search-input {
    flex: 1;
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    outline: none;
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.modal-title-bar {
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 20px;
    font-size: 20px;
}

.modal-header button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
}

.settings-body .setting-item {
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}

.settings-body label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
}

.settings-body input[type="range"] {
    width: 100%;
    accent-color: var(--primary-color);
}

.search-result-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.result-ref {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.result-text {
    font-size: 15px;
}

.modal-footer {
    padding: 10px;
    display: flex;
    justify-content: flex-end;
}

#close-modal {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
}

/* Bottom Bar */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    background-color: var(--primary-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0;
    z-index: 1000;
    transition: transform 0.3s;
}

/* Verse Layouts */
.layout-para .verse {
    display: inline;
    margin-right: 4px;
}

.layout-para .verse-num {
    font-size: 0.7em;
    vertical-align: super;
    margin-right: 2px;
}

.layout-line .verse {
    display: block;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 8px;
}

.layout-line .verse-num {
    display: inline-block;
    width: 30px;
    font-weight: bold;
    color: var(--primary-color);
}

#highlight-colors {
    position: absolute;
    bottom: 60px;
    background: white;
    padding: 10px;
    border-radius: 20px;
    display: flex;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.color-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid #ddd;
}

#note-text {
    width: 100%;
    height: 200px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    font-size: 16px;
    margin-bottom: 20px;
}

.save-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
}

.action-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.verse.highlighted {
    background-color: var(--hl-color, #FFF176);
    color: #212121;
}


.hidden {
    display: none !important;
}

#book-title {
    text-align: center;
    width: 100%;
}

/* Info Card */
.info-card {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eee;
    line-height: 1.8;
}

body.dark-theme .info-card {
    background-color: #263238;
    border-color: #37474F;
}

.info-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.info-card h4 {
    margin-top: 20px;
    margin-bottom: 10px;
}

.info-card hr {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid #ddd;
}

body.dark-theme .info-card hr {
    border-top-color: #444;
}

/* Modal Title Bar Refinement */
.modal-title-bar button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.modal-title-bar button:active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Empty State Styling */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}