/* الهيدر */
header {
    background: var(--card-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--accent-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    /* إزالة flex: 1; و justify-content: center; لترتيب العناصر على اليسار */
}

.logo i {
    font-size: 2rem;
    color: var(--accent-color);
}

.logo h1 {
    color: var(--accent-color);
    font-size: 1.8rem;
    font-weight: 700;
}

.nav-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    /* استخدام اللون الأساسي لضمان التناسق مع الثيمات */
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    /* استخدام لون ثانوي أغمق قليلاً أو تأثير ظل مختلف */
    background-color: var(--secondary-color);
    box-shadow: 0 6px 16px rgba(var(--primary-color-rgb), 0.5);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    box-shadow: none;
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
}

/* شريط البحث */
.search-container {
    /* تعديل ليكون شريط البحث جزءًا من الهيدر وليس ثابتاً في الأعلى */
    flex: 1; /* لملء المساحة المتاحة */
    max-width: 500px; /* تحديد أقصى عرض ليكون مرتباً */
    position: relative; /* ليكون جزءاً من تدفق الهيدر */
    display: flex; /* لترتيب العناصر داخله */
    align-items: center;
    margin: 0 20px; /* إضافة هامش جانبي */
}

.search-container.active {
    display: flex;
}

.search-input {
    width: 100%;
    padding: 10px 15px; /* تقليل الحشو ليتناسب مع الهيدر */
    border: 1px solid var(--border-color);
    border-radius: 20px; /* جعل الحواف أكثر استدارة */
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
    margin: 0; /* إزالة الهامش */
}

.search-close {
    /* إخفاء زر الإغلاق إذا كان شريط البحث جزءاً من الهيدر */
    display: none;
}


/* القائمة الجانبية */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1500;
    display: none;
    backdrop-filter: blur(4px);
}

.overlay.active {
    display: block;
}

.drawer {
    position: fixed;
    top: 0;
    right: -350px;
    width: 320px;
    height: 100%;
    background: var(--blur-bg);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    padding: 20px;
    overflow-y: auto;
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-color);
}

.drawer.open {
    right: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--accent-color);
}

.drawer-section {
    margin-bottom: 20px;
}

.drawer-section h3 {
    color: var(--accent-light);
    margin-bottom: 12px;
    font-size: 1.1rem;
    padding-right: 10px;
    border-right: 3px solid var(--accent-color);
}

.categories-list {
    list-style: none;
}

.categories-list li {
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 6px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.categories-list li:hover {
    background: var(--hover-color);
    transform: translateX(-3px);
}

.theme-switcher {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.theme-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.user-info {
    text-align: center;
}

.user-info p {
    margin-bottom: 10px;
}

.logout-btn {
    background: var(--error-color);
}

/* بطاقات المانجا */
.manga-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1, 1fr)); /* تصغير حجم البطاقة */
    gap: 20px;
}
.manga-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* صورتان في الصف على الجوال */
    gap: 1rem;
    margin: 1rem 0;
}

@media (max-width: 480px) {
    .manga-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

.manga-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    position: relative; /* لإضافة تفاصيل فوق الصورة */
}

.manga-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); /* تغيير لون الظل */
    border-color: var(--accent-color);
}

.manga-card:hover .manga-thumbnail {
    transform: scale(1.05);
}

