/* ========================================
   LESSON.TN - UNIFIED STYLESHEET
   يستخدم في جميع صفحات الموقع
   ======================================== */

/* ---------- الأساسيات ---------- */
:root {
    --primary: #0f3b5c;
    --primary-dark: #0a2a42;
    --secondary: #f97316;
    --secondary-dark: #e05f00;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f9fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-600: #475569;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ---------- الهيدر والتنقل ---------- */
.site-header {
    background: white;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo a {
    font-size: 1.75rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--secondary);
}

.main-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.main-nav a {
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    transition: color 0.2s;
}

.main-nav a:hover {
    color: var(--secondary);
}

.breadcrumb {
    background: var(--gray-100);
    padding: 0.75rem 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--gray-200);
}

.breadcrumb a {
    color: var(--secondary);
    text-decoration: none;
}

/* ---------- الأزرار ---------- */
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.75rem;
    border-radius: 2rem;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
    padding: 0.7rem 1.5rem;
    border-radius: 2rem;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--secondary-dark);
}

.btn-outline {
    border: 2px solid var(--primary);
    background: transparent;
    padding: 0.7rem 1.5rem;
    border-radius: 2rem;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

.btn-pdf {
    background: #dc2626;
    color: white;
    padding: 0.75rem 1.75rem;
    border-radius: 2rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

/* ---------- TOC (جدول المحتويات) ---------- */
.toc-wrapper {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 70px;
    z-index: 99;
}

.toc {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 0.75rem 0;
}

.toc a {
    text-decoration: none;
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.toc a:hover {
    color: var(--secondary);
}

/* ---------- بطاقة الورقة التعليمية ---------- */
.worksheet-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-lg);
}

.worksheet-header {
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.level-tag, .interactive-badge {
    display: inline-block;
    background: var(--gray-100);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    margin-right: 0.75rem;
    font-weight: 500;
}

.level-tag.a1 { background: #dbeafe; color: #1e40af; }
.level-tag.a2 { background: #dcfce7; color: #166534; }
.level-tag.b1 { background: #fef9c3; color: #854d0e; }
.level-tag.b2 { background: #fed7aa; color: #9a3412; }

h1 {
    font-size: 2.5rem;
    margin: 1rem 0;
    line-height: 1.3;
    color: var(--gray-900);
}

h2 {
    font-size: 1.75rem;
    margin: 1.5rem 0 1rem;
    color: var(--primary);
}

h3 {
    font-size: 1.35rem;
    margin: 1.25rem 0 0.75rem;
}

/* ---------- صناديق المحتوى ---------- */
.tip-box {
    background: #fef9e3;
    border-left: 4px solid var(--warning);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin: 1.25rem 0;
}

.common-mistake {
    background: #fef2f2;
    border-left: 4px solid var(--danger);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin: 1.25rem 0;
}

.summary-box {
    background: var(--primary);
    color: white;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    margin: 1.5rem 0;
}

.summary-box h4 {
    margin-bottom: 0.75rem;
}

/* ---------- التمارين ---------- */
.exercise-group {
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin: 1.5rem 0;
}

.ex-input {
    padding: 0.6rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    width: 250px;
    font-size: 0.9rem;
    transition: border 0.2s;
}

.ex-input:focus {
    outline: none;
    border-color: var(--secondary);
}

.ex-input.correct {
    border-color: var(--success);
    background: #f0fdf4;
}

.ex-input.wrong {
    border-color: var(--danger);
    background: #fef2f2;
}

/* ---------- Drag & Drop ---------- */
.drag-container {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.drag-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.drag-word {
    background: var(--primary);
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: 2rem;
    cursor: grab;
    user-select: none;
    transition: transform 0.1s;
}

.drag-word:active {
    cursor: grabbing;
}

.drop-zones {
    flex: 1;
    min-width: 250px;
}

.drop-zone {
    background: var(--gray-100);
    margin: 0.75rem 0;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 2px dashed var(--gray-400);
    transition: all 0.2s;
}

.drop-zone.dropped-correct {
    background: #e0f7e8;
    border-color: var(--success);
}

.drop-zone.dropped-wrong {
    background: #ffe0e0;
    border-color: var(--danger);
}

.drop-slot {
    font-weight: bold;
    margin-left: 0.5rem;
}

/* ---------- جدول المحتويات الصغير ---------- */
.mini-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--gray-100);
    padding: 1rem;
    border-radius: var(--radius-lg);
    margin: 1.5rem 0;
}

.mini-toc a {
    text-decoration: none;
    color: var(--secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

/* ---------- الـ FAQ ---------- */
.faq-block {
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 2rem 0;
}

.faq-item {
    margin: 1rem 0;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 1rem;
}

.faq-question {
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.faq-answer {
    color: var(--gray-600);
    font-size: 0.95rem;
}

/* ---------- الصفحات ذات الصلة ---------- */
.related-worksheets {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.related-card {
    background: var(--gray-100);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--primary);
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.related-card:hover {
    background: var(--secondary);
    color: white;
    transform: translateY(-3px);
}

/* ---------- الأقسام الرئيسية ---------- */
.pillar-grid, .level-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.pillar-item, .level-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.pillar-item:hover, .level-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* ---------- الفوتر ---------- */
.site-footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: 2.5rem 0;
    margin-top: 3rem;
    text-align: center;
}

.site-footer a {
    color: var(--gray-400);
    text-decoration: none;
}

/* ---------- استجابة للجوال ---------- */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.4rem; }
    
    .main-nav {
        display: none;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .main-nav.show {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background: white;
        padding: 1rem;
        gap: 1rem;
        box-shadow: var(--shadow-md);
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .worksheet-card {
        padding: 1rem;
    }
    
    .drag-container {
        flex-direction: column;
    }
}

/* ---------- أدوات متنوعة ---------- */
.feedback-area {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 500;
}

.feedback-success {
    background: #e0f7e8;
    color: #166534;
}

.feedback-error {
    background: #ffe0e0;
    color: #991b1b;
}

.hidden {
    display: none;
}

.print-friendly {
    display: none;
}

@media print {
    .toc-wrapper, .site-header, .site-footer, .btn-primary, .btn-secondary, .btn-pdf, .related-worksheets {
        display: none;
    }
    
    .worksheet-card {
        box-shadow: none;
        padding: 0;
    }
    
    body {
        background: white;
    }
}

/* ---------- أنيميشن بسيط ---------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.worksheet-card {
    animation: fadeIn 0.4s ease-out;
}