/*
Theme Name: AptlyLearn Royal Blue
Description: Custom highly optimized theme for novels and learning platform.
Author: Mohamed Ragab
Version: 1.0
*/

:root {
    /* Primary Colors */
    --royal-blue: #2563eb; 
    --royal-blue-hover: #1d4ed8;
    
    /* Backgrounds & Cards (Dark Mode) */
    --bg-main: #0B0F19; /* أسود ليلي عميق */
    --card-white: #111827; /* لون الهيدر الداكن */
    --card-dark: rgba(30, 41, 59, 0.7); /* كروت زجاجية داكنة */
    
    /* Typography */
    --text-dark: #F8FAFC; /* العناوين باللون الأبيض الناصع */
    --text-muted: #94A3B8; /* النصوص الفرعية بالرمادي المريح */
    
    /* Borders & Shadows */
    --border-light: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

/* Basic Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-dark);
    font-family: 'Cairo', sans-serif; /* تم التغيير لخط القاهرة */
    line-height: 1.6;
}

/* --- إعدادات الحاوية العامة --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.text-blue {
    color: var(--royal-blue);
}

/* --- الأزرار --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--royal-blue);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--royal-blue-hover);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

/* --- الهيدر الشفاف (Header) --- */
.site-header {
    background-color: transparent !important; /* شفاف تماماً لدمجه مع الصورة */
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 20px 0;
    border: none; 
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.logo-text {
    font-size: 26px;
    font-weight: 800;
    color: var(--royal-blue); 
    text-decoration: none;
}

.logo-text .text-blue {
    color: #ffffff; /* تم تثبيتها للأبيض لتظهر بوضوح فوق صورة الهيرو */
}

/* --- الحاوية الزجاجية للقائمة (الكبسولة) --- */
.site-navigation {
    background-color: rgba(11, 15, 25, 0.4); /* شفافة أكتر وتوري الصورة */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px; 
    padding: 6px 16px;
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.primary-menu {
    display: flex;
    list-style: none;
    gap: 4px;
    align-items: center;
}

.primary-menu a {
    text-decoration: none;
    color: #ffffff; /* أبيض دائم فوق الصورة الداكنة */
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    padding: 8px 20px;
    border-radius: 30px; 
}

/* تأثير الـ Hover */
.primary-menu a:hover {
    color: #ffffff;
    background-color: var(--royal-blue);
}

/* --- أزرار الإجراءات --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* زر تسجيل الدخول الدائري */
.header-actions .btn-primary {
    border-radius: 50px; 
    padding: 10px 32px;
    font-size: 16px;
    font-weight: 700;
}

/* --- زر "انضم كـ كاتب" المستقل --- */
.btn-outline-gold {
    background-color: transparent;
    color: #eab308;
    border: 1px solid #eab308;
    border-radius: 50px;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 700;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-outline-gold:hover {
    background-color: #eab308;
    color: #111827;
    box-shadow: 0 4px 15px rgba(234, 179, 8, 0.3);
}

/* --- شريط البحث المتمدد (الأنيميشن) --- */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    width: 40px; /* العرض المبدئي للأيقونة فقط */
    height: 40px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* شكل البحث لما تضغط عليه يتمدد */
.search-box.active {
    width: 280px; 
    background-color: rgba(11, 15, 25, 0.8);
    border-color: var(--royal-blue);
}

.search-input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    padding: 0 40px 0 16px; /* بادينج عشان النص مابيدخلش في الأيقونة */
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    opacity: 0; /* النص مخفي في البداية */
    transition: opacity 0.3s ease;
}

.search-box.active .search-input {
    opacity: 1; /* إظهار النص عند التمدد */
}

.search-box .search-btn {
    position: absolute;
    right: 0; /* الأيقونة ثابتة في اليمين */
    top: 0;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s ease;
}

.search-box.active .search-btn {
    color: var(--royal-blue); /* لون الأيقونة يتغير للأزرق لما يفتح */
}

/* --- السينمائي Hero Section --- */
.hero-cinematic {
    position: relative;
    height: 100vh; /* تم تكبيره ليغطي الشاشة من الأعلى */
    min-height: 600px;
    display: flex;
    align-items: center;
    overflow: hidden;
    margin-bottom: 40px;
}

.hero-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover;
    background-position: center;
    z-index: 1;
    transition: transform 10s ease; 
}

.hero-cinematic:hover .hero-bg {
    transform: scale(1.05);
}

.hero-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to right, rgba(11, 15, 25, 0.95) 0%, rgba(11, 15, 25, 0.7) 50%, rgba(11, 15, 25, 0.3) 100%);
    z-index: 2;
}

