/* assets/css/main.css - الأنماط الرئيسية */
/* إعدادات عامة */
:root {
    --primary-color: #075E54;
    --primary-light: #128C7E;
    --primary-dark: #054640;
    --secondary-color: #8D5524;
    --secondary-light: #DFBE9F;
    --secondary-dark: #6D4016;
    --background-color: #F5F1E3;
    --text-color: #333333;
    --white: #FFFFFF;
    --gray-light: #F5F5F5;
    --gray: #E0E0E0;
    --gray-dark: #888888;
    --error-color: #D32F2F;
    --success-color: #388E3C;
    --border-radius: 8px;
    --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* إعادة تعيين عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Amiri', serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    direction: rtl;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--primary-light);
}

ul {
    list-style: none;
}

/* الهيدر */
.site-header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    overflow: visible;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    position: relative;
}

.logo a {
    color: var(--white);
    font-size: 1.5rem;
    font-weight: bold;
    font-family: 'Scheherazade New', serif;
}

.search-box {
    display: flex;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 0.25rem;
    width: 300px;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--white);
    padding: 0.5rem 1rem;
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-box button {
    background: transparent;
    border: none;
    color: var(--white);
    padding: 0.5rem;
    cursor: pointer;
}

.main-nav ul {
    display: flex;
}

.main-nav ul li {
    margin-right: 1.5rem;
}

.main-nav ul li:last-child {
    margin-right: 0;
}

.main-nav ul li a {
    color: var(--white);
    font-weight: bold;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s;
}

.main-nav ul li a:hover {
    border-color: var(--white);
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    flex-shrink: 0;
}

/* التنسيق الرئيسي */
main {
    min-height: calc(100vh - 130px); /* ارتفاع الصفحة ناقص الهيدر والفوتر */
}

.main-container {
    display: flex;
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 1rem;
}

/* الشريط الجانبي */
.sidebar {
    width: 280px;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1rem;
    margin-left: 1rem;
    height: calc(100vh - 130px);
    overflow-y: auto;
    position: sticky;
    top: 80px;
}

.sidebar-header {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--gray);
}

.sidebar-header h3 {
    color: var(--primary-color);
    font-family: 'Scheherazade New', serif;
    text-align: center;
}

.sidebar-search {
    margin-bottom: 1rem;
}

.sidebar-search input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray);
    border-radius: var(--border-radius);
    font-family: 'Amiri', serif;
}

.surah-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--gray-light);
    transition: background-color 0.3s;
}

.surah-item:hover {
    background-color: var(--gray-light);
}

.surah-number {
    width: 30px;
    height: 30px;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

.surah-name {
    flex-grow: 1;
    margin: 0 0.5rem;
}

.surah-count {
    color: var(--gray-dark);
    font-size: 0.9rem;
}

/* منطقة المحتوى */
.content-area {
    flex-grow: 1;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
}

/* صفحة السورة */
.surah-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.surah-header h2 {
    font-family: 'Scheherazade New', serif;
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.surah-info {
    display: inline-block;
    background-color: var(--secondary-light);
    color: var(--secondary-dark);
    padding: 0.25rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.surah-actions {
    margin-top: 1rem;
}

.bismillah {
    text-align: center;
    font-family: 'Scheherazade New', serif;
    font-size: 1.75rem;
    margin-bottom: 2rem;
    color: var(--secondary-color);
}

.ayah-container {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-light);
}

.ayah-text {
    font-family: 'Scheherazade New', serif;
    font-size: 1.5rem;
    line-height: 2.2;
    margin-bottom: 1rem;
    text-align: justify;
}

.ayah-number {
    display: inline-block;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    background-color: var(--secondary-color);
    color: var(--white);
    border-radius: 50%;
    margin-left: 0.5rem;
    font-family: 'Amiri', serif;
    font-size: 0.9rem;
}

.ayah-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: 'Amiri', serif;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: var(--primary-light);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
}

.btn-full {
    width: 100%;
}

.btn-social {
    background-color: #DB4437;
}

.btn-social:hover {
    background-color: #B73229;
}

.tafseer-container {
    background-color: var(--gray-light);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.tafseer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.tafseer-header h4 {
    color: var(--primary-color);
    font-family: 'Scheherazade New', serif;
}

.close-tafseer {
    background: transparent;
    border: none;
    color: var(--gray-dark);
    cursor: pointer;
    font-size: 1.1rem;
}

.tafseer-text {
    text-align: justify;
}

.topics-container {
    margin-top: 1rem;
}

.topics-header h4 {
    color: var(--primary-color);
    font-family: 'Scheherazade New', serif;
    margin-bottom: 0.5rem;
}

.topics-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.topic-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--secondary-light);
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
}

