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

:root {
    /* Dark Theme (Default) */
    --bg-dark: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --primary: #0454a4;
    --secondary: #f49424;
    --accent: #f49424;
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --border: rgba(255, 255, 255, 0.1);
    --module-header-bg: rgba(0,0,0,0.25);
    --module-num-bg: rgba(255, 255, 255, 0.05);
    --topic-bg: rgba(255, 255, 255, 0.02);
    --topic-hover-bg: rgba(255, 255, 255, 0.06);
    --text-gradient: linear-gradient(to right, #fff, #c7d2fe, #fbcfe8);
}

[data-theme="light"] {
    /* Light Theme */
    --bg-dark: #f8fafc;
    --bg-panel: rgba(255, 255, 255, 0.9);
    --primary: #0454a4;
    --secondary: #f49424;
    --accent: #0454a4;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border: rgba(0, 0, 0, 0.1);
    --module-header-bg: rgba(0,0,0,0.05);
    --module-num-bg: rgba(0, 0, 0, 0.05);
    --topic-bg: rgba(0, 0, 0, 0.02);
    --topic-hover-bg: rgba(0, 0, 0, 0.06);
    --text-gradient: linear-gradient(to right, #0f172a, #0454a4, #f49424);
}

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

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.7;
    background-image: 
        radial-gradient(circle at top right, rgba(4, 84, 164, 0.15), transparent 40%),
        radial-gradient(circle at bottom left, rgba(244, 148, 36, 0.15), transparent 40%);
    background-attachment: fixed;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

header {
    text-align: center;
    margin-bottom: 5rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Theme Toggle */
.theme-toggle-container {
    position: absolute;
    top: 0;
    left: 0;
}

.theme-toggle-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.logo-header {
    width: 120px;
    margin-bottom: 2rem;
    transition: transform 0.3s;
}
.logo-header:hover {
    transform: scale(1.05);
}

.badge-pro {
    display: inline-block;
    background: linear-gradient(135deg, rgba(4,84,164,0.1), rgba(244,148,36,0.1));
    border: 1px solid rgba(4,84,164,0.3);
    padding: 0.5rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

[data-theme="dark"] .badge-pro {
    color: #fff;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: var(--text-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

p.subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.8;
}

.modules-container {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.module-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    backdrop-filter: blur(16px);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0; left: 0; height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0.5;
    transition: opacity 0.3s;
}

.module-card:hover {
    border-color: rgba(4, 84, 164, 0.4);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .module-card:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.module-card:hover::before {
    opacity: 1;
}

.module-header {
    padding: 1.5rem 2rem;
    background: var(--module-header-bg);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.3s ease;
}

.module-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .module-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

.module-header::after {
    content: '';
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-70%) rotate(-45deg);
    width: 14px;
    height: 14px;
    border-bottom: 3px solid var(--accent);
    border-left: 3px solid var(--accent);
    transition: transform 0.4s ease;
}

.module-card.active .module-header::after {
    transform: translateY(-30%) rotate(135deg);
}

.module-number {
    width: 50px;
    height: 50px;
    background: var(--module-num-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fira Code', monospace;
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--accent);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

[data-theme="dark"] .module-number {
    box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
}

.module-title h2 {
    font-size: 1.4rem;
    color: var(--text-main);
    margin-bottom: 0.2rem;

}

.module-title p {
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.95rem;
}

.module-content {
    display: flex;
    flex-direction: column;
    gap: 0;
    counter-reset: subtopic;
    
    /* Accordion specifics */
    max-height: 0;
    overflow: hidden;
    padding: 0 3rem;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.module-card.active .module-content {
    padding: 1.5rem 3rem 2.5rem 3rem;
    opacity: 1;
}

.topic-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 1.1rem;
    color: var(--text-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s;
    counter-increment: subtopic;
}

.topic-item:last-child {
    border-bottom: none;
}

.topic-item:hover {
    color: var(--text-main);
    transform: translateX(5px);
    border-color: var(--primary);
}

.topic-icon {
    color: var(--accent);
    font-family: 'Fira Code', monospace;
    font-size: 1.15rem;
    font-weight: 700;
    margin-top: 1px;
    flex-shrink: 0;
    min-width: 45px;
    text-align: left;
    opacity: 0.9;
}

.topic-icon::before {
    content: "«" counter(subtopic, decimal-leading-zero) "»";
}

/* Home Page specific cards */
.home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.course-card {
    display: flex;
    flex-direction: column;
    text-align: center;
    justify-content: space-between;
    text-decoration: none;
    padding: 3rem 2rem;
    min-height: 350px;
}

.course-card:hover {
    transform: translateY(-10px);
}

.course-card h2 {
    font-size: 1.6rem;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.course-level {
    display: block;
    font-size: 1.1rem;
    color: var(--secondary);
    margin-top: 0.5rem;
    font-weight: 600;
}

.course-card p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    flex-grow: 1;
}

.btn-primary {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.1rem;
    text-decoration: none;
    transition: all 0.3s;
    border: 2px solid var(--primary);
}

.btn-primary:hover {
    background: transparent;
    color: var(--primary);
}

@media (max-width: 768px) {
    .module-header {
        flex-direction: row;
        text-align: right;
        padding: 1rem 1.5rem;
        gap: 1rem;
    }
    .module-header::after {
        position: absolute;
        left: 1rem;
        top: 50%;
        margin-top: 0;
        transform: translateY(-70%) rotate(-45deg);
    }
    .module-card.active .module-header::after {
        transform: translateY(-30%) rotate(135deg);
    }
    .module-content {
        padding: 0 1.5rem;
    }
    .module-card.active .module-content {
        padding: 1.5rem;
    }
    h1 { font-size: 2.2rem; }
    .topic-icon { min-width: 40px; font-size: 1rem; }
}
