:root {
    --bg-dark: #0f111a;
    --bg-panel: #1a1d2d;
    --bg-card: #22263b;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --border: #334155;
    
    --hebrew-font: 'Noto Sans Hebrew', sans-serif;
    --tamil-font: 'Noto Sans Tamil', sans-serif;
    --main-font: 'Inter', sans-serif;
}

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

body {
    font-family: var(--main-font);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow: hidden; /* Prevent body scroll, handle inside app-container */
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    box-shadow: 4px 0 15px rgba(0,0,0,0.5);
    z-index: 10;
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--accent);
}

.logo i {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.premium-select, .premium-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--main-font);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.premium-select:focus, .premium-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.premium-select:disabled, .premium-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

.premium-btn {
    flex: 1;
    padding: 1rem;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.premium-btn.secondary {
    flex: 0 0 50px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: none;
}

.premium-btn.secondary:hover:not(:disabled) {
    background: var(--border);
    border-color: var(--accent);
}

.premium-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.premium-btn:disabled {
    background: var(--bg-card);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.view-toggles {
    margin-top: auto;
    background-color: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.view-toggles h3 {
    font-size: 1rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.slider {
    position: relative;
    width: 44px;
    height: 22px;
    background-color: var(--border);
    border-radius: 22px;
    transition: 0.3s;
}

.slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: 0.3s;
}

.toggle-switch input:checked + .slider {
    background-color: var(--accent);
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(22px);
}

.label-text {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Main Content */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.content-header {
    padding: 2rem 3rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(26, 29, 45, 0.8);
    backdrop-filter: blur(10px);
    z-index: 5;
}

/* Text Footer Navigation */
.text-footer {
    display: flex;
    justify-content: space-between;
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
}

.nav-button-simple {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.nav-button-simple:hover {
    background: var(--border);
    border-color: var(--accent);
    color: var(--accent);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1.5rem;
    }
    
    .content-header {
        padding: 1.5rem;
    }
    
    .content-header h2 {
        font-size: 1.3rem;
    }
    
    .text-container {
        padding: 1.5rem;
    }
    
    .verse-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .premium-title h1 {
        font-size: 1.5rem;
    }
}

.content-header h2 {
    font-size: 1.8rem;
    font-weight: 300;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 17, 26, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    animation: fadeIn 0.3s ease;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.loader-content p {
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 2px;
    font-size: 0.9rem;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

.premium-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid transparent;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: relative;
    box-shadow: 0 0 20px var(--accent-glow);
}

.premium-spinner::before, .premium-spinner::after {
    content: '';
    position: absolute;
    border: 3px solid transparent;
    border-radius: 50%;
}

.premium-spinner::before {
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border-top-color: #818cf8;
    animation: spin 2s linear infinite;
}

.premium-spinner::after {
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border-top-color: #c7d2fe;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hidden {
    display: none !important;
}

.text-container {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative; /* For absolute loading overlay */
}

.text-container::-webkit-scrollbar {
    width: 8px;
}
.text-container::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
.text-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    opacity: 0.6;
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

/* Verse Item */
.verse-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.verse-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    border-color: rgba(99, 102, 241, 0.5);
}

.verse-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.verse-num {
    background: var(--accent);
    color: white;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.commentary-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s;
}

.commentary-btn:hover {
    color: white;
}

.verse-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.text-col {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.col-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
}

.hebrew-text {
    font-family: var(--hebrew-font);
    font-size: 1.6rem;
    line-height: 1.8;
    direction: rtl;
    text-align: right;
    color: #f8fafc;
}

.tanglish-text {
    font-size: 1.1rem;
    color: #cbd5e1;
    font-style: italic;
}

.english-text {
    font-size: 1.1rem;
    color: #f1f5f9;
}

.tamil-text {
    font-family: var(--tamil-font);
    font-size: 1.1rem;
    color: #e2e8f0;
    line-height: 1.8;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    padding: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal:not(.hidden) .modal-content {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: white;
}

#modal-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

#modal-body {
    overflow-y: auto;
    padding-right: 1rem;
}

#modal-body::-webkit-scrollbar {
    width: 6px;
}
#modal-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.commentary-row {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    padding: 1rem;
}

.comm-tag {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.hebrew-text.small { font-size: 1.1rem; }
.tanglish-text.small, .english-text.small, .tamil-text.small { font-size: 0.85rem; }

/* Remove old modal styles if they are no longer used */
.loading-overlay {
    font-family: var(--tamil-font);
    color: #cbd5e1;
}

.comm-item {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--border);
}

.comm-title {
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 1.2rem;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.comm-section {
    margin-bottom: 1rem;
}

.comm-he {
    font-family: var(--hebrew-font);
    direction: rtl;
    text-align: right;
    font-size: 1.3rem;
    margin-top: 0.3rem;
}

.comm-tanglish {
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.2rem;
}

.comm-en, .comm-ta {
    font-size: 1rem;
    margin-top: 0.3rem;
    line-height: 1.6;
}

.comm-ta {
    font-family: var(--tamil-font);
    color: #cbd5e1;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.verse-card {
    animation: fadeIn 0.5s ease backwards;
}

/* Responsive */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        padding: 1.5rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        gap: 1.5rem;
    }
    
    .view-toggles {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .content-header {
        padding: 1.5rem;
    }
    
    .text-container {
        padding: 1.5rem;
    }
}
