/* ===========================================
   Python Course - Accessible Arabic Design
   High Contrast & Easy to Read Colors
   =========================================== */

/* CSS Variables for Python Theme - Accessible Colors */
:root {
    /* Primary Colors - Softer, Eye-friendly */
    --python-blue: #2563eb;
    --python-blue-light: #3b82f6;
    --python-blue-dark: #1d4ed8;
    --python-accent: #0ea5e9;
    --python-teal: #0d9488;

    /* Background Colors - Warm, Comfortable */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;

    /* Text Colors - High Contrast for Readability */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    /* Border Colors */
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;

    /* Accent Colors for Info Boxes */
    --success-color: #059669;
    --success-bg: #ecfdf5;
    --success-border: #10b981;

    --warning-color: #d97706;
    --warning-bg: #fffbeb;
    --warning-border: #f59e0b;

    --error-color: #dc2626;
    --error-bg: #fef2f2;
    --error-border: #ef4444;

    --info-color: #2563eb;
    --info-bg: #eff6ff;
    --info-border: #3b82f6;

    /* Code Block Colors - Easy on Eyes */
    --code-bg: #1e293b;
    --code-text: #e2e8f0;
    --code-keyword: #7dd3fc;
    --code-string: #fbbf24;
    --code-comment: #94a3b8;
    --code-function: #a5f3fc;
    --code-number: #86efac;
    --code-header: #334155;

    /* Gradients - Softer, Professional */
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    --gradient-hero: linear-gradient(135deg, #1e40af 0%, #0369a1 50%, #0d9488 100%);
    --gradient-card: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);

    /* Shadows - Subtle */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.1);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* Dark Mode - Comfortable Night Reading */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #64748b;

    --border-color: #334155;
    --border-hover: #475569;

    --success-bg: rgba(5, 150, 105, 0.15);
    --warning-bg: rgba(217, 119, 6, 0.15);
    --error-bg: rgba(220, 38, 38, 0.15);
    --info-bg: rgba(37, 99, 235, 0.15);

    --code-bg: #0f172a;
    --code-header: #1e293b;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.4);
}

/* ===========================================
   Base Typography - Readable Sizes
   =========================================== */
.lesson-content,
.content-card {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.lesson-content h2,
.content-card h2 {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2.5rem 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--python-blue);
}

.lesson-content h2:first-child,
.content-card h2:first-child {
    margin-top: 0;
}

.lesson-content h3,
.content-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 2rem 0 1rem;
}

.lesson-content p,
.content-card p {
    margin-bottom: 1.25rem;
    color: var(--text-secondary);
}

.lesson-content ul,
.lesson-content ol,
.content-card ul,
.content-card ol {
    margin: 1.25rem 0;
    padding-right: 1.5rem;
}

.lesson-content li,
.content-card li {
    margin-bottom: 0.625rem;
    line-height: 1.75;
}

/* ===========================================
   Lesson Hero - Clean, Professional
   =========================================== */
.lesson-hero {
    background: var(--gradient-hero);
    padding: 5rem 0 3.5rem;
    position: relative;
    overflow: hidden;
}

.lesson-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M20 20h20v20H20V20zM0 0h20v20H0V0z'/%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
    position: relative;
    z-index: 1;
    color: white;
    text-align: center;
}

.lesson-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-full);
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.lesson-hero h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hero-description {
    font-size: 1.125rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto 1.5rem;
    line-height: 1.7;
}

.hero-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    opacity: 0.9;
}

.meta-icon {
    font-size: 1.125rem;
}

/* ===========================================
   Content Card
   =========================================== */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

/* ===========================================
   Code Blocks - High Readability
   =========================================== */
.code-block {
    margin: 1.75rem 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    direction: ltr;
    border: 1px solid var(--border-color);
}

.code-header {
    background: var(--code-header);
    padding: 0.875rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.code-lang {
    background: var(--python-blue);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-title {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-right: auto;
    margin-left: 1rem;
}

.code-block pre {
    background: var(--code-bg);
    margin: 0;
    padding: 1.25rem;
    overflow-x: auto;
    font-family: 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.9375rem;
    line-height: 1.7;
    tab-size: 4;
}

.code-block code {
    color: var(--code-text);
    font-family: inherit;
}

/* Code Comments - More Visible */
.code-block .comment {
    color: #94a3b8;
    font-style: italic;
}

/* ===========================================
   Info Boxes - Clear Visual Hierarchy
   =========================================== */
.info-box {
    margin: 1.75rem 0;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md);
    border-right: 4px solid;
    background: var(--info-bg);
    border-color: var(--info-border);
}

.info-box.tip,
.info-box.success {
    background: var(--success-bg);
    border-color: var(--success-border);
}

.info-box.warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
}

.info-box.danger,
.info-box.error {
    background: var(--error-bg);
    border-color: var(--error-border);
}

.info-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-box p {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.info-box ul {
    margin: 0.75rem 0 0;
    padding-right: 1.25rem;
}

.info-box li {
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
}

.info-box code {
    background: rgba(0,0,0,0.08);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.875rem;
}

[data-theme="dark"] .info-box code {
    background: rgba(255,255,255,0.1);
}

/* ===========================================
   Warning Box
   =========================================== */
.warning-box {
    margin: 1.75rem 0;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md);
    border-right: 4px solid var(--warning-border);
    background: var(--warning-bg);
}

