:root {
    --primary: #00897b;
    --primary-dark: #00695c;
    --bg: #f5f5f5;
    --surface: #ffffff;
    --text: #212121;
    --text-secondary: #757575;
    --border: #e0e0e0;
}

* {
    box-sizing: border-box;
    tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* Header */
.main-header {
    background: var(--primary);
    color: white;
    padding: 0 16px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.main-header h1 {
    margin: 0;
    font-size: 1.2rem;
}

.main-header button {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.header-nav {
    display: flex;
    gap: 20px;
}

.header-nav button {
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px 15px;
    border-radius: 4px;
    transition: background 0.2s;
}

.header-nav button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hidden-mobile {
    display: none !important;
}

/* Main Content */
#main-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    position: relative;
}

.surah-header-banner {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.verse {
    background: var(--surface);
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.verse:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.verse-number {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: bold;
    margin-bottom: 8px;
    display: block;
}

.verse-text-ar {
    font-family: 'Amiri', serif;
    font-size: 1.4rem;
    direction: rtl;
    color: #444;
    margin-bottom: 8px;
    display: block;
}

/* 
   New Translation Classes for Dynamic Sizing 
   Replaces specific .verse-text, .verse-text-en etc. for sizing purposes, 
   though we might keep lang specific classes for font-family if needed.
*/

.verse-translation-primary {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 6px;
    display: block;
}

.verse-translation-secondary {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #555;
    /* Slightly lighter than primary */
    margin-top: 4px;
    display: block;
}

/* Indicators */
.indicator-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.2rem;
}

/* Sidebar */
.sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: var(--surface);
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.3s;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.surah-list {
    overflow-y: auto;
    flex: 1;
}

.surah-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.surah-item:hover {
    background: #f0f0f0;
}

/* Settings & Search Panels */
.settings-panel,
.search-panel {
    position: absolute;
    top: 60px;
    right: 0;
    width: 300px;
    max-width: 100%;
    background: var(--surface);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 16px;
    z-index: 15;
    border-bottom-left-radius: 8px;
}

.settings-panel,
.search-panel {
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

/* Toggles */
.toggle {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle .slider {
    width: 40px;
    height: 20px;
    background: #ccc;
    border-radius: 20px;
    position: relative;
    margin-right: 12px;
    transition: 0.3s;
}

.toggle .slider:before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked+.slider {
    background: var(--primary);
}

.toggle input:checked+.slider:before {
    transform: translateX(20px);
}

/* Details Panel */
.details-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 100%;
    background: var(--surface);
    z-index: 30;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.details-header {
    padding: 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.details-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.quran-text-preview {
    font-style: italic;
    color: #666;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border);
}

.commentary-block {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    border-left: 4px solid #ccc;
}

.commentary-user {
    border-color: #2196f3;
}

.commentary-messianic {
    border-color: #9c27b0;
}

.commentary-abrogated {
    border-color: #f44336;
}

.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.color-btn.selected {
    transform: scale(1.2);
    box-shadow: 0 0 0 2px var(--primary), 0 0 5px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.btn-primary,
.btn-secondary {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: var(--primary);
    color: white;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover,
.btn-secondary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background: #e0f2f1;
    /* Light teal tint */
}

textarea {
    width: 100%;
    height: 80px;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
}

/* Responsive */
@media (max-width: 768px) {
    .details-panel {
        width: 100%;
    }
}

@media (min-width: 769px) {
    .hidden-mobile {
        display: flex !important;
    }
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #323232;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Apologetics Panel */
.apologetics-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 500px;
    max-width: 100%;
    background: var(--surface);
    z-index: 30;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.apologetics-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #7b1fa2 0%, #512da8 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.apologetics-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 500;
}

.apologetics-header button {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.apologetics-header button:hover {
    opacity: 1;
}

.apologetics-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}

.apologetics-intro {
    font-size: 1rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 24px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #7b1fa2;
}

.apologetics-section {
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.section-header {
    background: linear-gradient(135deg, #7b1fa2 0%, #9c27b0 100%);
    color: white;
    padding: 14px 20px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.section-header:hover {
    background: linear-gradient(135deg, #6a1b9a 0%, #8e24aa 100%);
}

.section-header .toggle-icon {
    transition: transform 0.3s;
}

.section-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.section-body {
    padding: 20px;
}

.section-body.collapsed {
    display: none;
}

.section-text {
    font-size: 1rem;
    line-height: 1.7;
    color: #333;
    margin-bottom: 16px;
}

.point-item {
    margin-bottom: 18px;
    padding-left: 16px;
    border-left: 3px solid #e1bee7;
}

.point-heading {
    font-weight: 600;
    color: #7b1fa2;
    margin-bottom: 6px;
    font-size: 1rem;
}

.point-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #444;
}

/* Q&A Styles */
.qa-item {
    margin-bottom: 24px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.qa-question {
    background: linear-gradient(135deg, #ff7043 0%, #f4511e 100%);
    color: white;
    padding: 14px 18px;
    font-weight: 500;
    font-size: 1rem;
    line-height: 1.5;
}

.qa-answer {
    background: #f5f5f5;
    padding: 16px 18px;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #333;
}

/* Bible Reference Links */
.bible-ref {
    display: inline-block;
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: white;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin: 4px 4px 4px 0;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.bible-ref:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(25, 118, 210, 0.4);
}

.quran-ref-note {
    display: inline-block;
    background: #795548;
    color: white;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin: 4px 4px 4px 0;
}

.refs-container {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #ccc;
}

.refs-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 6px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .apologetics-panel {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .btn-text {
        display: none;
    }

    .nav-btn.small-btn {
        padding: 6px 10px;
        font-size: 1.1rem;
        /* Slightly larger icon */
    }
}

@media (min-width: 1200px) {
    .apologetics-panel {
        width: 700px;
    }
}

/* Editor Styles */
.editor-input,
.editor-textarea {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
}

.editor-textarea {
    min-height: 80px;
    resize: vertical;
}

.editor-section {
    border: 1px solid #e0e0e0;
    padding: 15px;
    background: #fff;
    border-radius: 4px;
    margin-bottom: 15px;
}

.editor-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    background: #f0f0f0;
    padding: 10px;
    border-radius: 4px;
}

.section-title-input {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    border: 1px solid #ccc;
    background: white;
    flex: 1;
    margin-right: 10px;
}

.editor-item {
    background: #fafafa;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #eee;
    border-radius: 4px;
}

.btn-delete {
    background: #ff5252;
    color: white;
    border: none;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
    flex-shrink: 0;
}

.btn-delete:hover {
    background: #d32f2f;
}

.btn-delete.small {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
}

.small-btn {
    padding: 4px 8px;
    font-size: 0.85rem;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.nav-btn:hover {
    filter: brightness(1.1);
}

.apologetics-header .nav-btn {
    background: rgba(255, 255, 255, 0.2);
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.apologetics-header .nav-btn .btn-text {
    font-size: 0.95rem;
    font-weight: 400;
}

.apologetics-header .nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.editor-section .nav-btn {
    background: #4caf50;
    color: white;
}

.editor-section .nav-btn:hover {
    background: #388e3c;
}