/* ==================== */
/* CSS Variables */
/* ==================== */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark: #1e293b;
    --dark-light: #334155;
    --gray: #64748b;
    --gray-light: #cbd5e1;
    --gray-lighter: #f1f5f9;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* ==================== */
/* Navigation Bar */
/* ==================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: var(--shadow);
    z-index: 1000;
    padding: 1rem 0;
}

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

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

.nav-brand .icon {
    font-size: 2rem;
}

.nav-progress {
    flex: 1;
    max-width: 400px;
    height: 8px;
    background: var(--gray-lighter);
    border-radius: 10px;
    overflow: hidden;
    margin-left: 2rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.5s ease;
}

/* ==================== */
/* Sidebar */
/* ==================== */
.sidebar {
    position: fixed;
    top: 80px;
    left: 0;
    width: 280px;
    height: calc(100vh - 80px);
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 2rem 0;
    overflow-y: auto;
    z-index: 900;
    transition: var(--transition);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem 1rem;
    border-bottom: 2px solid var(--gray-lighter);
}

.sidebar-header h3 {
    color: var(--dark);
    font-size: 1.2rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-menu li {
    margin: 0.5rem 0;
}

.sidebar-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--gray);
    text-decoration: none;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.sidebar-menu a:hover {
    background: var(--gray-lighter);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-menu a.active {
    background: var(--primary-light);
    color: var(--white);
    border-left-color: var(--primary-dark);
    font-weight: 600;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 1001;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.mobile-menu-btn span {
    width: 25px;
    height: 3px;
    background: var(--white);
    border-radius: 2px;
    transition: var(--transition);
}

/* ==================== */
/* Main Content */
/* ==================== */
.main-content {
    margin-left: 280px;
    margin-top: 80px;
    padding: 3rem 0;
    min-height: calc(100vh - 80px);
}

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

/* ==================== */
/* Content Sections */
/* ==================== */
.content-section {
    display: none;
    animation: fadeIn 0.5s ease;
}

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

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

/* ==================== */
/* Hero Section */
/* ==================== */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 3rem;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--gray);
}

/* ==================== */
/* Info Grid */
/* ==================== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.info-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.info-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.info-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.info-card ul {
    list-style-position: inside;
    color: var(--gray);
}

.info-card li {
    margin: 0.5rem 0;
}

.mt-2 {
    margin-top: 1rem;
}

/* ==================== */
/* Chapter Header */
/* ==================== */
.chapter-header {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border-left: 6px solid var(--primary-color);
}

