/* learn-layout.css - מבנה Flexbox יציב (בדיוק כמו Quiz) */

/* === מסך הלומדה === */
#learn-screen {
    /* הופך את המסך לקופסת פלקס אחת בגובה המכשיר */
    display: flex;
    flex-direction: column;
    
    position: fixed;
    inset: 0;
    
    height: 100vh;
    height: 100dvh; /* גובה דינמי למובייל */
    
    background: var(--dark);
    overflow: hidden; /* מונע גלילה של המסך כולו */
    
    /* משאיר מקום לתפריט הניווט הקבוע למטה (שגובהו 70px) */
    padding-bottom: 70px; 
    box-sizing: border-box;
    
    z-index: 50;
    display: none;
}

#learn-screen.active {
    display: flex !important; /* חובה כדי להפעיל את הפלקס */
}

/* === חלק 1: כותרת (קבועה למעלה) === */
#learn-screen .screen-header {
    flex-shrink: 0; /* לא מתכווץ */
    z-index: 20;
    background: var(--dark-light);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* === חלק 2: תוכן נגלל (באמצע) === */
#learn-container {
    flex: 1; /* לוקח את כל המקום הפנוי */
    
    overflow-y: auto; /* הגלילה קורית רק כאן! */
    overflow-x: hidden;
    
    padding: 15px;
    padding-bottom: 20px;
    
    -webkit-overflow-scrolling: touch; /* גלילה חלקה באייפון */
    
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* === חלק 3: פרסומת (קבועה למטה כחלק מהפלקס) === */
.learn-sticky-footer {
    flex-shrink: 0; /* לא זז ולא מתכווץ */
    position: relative !important; /* יושב בתוך הזרימה */
    
    width: 100%;
    height: 60px;
    min-height: 60px;
    
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    
    z-index: 100;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* קיבוע גודל המודעה */
.learn-sticky-footer ins.adsbygoogle {
    display: inline-block !important;
    width: 320px !important;
    height: 50px !important;
}

/* === עיצוב הכרטיסים === */
.learn-card {
    background: var(--dark-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    margin-bottom: 10px;
}

.learn-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.badge-cat {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.badge-progress {
    color: var(--gray-light);
    font-size: 0.85rem;
    font-family: monospace;
}

.learn-content-wrap {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.explanation-box {
    background: rgba(16, 185, 129, 0.08);
    border-right: 4px solid var(--secondary);
    padding: 16px;
    border-radius: var(--radius-md);
}

.explanation-box h4 {
    color: var(--secondary);
    margin-bottom: 8px;
    font-size: 1rem;
    display: flex; align-items: center; gap: 8px;
}

.explanation-box p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #e2e8f0;
}

.question-preview h3 {
    font-size: 1.15rem;
    line-height: 1.5;
    margin-bottom: 15px;
    color: white;
}

.learn-img-wrap {
    margin-top: 15px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.2);
    display: flex;
    justify-content: center;
    padding: 10px;
}

.learn-img-wrap img {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    cursor: zoom-in;
}

.answer-box {
    background: rgba(255,255,255,0.03);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-top: 20px;
    border: 1px solid rgba(255,255,255,0.08);
    animation: slideUp 0.3s ease-out;
}

.answer-box strong { display: block; color: var(--gray-light); font-size: 0.85rem; margin-bottom: 6px; }
.the-answer { font-size: 1.2rem; font-weight: 700; color: white; }

.learn-footer {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.rating-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.btn-rate {
    padding: 12px 5px;
    border-radius: var(--radius-md);
    border: none;
    color: white;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    font-size: 0.9rem; font-weight: 600;
    font-family: var(--font-main);
}

.rate-0 { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.rate-3 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.rate-5 { background: linear-gradient(135deg, #10b981, #059669); }

.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; height: 100%; padding: 20px;
}
.empty-state .icon { font-size: 5rem; margin-bottom: 20px; animation: bounce 2s infinite; }

@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }