:root {
    --primary-color: #990000;
    --primary-dark: #7a0000;
    --text-color: #333333;
    --bg-color: #ffffff;
    --bg-secondary: #f4f4f4;
    --border-color: #ddd;
    --nav-height: 60px;
    --header-height: 60px;
}

[data-theme="dark"] {
    --primary-color: #cc0000;
    --primary-dark: #ff3333;
    --text-color: #f0f0f0;
    --bg-color: #1a1a1a;
    --bg-secondary: #2c2c2c;
    --border-color: #444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    padding-top: var(--header-height);
    padding-bottom: var(--nav-height);
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden; /* Prevent horizontal scroll */
    width: 100%;
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    height: 40px;
    width: 40px;
    border-radius: 5px;
    background: white;
    padding: 2px;
}

.app-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

#version-select {
    padding: 5px;
    border-radius: 4px;
    border: none;
    font-size: 0.9rem;
    max-width: 100px;
}

#btn-theme-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Main Content */
main {
    min-height: calc(100vh - var(--header-height) - var(--nav-height));
    padding: 10px;
}

.hidden-view {
    display: none !important;
}

/* Bible View */
.bible-navigation {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    background: var(--bg-secondary);
    padding: 10px;
    border-radius: 8px;
    justify-content: center;
}

.bible-navigation button {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.bible-text {
    line-height: 1.8;
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
}

.verse {
    margin-bottom: 10px;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.verse-num {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 0.9em;
    margin-right: 5px;
    vertical-align: super;
}

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

.verse.selected {
    background-color: #fff9c4;
    color: #333;
    border-left: 3px solid var(--primary-color);
}

[data-theme="dark"] .verse.selected {
    background-color: #4a4a2e; /* Darker yellow/olive for dark mode */
    color: #fff;
}


/* Floating Share Button */
.floating-share-btn {
    position: fixed;
    bottom: calc(var(--nav-height) + 20px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 30px;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 2000;
    cursor: pointer;
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Audio Player */
.mini-player {
    position: fixed;
    bottom: calc(var(--nav-height) + 10px);
    right: 10px;
    background: var(--primary-color);
    color: white;
    padding: 10px;
    border-radius: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 900;
}

.mini-player button {
    background: none;
    border: none;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

/* Search Bar */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

#search-input {
    flex: 1;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.1rem;
    outline: none;
    background: white;
    color: #333;
}

#search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(153, 0, 0, 0.3);
}

#btn-search {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem; /* Bigger icon */
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: transform 0.2s, background-color 0.2s;
}

#btn-search:active {
    transform: scale(0.95);
}

#btn-search:hover {
    background-color: var(--primary-dark);
}

/* Dictionary */
.dictionary-container {
    width: 100%;
    height: calc(100vh - 150px);
    overflow: hidden;
    position: relative;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Remote Iframes (Need CSS Crop) */
#frame-donate {
    width: 100%;
    height: calc(100% + 170px); 
    border: none;
    background: white;
    margin-top: -170px; 
}

/* Local/Full Iframes (No Crop needed) */
#dictionary-frame,
#frame-strong,
#frame-cifras,
#frame-quiz,
#frame-puzzle,
#frame-words,
#frame-help {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    margin-top: 0;
}

.dictionary-container-full {
    width: 100%;
    height: calc(100vh - 150px);
}

#frame-strong {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.tabs {
    display: flex;
    gap: 10px;
}

.tab-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* List Groups */
.list-group {
    list-style: none;
}

.list-group-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
}

[data-theme="dark"] .bottom-nav {
    background: #222;
    border-color: #444;
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #888;
    cursor: pointer;
    flex: 1; /* Allow flexible width */
    min-width: 0; /* Prevent overflow */
    padding: 0 2px; /* Reduce padding for 7 items */
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item .icon {
    font-size: 1.1rem; /* Slightly smaller */
    margin-bottom: 2px;
}

.nav-item .label {
    font-size: 0.6rem; /* Smaller font for 7 items */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-color);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    border-radius: 8px;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

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

.grid-item {
    padding: 10px;
    background: var(--bg-secondary);
    text-align: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.grid-item:hover {
    background: var(--primary-color);
    color: white;
}

.testament-header {
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
}

/* Sub-Tab Control (Segmented) */
.sub-tabs {
    display: flex;
    background: var(--bg-secondary);
    padding: 5px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.sub-tab-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    font-weight: bold;
    color: #666;
    transition: all 0.3s;
}

.sub-tab-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

[data-theme="dark"] .sub-tab-btn.active {
    background: #333;
    color: var(--primary-color);
}