.topic-title {
    font-weight: bold;
}

.topic-category {
    color: var(--secondary-dark);
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

.topic-actions {
    display: flex;
    align-items: center;
}

.upvote-btn {
    background: transparent;
    border: none;
    color: var(--secondary-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.3s;
}

.upvote-btn:hover {
    color: var(--secondary-color);
}

.upvote-btn.voted {
    color: var(--success-color);
    cursor: default;
}

/* مودال التصدير */
/* .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    position: relative;
} */

.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  justify-content: center;
  align-items: center;
  z-index: 999;
}
.modal-content {
  background: white;
  padding: 20px;
  border-radius: 10px;
  max-width: 400px;
}


.close-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-dark);
    cursor: pointer;
}

.export-options {
    margin: 1.5rem 0;
}

.export-options label {
    display: block;
    margin-bottom: 1rem;
}

.export-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* وضع القراءة */
.reading-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.reading-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray);
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
}

.reading-bismillah {
    margin-bottom: 2rem;
}

.reading-ayahs {
    text-align: justify;
    line-height: 2.5;
}

.reading-ayah {
    font-family: 'Scheherazade New', serif;
    font-size: 1.5rem;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s;
}

.reading-ayah:hover {
    background-color: var(--gray-light);
}

.reading-ayah-number {
    display: inline-block;
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-right: 0.25rem;
}

.reading-controls {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    background-color: var(--gray-light);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s;
}

.control-btn:hover {
    background-color: var(--gray);
}

/* النافذة المنبثقة للتفسير */
.tafseer-popup {
    display: none;
    position: absolute;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    width: 90%;
    max-width: 500px;
    z-index: 1000;
}

.popup-content {
    position: relative;
}

.close-popup {
    position: absolute;
    top: 0;
    left: 0;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--gray-dark);
    cursor: pointer;
}

.popup-ayah-text {
    font-family: 'Scheherazade New', serif;
    font-size: 1.25rem;
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray);
}

.popup-tafseer h4,
.popup-topics h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.popup-tafseer {
    margin-bottom: 1rem;
}

.popup-topic {
    display: inline-block;
    background-color: var(--secondary-light);
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.popup-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* صفحات المصادقة */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 130px);
    padding: 2rem 1rem;
}

.auth-box {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.auth-box h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-family: 'Scheherazade New', serif;
}

.auth-error {
    background-color: #FFEBEE;
    color: var(--error-color);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray);
    border-radius: var(--border-radius);
    font-family: 'Amiri', serif;
}

.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background-color: var(--gray);
}

.auth-divider::before {
    right: 0;
}

.auth-divider::after {
    left: 0;
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
}

/* الفوتر */
.site-footer {
    background-color: var(--primary-dark);
    color: var(--white);
    padding: 2rem 0 0;
}

.footer-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.footer-section {
    flex: 1;
    min-width: 250px;
    margin-bottom: 1.5rem;
}

.footer-section h3 {
    color: var(--white);
    margin-bottom: 1rem;
    font-family: 'Scheherazade New', serif;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--secondary-light);
}

.footer-section a:hover {
    color: var(--white);
}

