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

:root {
    --primary-bg: #f0f3f7;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-main: #2d3436;
    --text-muted: #636e72;
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--primary-bg);
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    direction: rtl;
    min-height: 100vh;
    padding-bottom: 50px;
}

header {
    padding: 40px 20px;
    text-align: center;
    color: white;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 20px;
}

.header-content {
    text-align: right;
    flex: 1;
}

.home-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
    padding: 12px 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

.home-btn:hover {
    background: white;
    color: #1e272e;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
    margin-bottom: 10px;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.student-name {
    color: #f1c40f;
    font-weight: 800;
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Units Grid */
.units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.unit-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--card-shadow);
}

.unit-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 45px rgba(0,0,0,0.2);
}

.unit-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.unit-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    padding: 10px 20px;
    border-radius: 12px;
    margin-bottom: 15px;
}

/* Chapters/Lessons Modal Style (View Change) */
#main-content {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 25px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.3s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chapter-section {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--card-shadow);
}

.chapter-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1e272e;
    border-right: 5px solid #ff6b6b;
    padding-right: 15px;
}

.lessons-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.lesson-item {
    background: white;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #ebeff2;
}

.lesson-item:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.lesson-icon-small {
    font-size: 1.8rem;
    background: #f1f2f6;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.lesson-info h4 {
    font-size: 1.1rem;
    color: #2d3436;
    margin-bottom: 5px;
}

.lesson-info span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.enrichment-tag {
    background: #ffeaa7;
    color: #d6a312;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-right: 10px;
}

/* Responsive */
/* Lesson Page Styles */
.lesson-page {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 40px;
    box-shadow: var(--card-shadow);
}

.back-link {
    background: #cbd5e0;
    border: none;
    padding: 8px 15px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 20px;
    font-weight: 600;
}

.navigation-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 15px;
}

.home-link {
    background: #74b9ff !important;
    color: white !important;
}

.lesson-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.lesson-titles h2 {
    font-size: 2.2rem;
    color: #2d3436;
    margin: 0;
}

.page-badge {
    background: #74b9ff;
    color: white;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
}

.lesson-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #dfe6e9;
    padding-bottom: 10px;
}

.tab-link {
    background: transparent;
    border: none;
    padding: 12px 25px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #636e72;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s;
}

.tab-link:hover {
    background: rgba(255, 255, 255, 0.5);
    color: #2d3436;
}

.tab-link.active {
    background: #0984e3;
    color: white;
    box-shadow: 0 4px 15px rgba(9, 132, 227, 0.3);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header-voice {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.speak-btn {
    background: #6c5ce7;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(108, 92, 231, 0.3);
}

.speak-btn:hover {
    transform: scale(1.05);
    background: #a29bfe;
}

.speak-btn-sm {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #2d3436;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.3s;
}

.chapter-section .speak-btn-sm {
    color: white;
}

.speak-btn-sm:hover {
    background: white;
    transform: scale(1.1);
}

.option-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.option-wrapper .speak-btn-sm {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Voice Hero Card */
.voice-hero-card {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    border-radius: 24px;
    padding: 25px 40px;
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 10px 30px rgba(108, 92, 231, 0.2);
}

.voice-hero-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.voice-hero-icon {
    font-size: 2.5rem;
    background: rgba(255, 255, 255, 0.2);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.voice-hero-card h3 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

/* Mic Button */
.mic-btn {
    background: #ff7675;
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(255, 118, 117, 0.4);
    transition: all 0.3s;
    margin: 20px auto;
}

.mic-btn.listening {
    animation: micPulse 1.5s infinite;
    background: #d63031;
}

@keyframes micPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(214, 48, 49, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 15px rgba(214, 48, 49, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(214, 48, 49, 0); }
}



.info-section {
    margin-bottom: 25px;
}

.info-section h3 {
    font-size: 1.4rem;
    color: #e67e22;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.facts-list {
    list-style: none;
    padding: 0;
}

.facts-list li {
    background: #f1f2f6;
    margin-bottom: 10px;
    padding: 12px 20px;
    border-radius: 12px;
    position: relative;
    padding-right: 40px;
}

.facts-list li::before {
    content: '⭐';
    position: absolute;
    right: 12px;
}

.discovery-box {
    background: #fff9db;
    border-right: 6px solid #f1c40f;
    padding: 20px;
    border-radius: 12px;
    margin-top: 30px;
}

.discovery-box h4 {
    color: #827717;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.lesson-emoji {
    font-size: 3.5rem;
}

.lesson-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.main-image {
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border: 5px solid white;
}

.lesson-text-card {
    background: white;
    padding: 30px;
    border-radius: 20px;
    line-height: 1.8;
}

.lesson-text-card h3 {
    margin-bottom: 15px;
    color: #e67e22;
}

/* Challenge Box */
.challenge-box {
    background: linear-gradient(135deg, #1e3799, #0c2461);
    color: white;
    padding: 40px;
    border-radius: 24px;
    text-align: center;
}

.challenge-box .question {
    font-size: 1.5rem;
    margin: 20px 0;
    font-weight: 700;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.option-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.option-btn:hover {
    background: white;
    color: #0c2461;
    transform: scale(1.05);
}

.feedback-area {
    margin-top: 30px;
    font-size: 1.3rem;
    font-weight: 800;
}

.success-msg { color: #2ecc71; animation: pop 0.5s ease; }
.error-msg { color: #ff7675; animation: shake 0.5s ease; }

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.anim-fade-in {
    animation: fadeIn 0.8s ease-out;
}

/* --- Access Screen Styles --- */
.access-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.access-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 50px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    margin-top: 50px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.access-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.access-card h2 {
    color: white;
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.access-card p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 30px;
}

.access-card input {
    width: 100%;
    padding: 15px 25px;
    border-radius: 15px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 25px;
    outline: none;
    transition: all 0.3s ease;
}

.access-card input:focus {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 15px rgba(255,255,255,0.1);
}

.access-card button {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.access-card button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.premium-visual {
    background: white;
    padding: 30px;
    border-radius: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
}

.heart-pulse {
    animation: premiumPulse 1s infinite ease-in-out;
    width: 80%;
}

@keyframes premiumPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0px red); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 15px rgba(255,0,0,0.3)); }
}

.visual-footer {
    margin-top: 20px;
    text-align: center;
}

.badge {
    background: #e67e22;
    color: white;
    padding: 5px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 10px;
}

.svg-label {
    font-size: 14px;
    font-weight: 800;
}

.fallback-icon {
    font-size: 8rem;
    padding: 40px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .lesson-content-grid { grid-template-columns: 1fr; }
}

/* Progress & Gamification */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    margin: 15px 0 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #55efc4;
    transition: width 0.5s ease-in-out;
}

.progress-text {
    font-size: 0.8rem;
    color: white;
    font-weight: 700;
}

.lesson-completed {
    border: 2px solid #2ecc71 !important;
    background: #f1fff7 !important;
}
