/* Root Variables */
:root {
    --primary-color: #ec4899;
    --primary-dark: #db2777;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --background-color: #0f172a;
    --surface-color: #1e293b;
    --surface-light: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --error-color: #ef4444;
    --success-color: #22c55e;
    --gradient-1: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
    --gradient-2: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --gradient-biology: linear-gradient(135deg, #ec4899 0%, #a855f7 100%);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    padding-top: 40px;
}

/* Subject Navigation Bar */
.subject-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #1e1e2e 0%, #2d2d44 100%);
    padding: 0.5rem 2rem;
    z-index: 1100;
    border-bottom: 1px solid rgba(236, 72, 153, 0.3);
}

.subject-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subject-nav-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.subject-links {
    display: flex;
    gap: 0.5rem;
}

.subject-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 20px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.subject-link:hover {
    color: var(--text-primary);
    background: rgba(236, 72, 153, 0.1);
    border-color: rgba(236, 72, 153, 0.3);
}

.subject-link.active {
    color: var(--text-primary);
    background: var(--gradient-biology);
    border-color: transparent;
}

.subject-link i {
    font-size: 0.9rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 40px;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    border-bottom: 1px solid var(--surface-light);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav-brand i {
    font-size: 1.8rem;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

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

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient-biology);
    border-radius: 2px;
}

.nav-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* Sections */
.section {
    min-height: 100vh;
    padding: 8rem 2rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    background: var(--gradient-biology);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hero Section */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
}

.hero-content {
    flex: 1;
}

.hero-content h1 {
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    background: var(--gradient-biology);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.biology-animation {
    position: relative;
    width: 300px;
    height: 300px;
}

.formula-float {
    position: absolute;
    font-size: 2.5rem;
    color: var(--primary-color);
    animation: float 3s ease-in-out infinite;
    background: var(--surface-color);
    padding: 1rem 1.5rem;
    border-radius: 50%;
    border: 2px solid var(--surface-light);
}

.formula-float:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.formula-float:nth-child(2) {
    top: 50%;
    right: 10%;
    animation-delay: 1s;
}

.formula-float:nth-child(3) {
    bottom: 20%;
    left: 30%;
    animation-delay: 2s;
}

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: var(--gradient-biology);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--surface-light);
}

.btn-secondary:hover {
    background: var(--surface-light);
}

/* Chapters Grid */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.chapter-card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--surface-light);
    position: relative;
    overflow: hidden;
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-biology);
}

.chapter-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.chapter-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.chapter-number {
    display: inline-block;
    background: var(--gradient-biology);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    font-weight: 700;
    margin-bottom: 1rem;
}

.chapter-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.chapter-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.chapter-topics {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.topic-tag {
    background: var(--surface-light);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface-color);
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--surface-light);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--surface-light);
    position: sticky;
    top: 0;
    background: var(--surface-color);
}

.modal-header h3 {
    background: var(--gradient-biology);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--error-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body h4 {
    color: var(--primary-color);
    margin: 1.5rem 0 1rem;
}

.modal-body ul {
    list-style: none;
    padding-left: 1rem;
}

.modal-body li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.5rem;
}

.modal-body li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

/* Practice Section */
.practice-container {
    max-width: 800px;
    margin: 0 auto;
}

.practice-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 150px;
    padding: 0.8rem 1rem;
    background: var(--surface-color);
    border: 1px solid var(--surface-light);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.problem-card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--surface-light);
}

.problem-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.problem-chapter {
    color: var(--primary-color);
    font-weight: 500;
}

.problem-difficulty {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.problem-difficulty.easy {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-color);
}

.problem-difficulty.medium {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-color);
}

.problem-difficulty.hard {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-color);
}