.manga-thumbnail {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.manga-info {
    padding: 10px 15px; /* تقليل الحشو */
    background: var(--card-bg);
    position: relative;
    z-index: 10;
}

.manga-title {
    font-size: 1rem; /* تصغير الخط قليلاً */
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
    color: var(--text-color);
}
.manga-rating {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    gap: 8px;
    font-size: 0.9rem;
}

.stars {
    color: gold;
    display: flex;
    gap: 2px;
}

.manga-views {
    font-size: 0.4rem; /* تصغير خط المشاهدات */
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 5px;
}

.latest-chapter {
    background: var(--accent-color);
    color: white;
    padding: 5px 10px;
    margin-top: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.latest-chapter:hover {
    background: var(--accent-light);
}
    gap: 5px;
}

/* صفحة تفاصيل المانجا */
.manga-detail-content {
    display: none;
}

.manga-detail {
    display: flex;
    gap: 35px;
    margin-bottom: 35px;
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    border: 1px solid var(--border-color);
}

.manga-detail-thumbnail {
    flex: 0 0 320px;
}

.manga-detail-thumbnail img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.manga-detail-info {
    flex: 1;
}

.manga-detail-title {
    font-size: 2.3rem;
    margin-bottom: 20px;
    color: var(--accent-color);
}

.manga-detail-meta {
    display: flex;
    gap: 25px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.manga-detail-description {
    line-height: 1.8;
    margin-bottom: 30px;
    font-size: 1.1rem;
    color: #e0e0e0;
}

/* نظام التقييم */
.rating-section {
    margin: 20px 0;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.rating-stars {
    display: flex;
    gap: 5px;
    direction: ltr;
    margin: 10px 0;
}

.rating-star {
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rating-star:hover,
.rating-star.active {
    color: gold;
    transform: scale(1.2);
}

/* الفصول */
.chapters-list {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    border: 1px solid var(--border-color);
}

.chapters-list h3 {
    margin-bottom: 20px;
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 12px;
    font-size: 1.5rem;
}

.chapter-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin-bottom: 8px;
}

.chapter-item:hover {
    background: var(--hover-color);
    transform: translateX(-5px);
}

.chapter-likes {
    color: #ff4757;
    margin-left: 15px;
    font-size: 0.9rem;
}

/* صفحة الفصل */
.chapter-content {
    display: none;
}

.chapter-header {
    text-align: center;
    margin-bottom: 35px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--accent-color);
}

.chapter-title {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.chapter-subtitle {
    font-size: 1.2rem;
    color: var(--accent-light);
    margin-bottom: 10px;
}

.chapter-description {
    font-size: 1rem;
    color: #aaa;
    line-height: 1.6;
}

.manga-pages {
    margin-bottom: 45px;
}

.manga-page {
    width: 100%;
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
}

.no-pages {
    text-align: center;
    padding: 40px;
    color: #aaa;
    font-size: 1.1rem;
}

.no-chapters {
    text-align: center;
    padding: 20px;
    color: #aaa;
}

/* التعليقات */
.comments-section {
    margin-top: 45px;
}

.comments-section h3 {
    margin-bottom: 25px;
    color: var(--accent-color);
    font-size: 1.5rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 12px;
}

.comment-form {
    margin-bottom: 35px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.comment-input {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    color: var(--text-color);
    margin-bottom: 15px;
    resize: vertical;
    min-height: 100px;
    font-size: 1rem;
}

.comments-list {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid var(--border-color);
}

.comment {
    padding: 18px 0;
    border-bottom: 1px solid var(--border-color);
}

.comment:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    align-items: center;
}

.comment-user {
    font-weight: 600;
    color: var(--accent-light);
    font-size: 1.1rem;
}

.comment-time {
    font-size: 0.85rem;
    color: #aaa;
}

.comment-text {
    line-height: 1.6;
    margin-bottom: 12px;
}

.comment-actions {
    display: flex;
    gap: 20px;
}

.comment-action {
    background: none;
    border: none;
    color: var(--accent-light);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.3s ease;
}

.comment-action:hover {
    color: var(--accent-color);
}

.comment-action.liked {
    color: #ff4757;
}

/* الردود */
.comment-replies {
    margin-top: 15px;
    margin-right: 20px;
}

.reply {
    margin: 10px 0;
    padding: 10px;
    background: var(--hover-color);
    border-radius: 8px;
    border-right: 3px solid var(--accent-color);
}

.reply-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.reply-user {
    font-weight: 600;
    color: var(--accent-light);
}

.reply-time {
    font-size: 0.8rem;
    color: #aaa;
}

.reply-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

.reply-form {
    margin-top: 10px;
    padding: 10px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.reply-input {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-color);
    resize: vertical;
    font-size: 0.9rem;
}

.reply-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.submit-reply, .cancel-reply {
    flex: 1;
    padding: 8px;
    font-size: 0.9rem;
}

/* نافذة تسجيل الدخول */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    display: none;
    backdrop-filter: blur(10px);
}

.auth-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-modal-content {
    background: var(--card-bg);
    padding: 35px;
    border-radius: 15px;
    width: 90%;
    max-width: 420px;
    border: 1px solid var(--border-color);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    position: relative;
}

.auth-modal h2 {
    margin-bottom: 25px;
    text-align: center;
    color: var(--accent-color);
    font-size: 1.8rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-input {
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
}

.auth-buttons {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.auth-buttons .btn {
    flex: 1;
}

.close-modal {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.3rem;
    cursor: pointer;
}

.auth-message {
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    display: none;
}

.auth-message.success {
    background: rgba(40, 167, 69, 0.2);
    border: 1px solid var(--success-color);
    color: var(--success-color);
    display: block;
}

.auth-message.error {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    display: block;
}

/* الإشعارات */
.notification {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.notification:hover {
    background-color: var(--hover-color);
}

.notification.unread {
    background-color: rgba(26, 115, 232, 0.1);
}

.notification-content {
    flex: 1;
}

.notification-content p {
    margin: 0;
    font-size: 0.9rem;
}

.notification-time {
    font-size: 0.8rem;
    color: #aaa;
}

.notification-action {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
}

.no-notifications {
    text-align: center;
    color: #aaa;
    padding: 20px;
}

/* زر الرجوع للهواتف */
.mobile-back-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-light) 100%);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    display: none;
}

.mobile-back-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

/* تحسين تجربة الهاتف */
@media (max-width: 768px) {
    .mobile-back-btn {
        display: block;
    }
    
    .back-btn {
        position: sticky;
        top: 70px;
        z-index: 100;
        background: var(--card-bg);
        margin-bottom: 15px;
    }
}

/* تحسين المظهر العام لأزرار الرجوع */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    transform: translateX(-5px);
}

/* رسالة تأكيد الخروج */
.exit-confirmation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.exit-confirmation-content {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    max-width: 300px;
    margin: 20px;
}

.exit-confirmation-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

/* حالة التحميل */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    flex-direction: column;
    gap: 15px;
}

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

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