.chapter-number {
    display: inline-block;
    background: var(--primary-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.chapter-header h2 {
    font-size: 2.5rem;
    color: var(--dark);
}

/* ==================== */
/* Example Boxes */
/* ==================== */
.example-box {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border-left: 6px solid var(--primary-color);
}

.example-box.warning {
    border-left-color: var(--warning-color);
}

.example-box.danger {
    border-left-color: var(--danger-color);
}

.example-box h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.example-box.warning h3 {
    color: var(--warning-color);
}

.example-box.danger h3 {
    color: var(--danger-color);
}

.example-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.highlight {
    background: var(--gray-lighter);
    padding: 1rem;
    border-radius: 8px;
    font-weight: 500;
    margin-top: 1rem;
}

/* ==================== */
/* Task Box */
/* ==================== */
.task-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.task-box h4 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.task-box ol, .task-box ul {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.task-box li {
    margin: 0.75rem 0;
    line-height: 1.8;
}

/* ==================== */
/* Solution Box */
/* ==================== */
.solution-box {
    background: #ecfdf5;
    border: 2px solid var(--success-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    transition: var(--transition);
}

.solution-box.hidden {
    display: none;
}

.solution-box h4 {
    color: var(--success-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.solution-box ul {
    margin-left: 1.5rem;
}

.solution-box li {
    margin: 0.5rem 0;
}

.solution-box .highlight {
    background: var(--white);
    border-left: 4px solid var(--success-color);
}

/* ==================== */
/* Concept Box */
/* ==================== */
.concept-box {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.concept-box.warning {
    background: #fef3c7;
    border: 2px solid var(--warning-color);
}

.concept-box h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.concept-box.warning h3 {
    color: var(--warning-color);
}

.definition {
    background: var(--gray-lighter);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.definition p {
    margin: 0.5rem 0;
}

.concept-list {
    list-style: none;
    padding-left: 0;
}

.concept-list li {
    padding: 0.75rem 0;
    padding-left: 2rem;
    position: relative;
}

.concept-list li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.highlight-item {
    background: var(--primary-light);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
}

/* ==================== */
/* Key Points */
/* ==================== */
.key-points {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.key-point {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.key-point .number {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.key-point strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.key-point p {
    color: var(--gray);
}

/* ==================== */
/* Strategy Grid */
/* ==================== */
.strategy-grid {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.strategy-grid h3 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

.strategy-card {
    background: var(--gray-lighter);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.strategy-card:last-child {
    margin-bottom: 0;
}

.strategy-card h4 {
    color: var(--dark);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.strategy-card ul {
    list-style-position: inside;
}

.strategy-card li {
    margin: 0.5rem 0;
    color: var(--gray);
}

/* ==================== */
/* Info Box */
/* ==================== */
.info-box {
    background: #dbeafe;
    border: 2px solid var(--primary-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

.info-box h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* ==================== */
/* Exercise Grid */
/* ==================== */
.exercise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.exercise-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.exercise-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.exercise-card h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.exercise-card p {
    margin-bottom: 1rem;
    color: var(--gray);
}

.exercise-card ul {
    margin: 1rem 0 1.5rem 1.5rem;
    color: var(--gray);
}

.exercise-card li {
    margin: 0.5rem 0;
}

/* ==================== */
/* Feature List */
/* ==================== */
.feature-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.feature {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    background: var(--gray-lighter);
    padding: 1.5rem;
    border-radius: 8px;
}

.feature .icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.feature strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.feature p {
    color: var(--gray);
}

/* ==================== */
/* Comparison Table */
/* ==================== */
.comparison-table {
    overflow-x: auto;
    margin: 2rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: var(--primary-color);
    color: var(--white);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-lighter);
}

th {
    font-weight: 600;
}

tbody tr:hover {
    background: var(--gray-lighter);
}

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

/* ==================== */
/* Definition Grid */
/* ==================== */
.definition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.definition-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.def-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.definition-card h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.definition-card p {
    color: var(--gray);
    margin-bottom: 1rem;
}

.definition-card ul {
    text-align: left;
    list-style-position: inside;
    color: var(--gray);
}

.definition-card li {
    margin: 0.5rem 0;
}

/* ==================== */
/* Terminology Box */
/* ==================== */
.terminology-box {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.terminology-box h3 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

.term {
    background: var(--gray-lighter);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
}

.term:last-child {
    margin-bottom: 0;
}

.term strong {
    display: block;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.term p {
    color: var(--gray);
}

/* ==================== */
/* Example Item */
/* ==================== */
.example-item {
    background: var(--gray-lighter);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.example-item:last-child {
    margin-bottom: 0;
}

.example-item h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.example-item p {
    margin-bottom: 0.5rem;
    color: var(--gray);
}

.example-item ul {
    margin-left: 1.5rem;
    color: var(--gray);
}

.example-item li {
    margin: 0.5rem 0;
}

/* ==================== */
/* Code Examples */
/* ==================== */
.code-example {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.code-example h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

pre {
    background: var(--dark);
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

code {
    font-family: 'Courier New', monospace;
}

/* ==================== */
/* Sync Methods */
/* ==================== */
.sync-methods {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.sync-method {
    background: var(--gray-lighter);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--warning-color);
}

.sync-method h4 {
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
}

.sync-method p {
    color: var(--gray);
}

/* ==================== */
/* Best Practices */
/* ==================== */
.best-practices {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.best-practices h3 {
    color: var(--success-color);
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

.practice {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--gray-lighter);
    border-radius: 8px;
}

.practice:last-child {
    margin-bottom: 0;
}

.practice .icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.practice strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.practice p {
    color: var(--gray);
}

/* ==================== */
/* Buttons */
/* ==================== */
.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background: #7c3aed;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

.navigation-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 3rem;
}

/* ==================== */
/* Modal */
/* ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--white);
    padding: 3rem;
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-content h2 {
    color: var(--success-color);
    margin-bottom: 1rem;
    font-size: 2rem;
}

.modal-content h3 {
    color: var(--dark);
    margin: 1.5rem 0 1rem;
}

.modal-content ul {
    margin-left: 1.5rem;
    margin-bottom: 2rem;
}

.modal-content li {
    margin: 0.5rem 0;
    color: var(--gray);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ==================== */
/* Footer */
/* ==================== */
.footer {
    background: var(--white);
    padding: 2rem 0;
    text-align: center;
    color: var(--gray);
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
}

.footer p {
    margin: 0.5rem 0;
}

/* ==================== */
/* Responsive Design */
/* ==================== */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .mobile-menu-btn {
        display: flex;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .chapter-header h2 {
        font-size: 2rem;
    }

    .info-grid,
    .exercise-grid,
    .definition-grid {
        grid-template-columns: 1fr;
    }

    .navbar .container {
        padding: 0 1rem;
    }

    .nav-progress {
        display: none;
    }

    .container {
        padding: 0 1rem;
    }

    .navigation-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .key-point {
        flex-direction: column;
    }

    .practice {
        flex-direction: column;
    }

    .feature {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 2rem 1rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .chapter-header {
        padding: 1.5rem;
    }

    .example-box,
    .task-box,
    .concept-box,
    .code-example {
        padding: 1.5rem;
    }

    pre {
        font-size: 0.8rem;
        padding: 1rem;
    }
}

/* ==================== */
/* Utility Classes */
/* ==================== */
.hidden {
    display: none !important;
}

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

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
