/* Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --secondary: #06b6d4;
    --bg-light: #f8fafc;
    --bg-dark: #0f172a;
    --text-light: #1e293b;
    --text-dark: #f1f5f9;
    --card-light: #ffffff;
    --card-dark: #1e293b;
    --glass-light: rgba(255, 255, 255, 0.7);
    --glass-dark: rgba(30, 41, 59, 0.7);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-light);
    color: var(--text-light);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--card-light);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Breadcrumb */
.breadcrumb {
    background: rgba(139, 92, 246, 0.05);
    padding: 20px 40px;
    font-size: 0.95em;
    font-weight: 500;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--primary-dark);
}

/* Module Header */
.module-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 60px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.module-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.module-icon {
    font-size: 5em;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.module-header h1 {
    font-size: 3em;
    margin-bottom: 15px;
    font-weight: 800;
    letter-spacing: -1px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.module-header p {
    font-size: 1.3em;
    opacity: 0.9;
    font-weight: 400;
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--bg-light);
    padding: 15px;
    gap: 10px;
    justify-content: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.tab {
    padding: 12px 30px;
    border: none;
    background: transparent;
    font-size: 1.1em;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.tab:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
}

.tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Content */
.content {
    padding: 40px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.tab-content.active {
    display: block;
}

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

/* Sections */
.section {
    margin-bottom: 40px;
    padding: 30px;
    background: white;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.01), 0 2px 4px -1px rgba(0, 0, 0, 0.01);
    transition: transform 0.3s ease;
}

.section:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
}

.section h2 {
    color: var(--primary);
    margin-bottom: 25px;
    font-size: 2em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section h3 {
    color: var(--text-light);
    margin: 30px 0 20px 0;
    font-size: 1.5em;
    font-weight: 600;
    padding-left: 15px;
    border-left: 4px solid var(--secondary);
}

/* Special Boxes */
.definition-box, .example-box, .formula-box, .important-box, .note-box {
    padding: 25px;
    border-radius: 16px;
    margin: 25px 0;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.definition-box {
    background: rgba(6, 182, 212, 0.1);
    border-left: 5px solid var(--secondary);
    color: #0e7490;
}

.example-box {
    background: rgba(139, 92, 246, 0.1);
    border-left: 5px solid var(--primary);
    color: #7c3aed;
}

.formula-box {
    background: rgba(245, 158, 11, 0.1);
    border-left: 5px solid #f59e0b;
    color: #b45309;
    font-family: 'Courier New', monospace;
}

.important-box {
    background: rgba(239, 68, 68, 0.1);
    border-left: 5px solid #ef4444;
    color: #b91c1c;
}

.note-box {
    background: rgba(234, 179, 8, 0.1);
    border-left: 5px solid #eab308;
    color: #a16207;
}

/* Component Cards */
.component-card {
    background: white;
    padding: 25px;
    margin: 20px 0;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    transition: all 0.3s ease;
}

.component-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: rgba(139, 92, 246, 0.2);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    margin: 25px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table th {
    background: var(--bg-light);
    color: var(--text-light);
    font-weight: 700;
    padding: 20px;
    text-align: left;
    border-bottom: 2px solid rgba(0,0,0,0.05);
}

table td {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    color: #475569;
}

table tr:last-child td {
    border-bottom: none;
}

table tr:hover td {
    background: rgba(139, 92, 246, 0.02);
}

/* Lists */
ul, ol {
    margin-left: 20px;
}

li {
    margin-bottom: 10px;
    color: #475569;
}

li strong {
    color: var(--text-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.btn-next {
    background: linear-gradient(135deg, var(--secondary) 0%, #0891b2 100%);
    box-shadow: 0 4px 10px rgba(6, 182, 212, 0.3);
}

.btn-next:hover {
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.4);
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 50px;
    gap: 20px;
    flex-wrap: wrap;
}

/* Flashcards */
.flashcard {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    perspective: 1000px;
    cursor: pointer;
    transition: transform 0.3s;
    border: 1px solid rgba(0,0,0,0.05);
}

.flashcard:hover {
    transform: translateY(-5px);
}

.flashcard.flipped {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.flashcard.flipped .flashcard-front,
.flashcard.flipped .flashcard-back {
    color: white;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    body {
        background: var(--bg-dark);
        color: var(--text-dark);
    }

    .container {
        background: #1e293b;
        box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    }

    .breadcrumb {
        background: rgba(255,255,255,0.02);
        border-bottom-color: rgba(255,255,255,0.05);
    }

    .breadcrumb a {
        color: #a78bfa;
    }

    .tabs {
        background: #1e293b;
        border-bottom-color: rgba(255,255,255,0.05);
    }

    .tab {
        color: #94a3b8;
    }

    .tab:hover {
        background: rgba(255,255,255,0.05);
        color: #a78bfa;
    }

    .section {
        background: #1e293b;
        border-color: rgba(255,255,255,0.05);
        box-shadow: none;
    }

    .section:hover {
        background: #27354f;
    }

    .section h2 {
        color: #a78bfa;
    }

    .section h3 {
        color: #e2e8f0;
        border-left-color: #22d3ee;
    }

    .definition-box {
        background: rgba(6, 182, 212, 0.15);
        color: #67e8f9;
    }

    .example-box {
        background: rgba(139, 92, 246, 0.15);
        color: #c4b5fd;
    }

    .component-card {
        background: #1e293b;
        border-color: rgba(255,255,255,0.05);
    }

    .component-card:hover {
        background: #27354f;
        border-color: #a78bfa;
    }

    table {
        background: #1e293b;
    }

    table th {
        background: #0f172a;
        color: #e2e8f0;
        border-bottom-color: rgba(255,255,255,0.05);
    }

    table td {
        border-bottom-color: rgba(255,255,255,0.05);
        color: #cbd5e1;
    }

    table tr:hover td {
        background: rgba(255,255,255,0.02);
    }

    li {
        color: #cbd5e1;
    }

    li strong {
        color: #f1f5f9;
    }

    .flashcard {
        background: #1e293b;
        border-color: rgba(255,255,255,0.05);
    }
    
    /* Test Options Dark Mode */
    .test-question {
        background: #1e293b;
        box-shadow: none;
        border: 1px solid rgba(255,255,255,0.05);
    }
    
    .test-question p {
        color: #f1f5f9;
    }
    
    .test-question h3 {
        color: #e2e8f0;
    }
    
    .test-options li {
        background: rgba(255,255,255,0.05);
        color: #cbd5e1;
    }
    
    .test-options li:hover {
        background: rgba(255,255,255,0.1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .module-header {
        padding: 40px 20px;
    }
    
    .module-header h1 {
        font-size: 2em;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab {
        flex: 1 1 auto;
        font-size: 0.9em;
        padding: 10px 20px;
    }
    
    .content {
        padding: 20px;
    }
    
    .section {
        padding: 20px;
    }
}