.status-message {
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    font-weight: 600;
    display: none;
}

.status-success {
    background: rgba(40, 167, 69, 0.2);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.status-error {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.status-info {
    background: rgba(26, 115, 232, 0.2);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.no-comments {
    text-align: center;
    padding: 40px;
    color: #aaa;
    font-size: 1.1rem;
}


/* تحسين مظهر الإشعارات */
.notification-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.notification-text {
    flex: 1;
}

.notification-message {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
}

.notification-preview {
    font-size: 0.85rem;
    color: #aaa;
    margin: 5px 0;
    line-height: 1.3;
    font-style: italic;
    background: rgba(255,255,255,0.05);
    padding: 8px 12px;
    border-radius: 6px;
    border-right: 2px solid var(--accent-color);
}

.notification-time {
    font-size: 0.8rem;
    color: #888;
}

.notification.unread {
    background: rgba(26, 115, 232, 0.1);
    border-right: 3px solid var(--accent-color);
}

.notification {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.notification:hover {
    background-color: var(--hover-color);
    transform: translateX(-5px);
}

.notification:last-child {
    border-bottom: none;
}

.notification-action {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.notification-action:hover {
    background-color: rgba(26, 115, 232, 0.1);
}

.no-notifications {
    text-align: center;
    color: #aaa;
    padding: 40px 20px;
    font-style: italic;
}