/* RUST Knowledge Base - Styles */

:root {
    --primary: #ce422b;
    --primary-dark: #a33522;
    --secondary: #2a2a2a;
    --bg: #1a1a1a;
    --bg-light: #2d2d2d;
    --text: #e0e0e0;
    --text-muted: #999;
    --border: #444;
    --success: #4caf50;
    --warning: #ff9800;
    --info: #2196f3;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

code, pre {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* Navbar */
.navbar {
    background: var(--secondary);
    border-bottom: 2px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.rust-icon {
    font-size: 2rem;
}

.nav-search {
    position: relative;
    width: 300px;
}

.nav-search input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.3s;
}

.nav-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(206, 66, 43, 0.1);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    padding: 2rem;
    min-height: calc(100vh - 180px);
}

/* Sidebar */
.sidebar {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: color 0.2s;
}

.collapsible-header:hover {
    color: var(--primary);
}

.toggle-icon {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.quick-links, .tool-links {
    list-style: none;
}

.quick-links li, .tool-links li {
    margin-bottom: 0.5rem;
}

.quick-links a, .tool-links a {
    color: var(--text);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    display: block;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.quick-links a:hover, .tool-links a:hover {
    background: var(--bg);
    color: var(--primary);
}

.guide-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.guide-category {
    background: transparent;
    border: none;
    color: var(--text);
    padding: 0.75rem 1rem;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.guide-category:hover {
    background: var(--bg);
}

.guide-category.active {
    background: var(--primary);
    color: white;
}

.guide-category .icon {
    font-size: 1.25rem;
}

/* Content */
.content {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 2.5rem;
    min-height: 600px;
}

.welcome h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.feature-card {
    background: var(--bg);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.feature-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(206, 66, 43, 0.2);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.quick-stats {
    margin-bottom: 3rem;
}

.quick-stats h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.stat-card h4 {
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-card p {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.cta-section {
    text-align: center;
    padding: 2rem;
    background: var(--bg);
    border-radius: 12px;
}

.cta-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.cta-btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.cta-btn.primary {
    background: var(--primary);
    color: white;
}

.cta-btn.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(206, 66, 43, 0.3);
}

.cta-btn.secondary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.cta-btn.secondary:hover {
    background: var(--primary);
    color: white;
}

/* Markdown Content Styles */
#contentArea h1 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

#contentArea h2 {
    font-size: 1.75rem;
    margin: 2rem 0 1rem;
    color: var(--text);
}

#contentArea h3 {
    font-size: 1.4rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--primary);
}

#contentArea h4 {
    font-size: 1.1rem;
    margin: 1rem 0 0.5rem;
}

#contentArea p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

#contentArea ul, #contentArea ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

#contentArea li {
    margin-bottom: 0.5rem;
}

#contentArea code {
    background: var(--bg);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--primary);
}

#contentArea pre {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary);
}

#contentArea pre code {
    background: none;
    padding: 0;
    color: var(--text);
}

#contentArea table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    background: var(--bg);
    border-radius: 8px;
    overflow: hidden;
}

#contentArea th, #contentArea td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

#contentArea th {
    background: var(--secondary);
    font-weight: 600;
    color: var(--primary);
}

#contentArea tr:last-child td {
    border-bottom: none;
}

#contentArea blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-style: italic;
}

#contentArea a {
    color: var(--primary);
    text-decoration: none;
}

#contentArea a:hover {
    text-decoration: underline;
}

/* Search Results */
.search-results {
    margin-top: 2rem;
}

.search-result-item {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: all 0.2s;
}

.search-result-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.search-result-item h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.search-result-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Footer */
.footer {
    background: var(--secondary);
    border-top: 2px solid var(--primary);
    padding: 2rem;
    text-align: center;
    margin-top: 4rem;
}

.footer-content p {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.footer-content a {
    color: var(--primary);
    text-decoration: none;
}

.footer-content a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 968px) {
    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .nav-search {
        width: 200px;
    }
}

@media (max-width: 640px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-search {
        width: 100%;
    }

    .content {
        padding: 1.5rem;
    }

    .welcome h1 {
        font-size: 2rem;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .cta-buttons {
        flex-direction: column;
    }
}

/* Loading indicator */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Tool styles */
.tool-container {
    background: var(--bg);
    padding: 2rem;
    border-radius: 12px;
}

.tool-section {
    margin-bottom: 1.5rem;
}

.tool-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.tool-section select,
.tool-section input {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}

.tool-section select:focus,
.tool-section input:focus {
    outline: none;
    border-color: var(--primary);
}

.tool-result {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--bg-light);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.tool-result h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.tool-result p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.error {
    background: #f44336;
    color: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
}

.error-detail {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 1rem;
}
