:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    
    /* Light Theme */
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
    
    /* Category Colors - Light */
    --cat-1xx: #8b5cf6;
    --cat-1xx-bg: #ede9fe;
    --cat-2xx: #10b981;
    --cat-2xx-bg: #d1fae5;
    --cat-3xx: #3b82f6;
    --cat-3xx-bg: #dbeafe;
    --cat-4xx: #f59e0b;
    --cat-4xx-bg: #fef3c7;
    --cat-5xx: #ef4444;
    --cat-5xx-bg: #fee2e2;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

[data-theme='dark'] {
    /* Dark Theme */
    --bg-app: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    
    /* Category Colors - Dark */
    --cat-1xx: #a78bfa;
    --cat-1xx-bg: rgba(139, 92, 246, 0.15);
    --cat-2xx: #34d399;
    --cat-2xx-bg: rgba(16, 185, 129, 0.15);
    --cat-3xx: #60a5fa;
    --cat-3xx-bg: rgba(59, 130, 246, 0.15);
    --cat-4xx: #fbbf24;
    --cat-4xx-bg: rgba(245, 158, 11, 0.15);
    --cat-5xx: #f87171;
    --cat-5xx-bg: rgba(239, 68, 68, 0.15);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 380px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.search-container {
    padding: 1.5rem 1.5rem 0.5rem;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 2.25rem;
    top: 2.15rem;
    color: var(--text-secondary);
}

#searchInput {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 2.5rem;
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#searchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.shortcut-hint {
    position: absolute;
    right: 2.25rem;
    top: 2.15rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background-color: var(--bg-surface);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
    pointer-events: none;
}

.filters {
    padding: 0.5rem 1.5rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 1rem;
    background-color: var(--bg-app);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.filter-btn.active {
    background-color: var(--text-primary);
    color: var(--bg-surface);
    border-color: var(--text-primary);
}

.status-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.status-item {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background-color 0.2s;
    border: 1px solid transparent;
}

.status-item:hover {
    background-color: var(--bg-surface-hover);
}

.status-item.selected {
    background-color: var(--bg-app);
    border-color: var(--border-color);
}

.status-code-badge {
    font-weight: 700;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    min-width: 3.5rem;
    text-align: center;
}

.status-item-info h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.status-item-info p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

/* Category Specific Styles */
.cat-1xx .status-code-badge { color: var(--cat-1xx); background-color: var(--cat-1xx-bg); }
.cat-2xx .status-code-badge { color: var(--cat-2xx); background-color: var(--cat-2xx-bg); }
.cat-3xx .status-code-badge { color: var(--cat-3xx); background-color: var(--cat-3xx-bg); }
.cat-4xx .status-code-badge { color: var(--cat-4xx); background-color: var(--cat-4xx-bg); }
.cat-5xx .status-code-badge { color: var(--cat-5xx); background-color: var(--cat-5xx-bg); }

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-app);
}

.main-header {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    z-index: 20;
}

.icon-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

[data-theme='light'] .sun-icon { display: none; }
[data-theme='dark'] .moon-icon { display: none; }

.detail-view {
    flex: 1;
    overflow-y: auto;
    padding: 4rem;
    display: flex;
    flex-direction: column;
}

.empty-state {
    margin: auto;
    text-align: center;
    color: var(--text-secondary);
    max-width: 400px;
}

.empty-state svg {
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Detail Content Styles */
.status-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.status-header-code {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
}

.status-header-info h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.status-header-info .category-pill {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
}

.content-section {
    margin-bottom: 3rem;
    background-color: var(--bg-surface);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.content-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-section h3 svg {
    color: var(--primary);
}

.content-section p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.use-cases-list {
    list-style: none;
}

.use-cases-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

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

.code-block {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
}

.code-block pre {
    margin: 0;
    padding: 1.5rem;
    background: #1e1e1e !important; /* Prism override */
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--text-primary);
    color: var(--bg-surface);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    box-shadow: var(--shadow-md);
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 50;
}

.toast.show {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .main-content {
        height: 50vh;
    }

    .detail-view {
        padding: 2rem;
    }
}
