:root {
    /* Dark Theme (Default) */
    --bg-main: #0f0f1a;
    --bg-sidebar: #1a1a2e;
    --bg-panel: #161625;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --text-main: #e2e2e2;
    --text-muted: #a0a0b0;
    --border-color: rgba(255, 255, 255, 0.1);
    --accent: #00d4ff;
    --accent-hover: #00b0d4;
    --raylib-yellow: #FFD700;
    --code-bg: #1e1e2f;
    --code-text: #00d4ff;
}

[data-theme="light"] {
    --bg-main: #f5f6f8;
    --bg-sidebar: #ffffff;
    --bg-panel: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f2f5;
    --text-main: #1a1a2e;
    --text-muted: #5a5a6e;
    --border-color: #e0e0e0;
    --accent: #0077cc;
    --accent-hover: #005fa3;
    --raylib-yellow: #d4b200;
    --code-bg: #f0f2f5;
    --code-text: #005fa3;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* Typography */
h1, h2, h3, h4 { margin-top: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
    font-family: 'JetBrains Mono', monospace;
    background: var(--code-bg);
    color: var(--code-text);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
pre {
    background: var(--code-bg);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
}
pre code {
    background: transparent;
    color: var(--text-main);
    padding: 0;
}

/* Topbar */
.topbar {
    height: 60px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
}

#current-lang-badge {
    background: var(--accent);
    color: var(--bg-main);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
}

.search-container input {
    width: 400px;
    padding: 10px 15px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}
.search-container input:focus {
    border-color: var(--accent);
}

.controls button {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
}

/* Layout */
.layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px 0;
}

.sidebar h3 {
    padding: 0 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.sidebar li {
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-main);
}

.sidebar li:hover {
    background: var(--bg-card-hover);
}

.sidebar li.active {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent);
    border-right: 3px solid var(--accent);
}

/* Main Content */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    scroll-behavior: smooth;
}

.welcome-msg {
    text-align: center;
    margin-bottom: 40px;
}

.getting-started {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-align: left;
    margin: 20px auto;
    max-width: 600px;
}

/* Function List */
.func-group {
    margin-bottom: 30px;
}

.func-group h3 {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
    color: var(--raylib-yellow);
}

.func-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.func-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}

.func-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 5px;
    font-family: 'JetBrains Mono', monospace;
}

.func-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Details Panel */
.details-panel {
    width: 0;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    transition: width 0.3s ease;
}

.details-panel.open {
    width: 450px;
}

.details-content {
    padding: 30px;
    position: relative;
    white-space: normal;
}

#close-details {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}
#close-details:hover {
    color: var(--text-main);
}

.detail-sig {
    margin: 20px 0;
    padding: 15px;
    background: var(--code-bg);
    border-radius: 8px;
    border-left: 4px solid var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-main);
    word-break: break-all;
}

.detail-example {
    margin-top: 20px;
}

/* Color Swatches */
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.color-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.color-swatch {
    height: 80px;
    border-radius: 4px;
    margin-bottom: 10px;
    border: 1px solid rgba(0,0,0,0.2);
}

.highlight {
    background-color: rgba(255, 215, 0, 0.3);
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 1000px) {
    .details-panel.open { width: 350px; }
    .search-container input { width: 250px; }
}

@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border-color); display: flex; overflow-x: auto; padding: 10px;}
    .sidebar ul { display: flex; margin: 0; }
    .sidebar h3 { display: none; }
    .sidebar li { white-space: nowrap; }
    .details-panel.open { position: fixed; top: 60px; right: 0; bottom: 0; width: 100%; z-index: 20; }
}
