:root {
    --bg-main: #0C0A09;
    /* Deep dark background */
    --bg-surface: #1C1917;
    --bg-elevated: #292524;

    --primary: #F97316;
    /* Orange 500 */
    --primary-hover: #EA580C;

    --text-primary: #F5F5F4;
    --text-secondary: #A8A29E;
    --text-muted: #78716C;

    --border: #44403C;

    --success: #22C55E;
    --warning: #EAB308;
    --error: #EF4444;
    --info: #3B82F6;

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'Fira Code', monospace;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* Utilities */
.text-muted {
    color: var(--text-secondary);
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-error {
    color: var(--error);
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

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

.w-full {
    width: 100%;
}

.flex {
    display: flex;
}

.gap-2 {
    gap: 0.5rem;
}

.spacer {
    flex: 1;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hidden {
    display: none !important;
}

/* Layout */
.app-container {
    display: flex;
    height: 100%;
}

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

.brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    color: var(--primary);
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.brand span {
    color: var(--primary);
}

.sw-status {
    padding: 12px 24px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}

.sw-status svg {
    width: 14px;
    height: 14px;
}

.status-indicator.success {
    color: var(--success);
}

.status-indicator.warning {
    color: var(--warning);
}

.status-indicator.error {
    color: var(--error);
}

.nav-menu {
    flex: 1;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
}

.nav-item {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

.nav-item svg {
    width: 18px;
    height: 18px;
}

.badge {
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    font-weight: bold;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
}

.btn svg {
    width: 16px;
    height: 16px;
}

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

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

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

.btn-outline:hover {
    background: var(--bg-elevated);
    border-color: var(--text-secondary);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.icon-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.view.active {
    display: flex;
}

.view-header {
    padding: 32px 40px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.view-header h2 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

/* Route List */
.routes-list {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.route-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
}

.route-card:hover {
    border-color: var(--text-muted);
}

.route-card.disabled {
    opacity: 0.5;
}

.method-badge {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    width: 65px;
    text-align: center;
}

.method-GET {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.method-POST {
    background: rgba(249, 115, 22, 0.15);
    color: var(--primary);
}

.method-PUT,
.method-PATCH {
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning);
}

.method-DELETE {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.route-info {
    flex: 1;
}

.route-path {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 4px;
}

.route-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
}

.route-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.route-meta svg {
    width: 12px;
    height: 12px;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.row {
    display: flex;
    gap: 16px;
}

.col-3 {
    flex: 3;
}

.col-6 {
    flex: 6;
}

.col-9 {
    flex: 9;
}

.input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.input:focus,
.code-editor:focus {
    border-color: var(--primary);
}

.code-editor {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: #e6edf3;
    padding: 12px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    outline: none;
    resize: vertical;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 12px;
    font-size: 0.9rem;
}

.toggle-switch input {
    display: none;
}

.slider {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
    background-color: white;
}

/* Editor Panel */
.editor-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.editor-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.editor-panel {
    position: absolute;
    top: 0;
    right: -500px;
    bottom: 0;
    width: 500px;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 50;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.editor-panel.open {
    right: 0;
}

.editor-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

.editor-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    background: var(--bg-surface);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 600px;
    max-width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 24px;
}

/* Logs View */
.logs-container {
    padding: 32px 40px;
    overflow-y: auto;
    flex: 1;
}

.log-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-path {
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.log-status {
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.status-2xx {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.status-4xx {
    background: rgba(234, 179, 8, 0.2);
    color: var(--warning);
}

.status-5xx {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.log-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Settings View */
.settings-grid {
    padding: 32px 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
}

/* Empty state */
.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: var(--bg-elevated);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 30px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    transition: transform 0.3s;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}