:root {
    --primary-color: #5fb350;
    --secondary-color: #e1e8ed;
    --accent-color: #5fb350;
    --text-color: #e1e8ed;
    --background-color: #1a1a1a;
    --card-background: #2c2c2c;
    --card-background-appear: #3c3b3b;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    --border-color: #404040;
    --verse-alternate: #324a32;
    --highlight-color: #4b3f1d;
    --border-right: #000000;
    --loading-overlay-bg: rgba(26, 26, 26, 0.9);
    --warning-color: #5fb350; /* New variable for warning color */
    --bg-translucent:rgba(0, 0, 0, 0.15);
    --bg-verse-preview:#1f1f1f;

}

[data-theme="light"] { 
    --primary-color: #5fb350;
    --secondary-color: #34495e;
    --accent-color: #5fb350;
    --text-color: #2c3e50;
    --background-color: rgb(245, 245, 245);
    --card-background: #fff;
    --card-background-appear: #eeecec;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --border-color: #e1e8ed;
    --verse-alternate: #e9faeb;
    --highlight-color: #fff3cd;
    --border-right: #d6d6d6;
    --loading-overlay-bg: rgba(255, 255, 255, 0.9);
    --warning-color: #0b0f01;
    --bg-translucent:rgba(255, 255, 255, 0.85);
    --bg-verse-preview:rgba(225, 232, 220, 0.85);
}

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

body {
    font-family: 'Quicksand', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    transition: background-color 0.3s, color 0.3s;
}

/* Header Styles */
header {
    background-color: var(--card-background);
    color: var(--text-color);
    box-shadow: var(--shadow);
    padding: 0.3rem 0;
    margin-bottom: 2rem;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

header.header-hidden {
    transform: translateY(-100%);
}

.header-content {
    /* max-width: 1400px; */
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title {
    text-align: center;
    flex: 1;
    cursor: pointer;
}

.header-title:hover {
    opacity: 0.8;
}

.header-title h1 {
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

.header-title p {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.menu-btn, .theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.menu-btn:hover, .theme-toggle:hover {
    background-color: var(--accent-color);
    color: white;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background: var(--card-background);
    box-shadow: var(--shadow);
    transition: left 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-background);
}

.sidebar-header h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

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

.sidebar-content {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    /* height: calc(100vh - 80px); */
    height:100%;
}

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

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

.input-group label {
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.input-group input {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: all 0.2s;
    
}

.input-group input:focus {
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
    outline: none;
}

.input-group input::placeholder {
    color: var(--secondary-color);
    opacity: 0.7;
}

#navigate-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-top: 1rem;
    text-align: center;
    width: 100%;
}

#navigate-btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#navigate-btn:active {
    transform: translateY(0);
}

/* Scrollbar styling for sidebar */
.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background-color: var(--secondary-color);
}

/* Update existing styles for dark mode compatibility */
.search-box input {
    background-color: var(--card-background);
    color: var(--text-color);
    border: 2px solid var(--accent-color);
}

.chapter-card {
    background-color: var(--card-background);
    color: var(--text-color);
    padding: 1rem;
    border-radius: 1rem;
    cursor: pointer;
    border: 2px solid var(--border-color);
}

.verse, .arabic-verse {
    background-color: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-right);
    border-radius: 3px;
}

.verse:nth-child(odd), .arabic-verse:nth-child(odd) {
    background-color: var(--verse-alternate);
    
}

@keyframes verse-blink {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: var(--highlight-color);
    }
}

.verse.highlight {
    animation: verse-blink 0.5s 5;
}
.arabic-verse.highlight {
    animation: verse-blink 0.5s 5;
}

.column {
    background-color: var(--card-background);
}

.input-group input {
    background-color: var(--card-background);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.input-group input:focus {
    border-color: var(--accent-color);
}

/* Keep other existing styles ... */

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(375px, 1fr));
    gap: 1.5rem;
    padding: 0 2rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 5rem - 20rem);
}

.reading-container {
    max-width: 2800px;
    margin: 0 auto;
    padding: 0 1rem;
   

}

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

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

#back-btn {
    background-color: var(--card-background);
    color: var(--text-color);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

#back-btn:hover {
    background-color: var(--accent-color);
}

.translation-controls {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.translation-select {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    background-color: white;
}

.verse-number {
    font-size: 0.8rem;
    font-weight: 200;
    color: var(--text-color);

}

.columns-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 1rem;
}

.arabic {
    font-family: 'Traditional Arabic', 'Scheherazade New', serif;
    font-size: 1.8rem;
    line-height: 1.8;
    text-align: right;
    direction: rtl;
}

.translation {
    font-size: 1.1rem;
    line-height: 1.6;
}

.arabic .verse {
    justify-content: flex-end;
    padding: 1rem 2rem;
}

.translation .verse {
    justify-content: flex-start;
    padding: 1rem 1.5rem;
}

.verse::-webkit-scrollbar {
    width: 6px;
}

.verse::-webkit-scrollbar-track {
    background: transparent;
}

.verse::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.verse::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

@media (max-width: 1200px) {
    .columns-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .translation-controls {
        width: 100%;
    }
    .controls{
    /* background-color: red; */
    padding-left:1rem;

}

}

@media (max-width: 600px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
    .columns-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap:0;
    
    }
    h1{
    font-size: 1rem !important;
    }
