/* ==========================================================
   ثيم المملكة السحرية (The Enchanted Kingdom Theme)
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Baloo+Bhaijaan+2:wght@400;600;800&family=Tajawal:wght@500;700;800;900&display=swap');

:root {
    --bg-color: #F3E5F5; /* Pastel Purple */
    --primary: #E0F7FA; /* Turquoise Light */
    --primary-dark: #B2EBF2;
    --secondary: #FCE4EC; /* Soft Sugar Pink */
    --secondary-dark: #F8BBD0;
    --accent: #FFCA28; /* Golden Sparkle */
    --accent-dark: #FFB300;
    --success: #69F0AE; /* Bright Green */
    --rose: #FF80AB; /* Pink Highlight */
    
    --text-dark: #311B92; /* Strict Dark Purple */
    --white: #FFFFFF;
    --shadow: 0 8px 30px rgba(49, 27, 146, 0.15); 
    --border-dark: 2px solid rgba(49, 27, 146, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Baloo Bhaijaan 2', 'Tajawal', sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" style="font-size:30px"><text y="30">✨</text></svg>') 10 30, auto !important;
}

body {
    background: linear-gradient(to bottom, #FF80AB 0%, #FCE4EC 25%, #E0F7FA 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-dark);
    overflow-x: hidden;
    padding-bottom: 120px;
    position: relative;
    font-size: 26px;
    line-height: 1.8;
}

/* ================== تأثيرات الخلفية السحرية ================== */
.enchanted-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.magic-sparkle {
    position: absolute;
    color: #FFCA28;
    opacity: 0.15 !important;
    animation: none !important;
}

.bg-shell {
    position: absolute;
    font-size: 2.5rem;
    color: rgba(129, 212, 250, 0.4);
    opacity: 0.15 !important;
    animation: none !important;
}

/* ================== العناوين ================== */
.welcome-msg h2, .sosawy-logo, .lesson-overlay h2 {
    color: var(--text-dark);
    font-size: 4.5rem;
    font-weight: 900;
    text-align: center;
    text-shadow: 0 4px 10px rgba(142,68,173,0.2);
    margin: 20px 0;
    animation: float-wave 3s ease-in-out infinite alternate;
    position: relative;
    z-index: 10;
}

/* ================== الهيدر العلوي ================== */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(255, 255, 255, 0.7);
    border-bottom: 8px solid var(--secondary-dark);
    border-radius: 0 0 30px 30px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
    position: relative;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.stars-panel {
    background: var(--accent);
    padding: 10px 30px;
    border-radius: 50px;
    border: 4px solid var(--white);
    box-shadow: 0 6px 0 var(--accent-dark);
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s;
}

.stars-panel:hover {
    transform: translateY(-5px) scale(1.05);
}

.sosawy-tool-btn {
    background: linear-gradient(135deg, #F8BBD0, #E1BEE7);
    border: 4px solid var(--white);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    font-size: 2rem;
    color: var(--text-dark);
    box-shadow: 0 6px 0 #BA68C8;
    cursor: pointer;
    transition: all 0.2s;
}

.sosawy-tool-btn:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 #BA68C8;
}

/* ================== البطاقات ================== */
.sosawy-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.sosawy-grid, .sosawy-lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    padding: 20px 0;
}