.copyright {
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* الوضع الليلي */
body.dark-mode {
    background-color: #121212;
    color: #E0E0E0;
}

body.dark-mode .sidebar,
body.dark-mode .content-area,
body.dark-mode .reading-container,
body.dark-mode .modal-content,
body.dark-mode .tafseer-popup,
body.dark-mode .auth-box {
    background-color: #1E1E1E;
    color: #E0E0E0;
}

body.dark-mode .tafseer-container {
    background-color: #2A2A2A;
}

body.dark-mode .surah-item:hover {
    background-color: #2A2A2A;
}

body.dark-mode .topic-item {
    background-color: #3A3A3A;
}

body.dark-mode .topic-category {
    color: #BBBBBB;
}

body.dark-mode .control-btn {
    background-color: #2A2A2A;
}

body.dark-mode .control-btn:hover {
    background-color: #3A3A3A;
}

body.dark-mode .form-group input,
body.dark-mode .form-group select {
    background-color: #2A2A2A;
    border-color: #3A3A3A;
    color: #E0E0E0;
}

/* مؤشرات التحميل والأخطاء */
.loading {
    text-align: center;
    padding: 1rem;
    color: var(--gray-dark);
}

.error {
    background-color: #FFEBEE;
    color: var(--error-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
}

/* صفحة الموضوع */
.topic-view {
    padding: 2rem;
}

.topic-header {
    margin-bottom: 2rem;
    text-align: center;
}

.topic-header h2 {
    font-family: 'Scheherazade New', serif;
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.topic-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--gray-dark);
}

.topic-author,
.topic-date,
.topic-upvotes {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ayah-box,
.tafseer-box {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--gray-light);
    border-radius: var(--border-radius);
}

.ayah-box h3,
.tafseer-box h3 {
    color: var(--primary-color);
    font-family: 'Scheherazade New', serif;
    margin-bottom: 1rem;
}

.similar-topics {
    margin-top: 3rem;
}

.similar-topics h3 {
    color: var(--primary-color);
    font-family: 'Scheherazade New', serif;
    margin-bottom: 1.5rem;
    text-align: center;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.topic-card {
    background-color: var(--gray-light);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.topic-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.topic-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.topic-card-meta {
    display: flex;
    justify-content: space-between;
    color: var(--gray-dark);
    font-size: 0.9rem;
}

/* صفحة البحث */
.search-results {
    margin-top: 2rem;
}

.search-results h3 {
    color: var(--primary-color);
    font-family: 'Scheherazade New', serif;
    margin-bottom: 1.5rem;
}

.search-result-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-light);
}

.search-result-item h4 a {
    color: var(--primary-color);
    font-family: 'Scheherazade New', serif;
}

.search-result-text {
    margin: 0.5rem 0;
}

.search-result-meta {
    color: var(--gray-dark);
    font-size: 0.9rem;
}

.search-highlight {
    background-color: rgba(223, 190, 159, 0.3);
    padding: 0 0.25rem;
}

/* صفحة الملف الشخصي */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.profile-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin-left: 1.5rem;
    background-color: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--white);
    font-size: 2.5rem;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info h2 {
    color: var(--primary-color);
    font-family: 'Scheherazade New', serif;
    margin-bottom: 0.5rem;
}

.profile-email,
.profile-date {
    color: var(--gray-dark);
}

.profile-tabs {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--gray);
}

.tab-btn {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    color: var(--gray-dark);
    font-family: 'Amiri', serif;
    font-size: 1rem;
    cursor: pointer;
    transition: color 0.3s, background-color 0.3s;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    font-weight: bold;
}

.tab-content {
    display: none;
    padding: 1.5rem;
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    color: var(--primary-color);
    font-family: 'Scheherazade New', serif;
    margin-bottom: 1.5rem;
}

.user-topics-list,
.bookmarks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-topic-item,
.bookmark-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--gray-light);
    border-radius: var(--border-radius);
}

.topic-details h4,
.bookmark-details h4 {
    margin-bottom: 0.25rem;
}

.topic-meta,
.bookmark-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--gray-dark);
}

.no-items {
    text-align: center;
    color: var(--gray-dark);
    padding: 2rem;
}

.checkbox-group {
    margin-top: 0.5rem;
}

.welcome-box {
    text-align: center;
    padding: 2rem 0;
}

.welcome-box h2 {
    font-family: 'Scheherazade New', serif;
    color: var(--primary-color);
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

.surah-shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.surah-shortcut {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background-color: var(--gray-light);
    border-radius: var(--border-radius);
    transition: transform 0.3s, box-shadow 0.3s;
}

.surah-shortcut:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.recent-topics {
    margin-top: 3rem;
}

.recent-topics h3 {
    color: var(--primary-color);
    font-family: 'Scheherazade New', serif;
    margin-bottom: 1.5rem;
    text-align: center;
}

#recentTopics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}