.hero-content-wrapper {
    position: relative;
    z-index: 3;
    width: 100%;
    display: flex;
    justify-content: flex-start; 
}

.hero-info {
    max-width: 600px;
}

/* --- التاجات (Tags) --- */
.tags-group {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tag {
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
}

.royal-tag {
    background-color: var(--royal-blue);
    color: #fff;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.dark-tag {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

/* --- النصوص السينمائية --- */
.cinematic-title {
    font-size: 64px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 16px;
    text-shadow: 2px 4px 10px rgba(0,0,0,0.5);
}

.cinematic-desc {
    font-size: 18px;
    line-height: 1.8;
    color: #cbd5e1;
    margin-bottom: 32px;
}

/* --- زر تصفح الروايات الدائري --- */
.btn-royal-pill {
    background-color: var(--royal-blue);
    color: #fff;
    padding: 12px 32px;
    border-radius: 50px; 
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.btn-royal-pill:hover {
    background-color: var(--royal-blue-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

/* --- تصميم شبكة الروايات (Grid) --- */
.novel-section {
    margin-bottom: 60px;
    padding-top: 20px;
}

.section-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--royal-blue);
    margin-bottom: 24px;
    display: inline-block;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 0;
    width: 50%;
    height: 3px;
    background-color: var(--royal-blue);
    border-radius: 2px;
}

.novels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
}

/* --- تصميم كارت الرواية وأنيميشن التكبير --- */
.novel-card {
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-cover {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 2 / 3;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    margin-bottom: 12px;
}

.card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(11, 15, 25, 0.85);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.star { color: #eab308; }

.card-info .novel-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
    transition: color 0.3s ease;
}

.card-info .novel-genre {
    font-size: 13px;
    color: var(--text-muted);
}

/* --- الأنيميشن (Hover Effects) --- */
.novel-card:hover {
    transform: translateY(-10px) scale(1.05);
}

.novel-card:hover .card-cover img {
    transform: scale(1.1);
}

.novel-card:hover .card-cover {
    box-shadow: 0 15px 30px rgba(37, 99, 235, 0.2);
}

.novel-card:hover .novel-name {
    color: var(--royal-blue);
}

/* تجاوب الشاشات (Responsive) */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        height: auto;
        padding: 15px 0;
        gap: 15px;
    }
    
    .primary-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .cinematic-title {
        font-size: 40px;
    }
}

/* ====================================================
   تفعيل الوضع الفاتح (Light Mode) 
==================================================== */
body.light-mode {
    --bg-main: #F8FAFC;         
    --card-white: #FFFFFF;      
    --card-dark: #FFFFFF;       
    --text-dark: #0F172A;       
    --text-muted: #475569;      
    --border-light: rgba(0, 0, 0, 0.1);
}

/* زر التبديل */
.theme-toggle-btn {
    background: none;
    border: none;
    color: #ffffff; /* أبيض دائم فوق الصورة الداكنة */
    cursor: pointer;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    color: var(--royal-blue);
}

/* تثبيت لون نصوص الهيرو لتظل بيضاء حتى في الوضع الفاتح (لأن صورة الخلفية داكنة) */
.hero-info .cinematic-title { color: #ffffff; }
.hero-info .cinematic-desc { color: #cbd5e1; }

/* ====================================================
   التدرج السحري أسفل صورة الهيرو (Fade to Background) 
==================================================== */
.hero-cinematic::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 180px; 
    background: linear-gradient(to bottom, transparent 0%, var(--bg-main) 100%);
    z-index: 4;
    pointer-events: none; 
}

/* --- تصميم سلايدر الروايات الأفقي (Carousel) --- */
.slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.novels-slider {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 15px 5px; /* عشان الأنيميشن بتاع التكبير مايتقصش */
    
    /* إخفاء شريط التمرير (Scrollbar) لشكل أنظف وأكثر احترافية */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.novels-slider::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* تثبيت عرض الكارت عشان مايصغرش جوا السلايدر */
.novels-slider .novel-card {
    flex: 0 0 180px; /* العرض الثابت للكارت، تقدر تزوده لو حابب الكارت أعرض */
}

/* --- أزرار السلايدر الجانبية --- */
.slider-btn {
    position: absolute;
    top: 40%; /* السهم يكون في نص صورة الغلاف تقريباً */
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(11, 15, 25, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.slider-btn:hover {
    background-color: var(--royal-blue);
    border-color: var(--royal-blue);
    transform: translateY(-50%) scale(1.1);
}

/* ضبط أماكن الأزرار وتطليعها بره الكروت شوية */
.right-btn {
    right: -22px; 
}

.left-btn {
    left: -22px;
}

/* إخفاء الأزرار في الموبايل، لأن المستخدم بيسحب بصباعه (Swipe) بشكل طبيعي */
@media (max-width: 768px) {
    .slider-btn {
        display: none;
    }
    .slider-wrapper {
        margin: 0 -20px; /* عشان السلايدر ياخد عرض الشاشة بالكامل في الموبايل */
    }
    .novels-slider {
        padding: 15px 20px;
    }
}

/* ====================================================
   تصميم صفحة الرواية المنفردة (Single Novel)
==================================================== */
.novel-header-hero {
    position: relative;
    padding: 120px 0 60px;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 40px;
}

.hero-overlay-dark {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(11, 15, 25, 0.9) 0%, var(--bg-main) 100%);
    backdrop-filter: blur(10px); /* تمويه الصورة الخلفية */
}

.novel-hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 40px;
    align-items: flex-end; /* محاذاة من الأسفل عشان الغلاف يطلع لبره */
}

/* الغلاف */
.novel-cover-wrapper {
    flex: 0 0 280px;
    position: relative;
    transform: translateY(40px); /* تنزيل الغلاف لتحت شوية لكسر الخط */
    z-index: 5;
}

.novel-main-cover {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.1);
}

.novel-rating-badge {
    position: absolute;
    top: 15px; left: 15px;
    background: var(--royal-blue);
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* معلومات الهيرو */
.novel-hero-info {
    flex: 1;
    padding-bottom: 20px;
}

.novel-main-title {
    font-size: 48px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 20px;
}

.novel-genres {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.genre-tag {
    background: rgba(255,255,255,0.1);
    color: #cbd5e1;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.novel-meta-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    color: var(--text-muted);
}

.novel-meta-list strong {
    color: var(--text-dark);
}

.novel-action-buttons {
    display: flex;
    gap: 15px;
}

.btn-outline-light {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 50px;
    padding: 10px 24px;
    font-weight: 600;
}
.btn-outline-light:hover { background: rgba(255,255,255,0.1); }
.btn-large { padding: 12px 32px; border-radius: 50px; }

/* محتوى الرواية من الداخل */
.novel-content-area {
    margin-top: 60px;
}

.novel-section-block {
    margin-bottom: 50px;
    background: var(--card-dark);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
}

.block-title {
    font-size: 24px;
    color: var(--royal-blue);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.novel-synopsis {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-muted);
}

/* شبكة الشخصيات */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.character-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 12px;
}

.char-avatar {
    width: 50px; height: 50px;
    background: var(--royal-blue);
    color: #fff;
    display: flex; justify-content: center; align-items: center;
    font-size: 24px; font-weight: 800;
    border-radius: 50%;
}

.char-info h4 { color: var(--text-dark); margin-bottom: 5px; }
.char-info p { color: var(--text-muted); font-size: 13px; margin: 0; }

.chapters-placeholder {
    padding: 40px; text-align: center; color: var(--text-muted);
    border: 2px dashed var(--border-light); border-radius: 12px;
}

/* تجاوب الموبايل */
@media (max-width: 768px) {
    .novel-hero-content { flex-direction: column; align-items: center; text-align: center; }
    .novel-cover-wrapper { transform: translateY(0); margin-bottom: 20px; flex: 0 0 200px; }
    .novel-genres, .novel-action-buttons { justify-content: center; }
}