.chapter-card, .lesson-card, .mode-card {
    background: #FCE4EC;
    border: 8px solid #81D4FA;
    border-radius: 60% 40% 50% 50% / 50% 50% 40% 60%;
    padding: 40px 20px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(255,128,171,0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 280px;
    margin: 0 auto;
    animation: gentleSwing 4s infinite alternate ease-in-out;
}

.chapter-card::before, .lesson-card::before, .mode-card::before {
    content: '';
    position: absolute;
    width: calc(100% - 10px);
    height: calc(100% - 10px);
    border-radius: inherit;
    border: 3px solid rgba(255,255,255,0.5);
    top: 5px;
    left: 5px;
    box-sizing: border-box;
    pointer-events: none;
}

.chapter-icon {
    font-size: 4rem;
    margin-bottom: 10px;
    display: block;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

.chapter-card h3, .lesson-card h3 { 
    font-size: 1.5rem; 
    font-weight: 900; 
    margin-bottom: 5px;
    color: var(--text-dark);
}

.chapter-card p, .lesson-card p { 
    font-size: 1.3rem; 
    font-weight: 800; 
    color: var(--text-dark); 
    opacity: 0.8;
}

.chapter-card:hover, .lesson-card:hover, .mode-card:hover {
    animation: softPulse 1.5s infinite;
    border-color: #FFCA28;
    box-shadow: 0 0 15px rgba(255, 202, 40, 0.6), inset 0 0 10px rgba(255,255,255,1);
    transform: scale(1.05);
}

.chapter-card:active, .lesson-card:active, .mode-card:active {
    transform: translateY(5px);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

/* ================== أزرار الأكشن ================== */
.btn-action {
    background: linear-gradient(135deg, #E0F7FA, #B2EBF2); 
    color: var(--text-dark); 
    border: 4px solid #81D4FA; 
    border-radius: 30px; 
    padding: 15px 35px;
    font-size: 2.2rem;
    font-weight: 900;
    box-shadow: 0 5px 15px rgba(129,212,250,0.5), inset 0 0 10px rgba(255,255,255,0.8); 
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.btn-action.success {
    background: linear-gradient(135deg, #D4EDDA, #A3E4D7);
    border-color: #2ECC71;
}

.btn-action:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 25px rgba(129,212,250,0.6), inset 0 0 20px rgba(255,255,255,1); 
    border-color: var(--accent); 
}

.btn-action:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* ================== نافذة الدروس ================== */
.sosawy-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(243, 229, 245, 0.95);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    padding: 30px;
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

.sosawy-overlay.hidden {
    display: none;
}

.close-btn {
    background: var(--rose);
    color: var(--white);
    border: 4px solid var(--white);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    font-size: 2.5rem;
    font-weight: 900;
    box-shadow: 0 6px 0 #D81B60;
    cursor: pointer;
    align-self: flex-start;
    margin-bottom: 20px;
    transition: all 0.2s;
}
.close-btn:hover { transform: scale(1.1) translateY(-5px); }
.close-btn:active { transform: translateY(6px); box-shadow: 0 0 0 #D81B60; }

/* ================== الحركات ================== */
@keyframes float-wave {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
    100% { transform: translateY(0px) rotate(-2deg); }
}

@keyframes pop {
    0% { transform: scale(0.5); opacity: 0; }
    80% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

.bounce-in {
    animation: pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes gentleSwing {
    0% { transform: rotate(-2deg); }
    100% { transform: rotate(2deg); }
}

@keyframes softPulse {
    0% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 202, 40, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 25px rgba(255, 202, 40, 0.8); }
    100% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 202, 40, 0.4); }
}

/* ================== زر الرئيسية ================== */
.home-btn-sea {
    position: fixed;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #F8BBD0, #E1BEE7);
    color: var(--text-dark);
    padding: 10px 25px;
    border: 3px solid var(--white);
    border-radius: 30px;
    text-decoration: none;
    font-weight: 900;
    font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(225, 190, 231, 0.6);
    z-index: 1500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.home-btn-sea:hover {
    transform: translateY(-5px) scale(1.05);
    background: linear-gradient(135deg, #E1BEE7, #CE93D8);
    box-shadow: 0 6px 15px rgba(225, 190, 231, 0.8);
}
.home-btn-sea:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* ================== الفوتر ================== */
.sosawy-footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    width: 100%;
    position: relative;
    z-index: 10;
}

.sosawy-footer a {
    color: var(--text-dark);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    transition: color 0.2s;
    background: rgba(255, 255, 255, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-block;
}

.sosawy-footer a:hover {
    background: rgba(255, 255, 255, 0.8);
    color: var(--rose);
}

@media (max-width: 768px) {
    .welcome-msg h2, .sosawy-logo, .lesson-overlay h2 { font-size: 3rem; }
    .main-header { flex-direction: column; gap: 15px; border-radius: 0 0 20px 20px;}
    .chapter-icon { font-size: 4.5rem; }
    .chapter-card h3 { font-size: 1.8rem; }
    .btn-action { font-size: 1.8rem !important; padding: 15px 20px !important; }
    .sosawy-overlay { padding: 15px; }
    .chapter-card, .lesson-card, .mode-card { padding: 20px 10px; }
}

@media (max-width: 480px) {
    .welcome-msg h2, .sosawy-logo, .lesson-overlay h2 { font-size: 2.2rem; }
    .chapter-card, .lesson-card, .mode-card { padding: 15px 10px; }
    .chapter-icon { font-size: 3.5rem; }
}