.problem-question {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.answer-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.answer-section input {
    flex: 1;
    min-width: 200px;
    padding: 0.8rem 1rem;
    background: var(--background-color);
    border: 1px solid var(--surface-light);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.answer-section input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.mcq-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
}

.mcq-option {
    padding: 1rem;
    background: var(--background-color);
    border: 1px solid var(--surface-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.mcq-option:hover {
    border-color: var(--primary-color);
    background: rgba(236, 72, 153, 0.1);
}

.mcq-option.selected {
    border-color: var(--primary-color);
    background: rgba(236, 72, 153, 0.2);
}

.mcq-option.correct {
    border-color: var(--success-color);
    background: rgba(34, 197, 94, 0.2);
}

.mcq-option.incorrect {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.2);
}

.tf-options {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.tf-option {
    flex: 1;
    padding: 1rem 2rem;
    background: var(--background-color);
    border: 1px solid var(--surface-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    font-weight: 600;
}

.tf-option:hover {
    border-color: var(--primary-color);
}

.tf-option.correct {
    border-color: var(--success-color);
    background: rgba(34, 197, 94, 0.2);
}

.tf-option.incorrect {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.2);
}

.problem-feedback {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: none;
}

.problem-feedback.show {
    display: block;
}

.problem-feedback.correct {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.problem-feedback.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.problem-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.score-card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--surface-light);
}

.score-card h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.score-stats {
    display: flex;
    justify-content: space-around;
}

.score-item {
    text-align: center;
}

.score-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Diagrams Section */
.diagrams-container {
    max-width: 1000px;
    margin: 0 auto;
}

.diagram-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.diagram-tab {
    padding: 0.8rem 1.5rem;
    background: var(--surface-color);
    border: 1px solid var(--surface-light);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.diagram-tab:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.diagram-tab.active {
    background: var(--gradient-biology);
    border-color: transparent;
    color: white;
}

.diagram-content {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--surface-light);
}

.diagram-card {
    text-align: center;
}

.diagram-card h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.diagram-visual {
    background: var(--background-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diagram-svg {
    max-width: 100%;
    height: auto;
}

.diagram-parts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    text-align: left;
}

.diagram-part {
    background: var(--background-color);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.diagram-part h4 {
    color: var(--primary-color);
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.diagram-part p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Key Terms Section */
.keyterms-container {
    max-width: 1200px;
    margin: 0 auto;
}

.keyterms-search {
    position: relative;
    max-width: 400px;
    margin: 0 auto 2rem;
}

.keyterms-search input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: var(--surface-color);
    border: 1px solid var(--surface-light);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.keyterms-search input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.keyterms-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.keyterms-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.keyterm-tab {
    padding: 0.6rem 1.2rem;
    background: var(--surface-color);
    border: 1px solid var(--surface-light);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
}

.keyterm-tab:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.keyterm-tab.active {
    background: var(--gradient-biology);
    border-color: transparent;
    color: white;
}

.keyterms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.keyterm-card {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--surface-light);
    transition: all 0.3s;
}

.keyterm-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.keyterm-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.keyterm-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.keyterm-card .category {
    display: inline-block;
    margin-top: 0.8rem;
    padding: 0.2rem 0.6rem;
    background: var(--surface-light);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    background: var(--surface-color);
    padding: 3rem 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--surface-light);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.footer-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .subject-nav {
        padding: 0.4rem 1rem;
    }

    .subject-nav-container {
        flex-direction: column;
        gap: 0.3rem;
    }

    .subject-nav-label {
        font-size: 0.7rem;
    }

    .subject-link {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    .subject-link span {
        display: none;
    }

    .navbar {
        top: 55px;
    }

    body {
        padding-top: 55px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--background-color);
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        border-bottom: 1px solid var(--surface-light);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .hero-section {
        flex-direction: column;
        text-align: center;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-stats {
        justify-content: center;
    }

    .biology-animation {
        display: none;
    }

    .section {
        padding: 7rem 1rem 2rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .practice-filters {
        flex-direction: column;
    }

    .answer-section {
        flex-direction: column;
        align-items: center;
    }

    .answer-section input {
        width: 100%;
    }

    .mcq-options {
        grid-template-columns: 1fr;
    }

    .tf-options {
        flex-direction: column;
    }

    .diagram-parts {
        grid-template-columns: 1fr;
    }

    .keyterms-grid {
        grid-template-columns: 1fr;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.chapter-card {
    animation: fadeIn 0.5s ease forwards;
}

.chapter-card:nth-child(1) { animation-delay: 0.1s; }
.chapter-card:nth-child(2) { animation-delay: 0.2s; }
.chapter-card:nth-child(3) { animation-delay: 0.3s; }
.chapter-card:nth-child(4) { animation-delay: 0.4s; }
.chapter-card:nth-child(5) { animation-delay: 0.5s; }
.chapter-card:nth-child(6) { animation-delay: 0.6s; }
