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

:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --accent-color: #10b981;
    --text-color: #1f2937;
    --light-bg: #f3f4f6;
    --border-color: #e5e7eb;
    --code-bg: #1f2937;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
}

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

/* Header Styles */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header .subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
}

header nav {
    margin-top: 1rem;
}

header nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    transition: background 0.3s;
}

header nav a:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Intro Section */
.intro {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.intro h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Table of Contents */
.toc {
    margin: 2rem 0;
}

.toc h2 {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 2rem;
}

.toc-section {
    background: var(--light-bg);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.toc-section h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.toc-section ul {
    list-style: none;
}

.toc-section li {
    margin: 0.8rem 0;
}

.toc-section a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem;
    display: block;
    border-radius: 5px;
    transition: all 0.3s;
    font-weight: 500;
}

.toc-section a:hover {
    background: white;
    color: var(--primary-color);
    padding-left: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Getting Started */
.getting-started {
    background: linear-gradient(135deg, #10b98115 0%, #3b82f615 100%);
    padding: 2rem;
    border-radius: 10px;
    margin-top: 2rem;
}

.getting-started h2 {
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.getting-started ol {
    margin-left: 2rem;
}

.getting-started li {
    margin: 1rem 0;
    font-size: 1.05rem;
}

/* Content Sections */
section {
    margin: 2.5rem 0;
}

section h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

section h3 {
    color: var(--secondary-color);
    margin: 1.5rem 0 1rem 0;
    font-size: 1.3rem;
}

section p {
    margin: 1rem 0;
    font-size: 1.05rem;
    line-height: 1.8;
}

section ul, section ol {
    margin-left: 2rem;
    margin-top: 1rem;
}

section li {
    margin: 0.5rem 0;
    line-height: 1.7;
}

/* Concept Grid */
.concept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.concept-card {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border-top: 4px solid var(--primary-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.concept-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.concept-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.concept-card p {
    color: var(--text-color);
    font-size: 0.95rem;
    margin: 0;
}

.concept-card code {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    background: white;
    padding: 0.5rem;
    border-radius: 4px;
}

/* Example List */
.example-list {
    background: var(--light-bg);
    padding: 1.5rem 2rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.example-list li {
    margin: 1rem 0;
    font-size: 1.05rem;
}

.example-list strong {
    color: var(--primary-color);
}

/* Info Box */
.info-box {
    background: linear-gradient(135deg, #3b82f615 0%, #10b98115 100%);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    margin: 1.5rem 0;
}

.info-box h3 {
    color: var(--accent-color);
    margin-top: 0;
}

/* Code Blocks */
.code-block {
    background: var(--code-bg);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.code-block pre {
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-block code {
    color: #e2e8f0;
    font-size: 0.9rem;
    line-height: 1.6;
    display: block;
    white-space: pre-wrap;
}

/* Note */
.note {
    background: #fef3c7;
    border-left: 4px solid var(--warning);
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    border-radius: 4px;
    font-style: italic;
}

/* Comparison */
.comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.comparison-item {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border-top: 3px solid var(--secondary-color);
}

.comparison-item h3 {
    color: var(--secondary-color);
    margin-top: 0;
}

/* ML Type Sections */
.ml-type {
    background: var(--light-bg);
    padding: 2rem;
    margin: 2rem 0;
    border-radius: 10px;
}

.ml-type h2 {
    color: var(--primary-color);
    border-bottom: none;
    margin-bottom: 1rem;
}

.ml-type .definition {
    background: white;
    padding: 1rem;
    border-left: 4px solid var(--accent-color);
    margin: 1rem 0;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Workflow */
.workflow {
    counter-reset: step-counter;
    list-style: none;
    margin-left: 0;
    padding-left: 0;
}

.workflow li {
    counter-increment: step-counter;
    background: var(--light-bg);
    padding: 1rem 1rem 1rem 3.5rem;
    margin: 1rem 0;
    border-radius: 8px;
    position: relative;
}

.workflow li::before {
    content: counter(step-counter);
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.comparison-table tr:hover {
    background: var(--light-bg);
}

/* ASCII Diagram */
.ascii-diagram {
    background: var(--code-bg);
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    overflow-x: auto;
    font-family: monospace;
    text-align: center;
}

.ascii-diagram pre {
    margin: 0;
    font-size: 1rem;
}

/* Formula */
.formula {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    text-align: center;
    border: 2px solid var(--border-color);
}

.formula p {
    margin: 0.5rem 0;
    font-family: 'Georgia', serif;
    font-size: 1.2rem;
}

/* Page Navigation */
.page-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.page-nav a {
    color: white;
    background: var(--primary-color);
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s;
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.page-nav a:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Footer */
footer {
    background: var(--text-color);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

footer p {
    margin: 0.5rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 1rem;
        margin: 1rem;
    }
    
    .concept-grid {
        grid-template-columns: 1fr;
    }
    
    .comparison {
        grid-template-columns: 1fr;
    }
    
    .page-nav {
        flex-direction: column;
    }
    
    .toc-section a {
        font-size: 0.95rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .container {
        box-shadow: none;
    }
    
    header {
        background: none;
        color: black;
    }
    
    .page-nav {
        display: none;
    }
}