.warning-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--warning-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.warning-box p {
    margin: 0 0 1rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.warning-box pre {
    background: var(--code-bg);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    direction: ltr;
}

.warning-box code {
    color: var(--code-text);
}

/* ===========================================
   Challenge Card - Engaging but Readable
   =========================================== */
.challenge-card {
    margin: 2rem 0;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.challenge-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.challenge-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: white;
    position: relative;
}

.challenge-card p {
    color: rgba(255,255,255,0.95);
    margin-bottom: 1rem;
    position: relative;
}

.challenge-card ol,
.challenge-card ul {
    margin: 1rem 0;
    padding-right: 1.25rem;
    position: relative;
}

.challenge-card li {
    color: rgba(255,255,255,0.95);
    margin-bottom: 0.5rem;
}

.challenge-card code {
    background: rgba(0,0,0,0.25);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.875rem;
}

/* Solution Toggle */
.solution {
    margin-top: 1.25rem;
    position: relative;
}

.solution summary {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
    list-style: none;
}

.solution summary::-webkit-details-marker {
    display: none;
}

.solution summary:hover {
    background: rgba(255,255,255,0.3);
}

.solution pre {
    margin-top: 1rem;
    background: rgba(0,0,0,0.3);
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    direction: ltr;
}

.solution code {
    background: transparent;
    padding: 0;
    color: rgba(255,255,255,0.95);
}

/* ===========================================
   Summary Box
   =========================================== */
.summary-box {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.summary-box h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--text-primary);
}

.summary-box ul {
    margin: 0;
    padding-right: 1.25rem;
}

.summary-box li {
    margin-bottom: 0.625rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.summary-box code {
    background: var(--bg-primary);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.8125rem;
    color: var(--python-blue);
}

/* ===========================================
   Inline Code
   =========================================== */
.lesson-content code,
.content-card code {
    background: var(--bg-tertiary);
    color: var(--python-blue-dark);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.875rem;
    direction: ltr;
    display: inline-block;
}

[data-theme="dark"] .lesson-content code,
[data-theme="dark"] .content-card code {
    background: var(--bg-tertiary);
    color: var(--python-accent);
}

/* ===========================================
   Lesson Navigation
   =========================================== */
.lesson-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 2.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border-color);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.nav-btn:hover {
    border-color: var(--python-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.nav-btn.prev {
    text-align: right;
}

.nav-btn.next {
    flex-direction: row-reverse;
    text-align: left;
}

.nav-btn .arrow {
    font-size: 1.25rem;
    color: var(--python-blue);
    font-weight: 700;
}

.nav-btn .label {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

/* ===========================================
   Next Lesson Text
   =========================================== */
.next-lesson {
    margin-top: 2rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===========================================
   Footer
   =========================================== */
.footer {
    background: var(--bg-secondary);
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin: 0;
}

/* ===========================================
   Navbar
   =========================================== */
.navbar {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.logo {
    text-decoration: none;
}

.logo-text {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--python-blue);
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: color var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--python-blue);
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    border-color: var(--python-blue);
}

/* ===========================================
   Scrollbar Styling
   =========================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ===========================================
   Selection Colors
   =========================================== */
::selection {
    background: var(--python-blue);
    color: white;
}

/* ===========================================
   Focus States - Accessibility
   =========================================== */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
summary:focus {
    outline: 2px solid var(--python-blue);
    outline-offset: 2px;
}

/* ===========================================
   Reduced Motion - Accessibility
   =========================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===========================================
   High Contrast Mode Support
   =========================================== */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #1a1a1a;
        --border-color: #000000;
        --python-blue: #0000cc;
    }

    .code-block {
        border: 2px solid #000000;
    }
}

/* ===========================================
   Mobile Responsive
   =========================================== */
@media (max-width: 768px) {
    .lesson-hero {
        padding: 4rem 0 2.5rem;
    }

    .lesson-hero h1 {
        font-size: 1.75rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    .hero-meta {
        flex-direction: column;
        gap: 0.75rem;
    }

    .content-card {
        padding: 1.5rem;
    }

    .lesson-content h2,
    .content-card h2 {
        font-size: 1.375rem;
    }

    .lesson-content h3,
    .content-card h3 {
        font-size: 1.125rem;
    }

    .code-block pre {
        font-size: 0.8125rem;
        padding: 1rem;
    }

    .challenge-card {
        padding: 1.5rem;
    }

    .lesson-nav {
        grid-template-columns: 1fr;
    }

    .nav-btn.next {
        order: -1;
    }

    .navbar .container {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .lesson-hero h1 {
        font-size: 1.5rem;
    }

    .content-card {
        padding: 1.25rem;
    }

    .lesson-content,
    .content-card {
        font-size: 1rem;
    }

    .code-block pre {
        font-size: 0.75rem;
    }

    .info-box,
    .warning-box {
        padding: 1rem;
    }

    .challenge-card {
        padding: 1.25rem;
    }

    .summary-box {
        padding: 1.25rem;
    }
}

/* ===========================================
   Print Styles
   =========================================== */
@media print {
    .navbar,
    .lesson-nav,
    .theme-toggle,
    .solution summary {
        display: none;
    }

    .lesson-hero {
        background: none;
        color: black;
        padding: 1rem 0;
    }

    .content-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .code-block {
        break-inside: avoid;
        border: 1px solid #ccc;
    }

    .challenge-card {
        background: #f0f0f0;
        color: black;
    }
}
