:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #121217;
    --bg-card: #1a1a22;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --border: #2a2a35;
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
}

[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border: #e2e8f0;
}

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

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background 0.3s, color 0.3s;
}

#app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

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

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon i {
    font-size: 22px;
    color: white;
}

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

.text-gradient {
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* API Key Sidebar */
.api-key-sidebar {
    margin: 16px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
}

.sidebar-api-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 12px;
    padding: 6px 0;
}

.sidebar-api-input:focus {
    outline: none;
}

.sidebar-key-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 3px 9px;
    border-radius: 8px;
    font-size: 11px;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    overflow-y: auto;
}

.nav-link, .nav-group-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-secondary);
    transition: all 0.2s;
    width: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.nav-link:hover, .nav-group-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--text-primary);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.nav-link i, .nav-group-btn i {
    width: 20px;
    font-size: 14px;
}

.nav-group {
    margin-bottom: 4px;
}

.nav-group-items {
    margin-left: 32px;
    display: none;
    flex-direction: column;
    gap: 2px;
}

.nav-group.open .nav-group-items {
    display: flex;
}

.nav-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-sub:hover {
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-primary);
}

.method-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 700;
    min-width: 36px;
    text-align: center;
}

.method-badge.get {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

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

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.global-requests {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 12px;
}

.theme-toggle {
    display: flex;
    gap: 8px;
    padding: 6px;
    background: var(--bg-primary);
    border-radius: 30px;
    cursor: pointer;
}

.theme-toggle i {
    width: 36px;
    text-align: center;
    padding: 6px;
    border-radius: 20px;
    transition: all 0.2s;
}

.theme-toggle i.active {
    background: var(--primary);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 300px;
    padding: 24px;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 32px;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    color: var(--text-primary);
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 8px 16px;
    border-radius: 40px;
    border: 1px solid var(--border);
    font-size: 13px;
}

/* Welcome Section */
.welcome-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 24px;
    padding: 40px;
    margin-bottom: 32px;
    color: white;
}

.welcome-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
}

.welcome-desc {
    opacity: 0.9;
    font-size: 14px;
    max-width: 600px;
}

.api-badge {
    padding: 6px 14px;
    background: rgba(255,255,255,0.15);
    border-radius: 30px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

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

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card i {
    font-size: 36px;
    color: var(--primary);
}

.stat-card h3 {
    font-size: 28px;
    font-weight: 700;
}

.stat-card p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Section */
.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Endpoints List */
.endpoints-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.endpoint-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    flex-wrap: wrap;
}

.endpoint-item:last-child {
    border-bottom: none;
}

.endpoint-method {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.endpoint-path {
    font-family: monospace;
    font-size: 12px;
    flex: 1;
}

.endpoint-copy {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
}

.endpoint-copy:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
}

/* Request Card */
.request-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
}

.method-select {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    cursor: pointer;
}

.request-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: monospace;
}

.request-input:focus {
    outline: none;
    border-color: var(--primary);
}

.request-body {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 12px;
}

.send-btn {
    padding: 10px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.send-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.response-preview {
    margin-top: 16px;
    background: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.response-header {
    padding: 10px 16px;
    background: rgba(139, 92, 246, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.response-status {
    font-size: 12px;
    font-weight: 600;
}

.response-body {
    padding: 16px;
    font-family: monospace;
    font-size: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    
    .menu-toggle {
        display: block;
        margin-right: auto;
    }
    
    .top-bar {
        justify-content: space-between;
    }
    
    .welcome-section {
        padding: 24px;
    }
    
    .welcome-title {
        font-size: 24px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .endpoint-item {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}