.verse {
    font-size: 0.6rem;
    padding:0.4rem !important;
}
.arabic-verse {
    font-size: 0.8rem;
    padding-top:2rem !important;
}
.reading-container{
    padding:0.1rem;
}
.controls{
    /* background-color: red; */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

}
.translation-controls{
    /* background-color: red; */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

}
    
    
}
@media (max-width:1200px){
        .columns-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap:0;
    
}
.verse {
    font-size: 1rem;
    padding:0.5rem !important;
}
.arabic-verse {
    font-size: 1.2rem;
    padding-top:2rem !important;
}
.reading-container{
    padding:0.1rem;
}
}

/* Search Container */
.search-container {
    max-width: 800px;
    margin: 0 auto 2rem;
    padding: 0 2rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-box {
    flex: 1;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.8rem 2.5rem 0.8rem 1rem;
    /* border: 2px solid var(--accent-color); */
    border-radius: 10px;
    font-size: 1rem;
    border: none;
   
}

.search-box input:focus {
    outline: none;
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-color);
}

/* Info button styles */
.arabic-verse {
    position: relative;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    background-color: var(--card-background);
    min-height: 80px;
}

.ai-btn {
    position: absolute;
    left: 0rem;
    top: 0rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--accent-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.6;
    font-size: 1.2rem;
    /* border-bottom:2rem; */
}
.info-btn {
    position: absolute;
    left: 2rem;
    top: 0rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--accent-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.6;
    font-size: 1.2rem;
    /* border-bottom: 2rem; */
}
/* Apply spacing between elements inside the summary popup */
.summary-popup-content p,
.summary-popup-content h3,
.summary-popup-content div {
    margin-bottom: 1rem;
}
.summary-popup-content ul{
    list-style: disc;
    padding-left: 1.5rem;
}

.info-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.info-btn:active {
    transform: scale(0.95);
}
.ai-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}
.ai-btn:active {
    transform: scale(0.95);
}

/* Tafsir popup scrollbar */
.tafsir::-webkit-scrollbar {
    width: 8px;
}

.tafsir::-webkit-scrollbar-track {
    background: transparent;
}

.tafsir::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.tafsir::-webkit-scrollbar-thumb:hover {
    background-color: var(--secondary-color);
}

/* Adjust main content to account for fixed header */
main {
    margin-top: 5rem;
}

.search-suggestion {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--card-background);
    padding: 0.5rem 1rem;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow);
    color: var(--accent-color);
    font-size: 0.9rem;
    display: none;
    z-index: 10;
    margin-top: 2px;
}

.search-suggestion.active {
    display: block;
}

/* Footer Styles */
footer {
    background-color: var(--card-background);
    padding: 2rem 4rem;
    margin-top: 4rem;
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    box-shadow: var(--shadow);
}

.left-footer, .right-footer {
    flex: 0 1 auto;
    min-width: 200px;
}

.left-footer h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.left-footer ul {
    list-style: none;
    padding: 0;
}

.left-footer ul li {
    margin-bottom: 0.8rem;
}

.left-footer ul li a, .right-footer a, .footer-link {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

.left-footer ul li a:hover, .right-footer a:hover, .footer-link:hover {
    color: var(--primary-color);
}

.right-footer p {
    color: var(--text-color);
    line-height: 1.6;
}

/* Sidebar Footer Styles */
.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    bottom: 0;
}

.footer-section {
    bottom: 0;
    margin-bottom: 0rem;
    /* background-color: #fff3cd; */
}

.footer-section h3 {
    color: var(--text-color);
    /* margin-bottom: 1rem; */
    font-size: 1.1rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

/* .footer-section ul li {
    margin-bottom: 0.8rem;
} */

.footer-section ul li a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-section ul li a:hover {
    color: var(--primary-color);
}

.footer-section p {
    color: var(--text-color);
    line-height: 1.6;
}

@media (max-width: 768px) {
    footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 2rem;
    }

    .left-footer, .right-footer {
        width: 100%;
    }
}
@media (max-width: 3000px) {
    
.reading-container {
    max-width: 2800px;
}
}

/* Loading Overlay Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--loading-overlay-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease-out;
}

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

.loading-text {
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 500;
}

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

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.cross-ref-item {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--card-bg, rgba(255, 255, 255, 0.03));
  border-left: 3px solid var(--primary-color);
  border-radius: 6px;
  list-style: none;
  transition: background 0.3s;
}

.cross-ref-item:hover {
  background: var(--card-hover-bg, rgba(255, 255, 255, 0.06));
}

.ref-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.ref-button {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Quicksand', sans-serif;
}

.ref-link {
  color: var(--primary-color);
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
}

.ref-link i {
  pointer-events: none;
}

.ref-explainer {
  font-size: 0.85rem;
  color: var(--text-color, #ccc);
  font-family: 'Quicksand', sans-serif;
  line-height: 1.5;
  padding-left: 0.3rem;
}
.referrer{
    text-decoration: underline;
    text-underline-offset:3px;
    text-decoration-thickness: 1.2px;
    padding:2px;
    color: var(--primary-color);
    font-weight: 600;
    font-family: 'Quicksand', sans-serif;
    cursor: pointer;
  
}

.cross-ref-explainer{
    margin-bottom: 1rem; 
    color: var(--text-color); 
    font-size: 1rem; 
    line-height: 1;
    /* margin-left: 0.2rem; */
    
}
.card-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    /* padding: 1rem; */
}

.card {
    background-color: var(--bg-verse-preview);
    padding: 1rem;
    border-radius: 8px;
    /* box-shadow: 0 4px 6px rgba(0,0,0,0.1); */
    color:var(--text-color);
    font-size: 1rem;
    line-height: 1.6;
}

.verse-content {
    display: block;
    white-space: pre-wrap;
}

