/* Core Variables */
:root {
    --bg-base: #09090b;
    --bg-surface: rgba(24, 24, 27, 0.6);
    --border: rgba(255, 255, 255, 0.1);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    /* Method Colors */
    --meth-post: #10b981;
    --meth-get: #3b82f6;
    --meth-put: #f59e0b;
    --meth-delete: #ef4444;

    /* Syntax Highlighting */
    --syn-string: #a78bfa;
    --syn-number: #fbbf24;
    --syn-boolean: #f472b6;
    --syn-null: #f87171;
    --syn-key: #38bdf8;

    --radius: 8px;
    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'Fira Code', monospace;
    --transition: all 0.2s ease;
}

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

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

/* Glassmorphism utility */
.glass {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
}

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

.hidden {
    display: none !important;
}

.mb-3 {
    margin-bottom: 12px;
}

.mt-4 {
    margin-top: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    background: transparent;
    color: var(--text-main);
}

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

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

.btn-outline {
    border-color: var(--border);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-icon {
    padding: 8px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* Forms */
.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.select-sm {
    padding: 6px 10px;
    font-size: 0.85rem;
    font-family: var(--font-ui);
}

/* Layout */
.app-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    border-top: none;
    border-bottom: none;
    border-left: none;
    z-index: 10;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.endpoint-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--meth-post);
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--meth-post);
    border-radius: 50%;
}

.pulse {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.filter-bar {
    padding: 12px 20px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
}

.request-list {
    flex: 1;
    overflow-y: auto;
}

.req-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.req-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.req-item.active {
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid var(--primary);
}

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

.badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.method-post {
    background: rgba(16, 185, 129, 0.15);
    color: var(--meth-post);
}

.method-get {
    background: rgba(59, 130, 246, 0.15);
    color: var(--meth-get);
}

.method-put {
    background: rgba(245, 158, 11, 0.15);
    color: var(--meth-put);
}

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

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

.req-source {
    font-size: 0.85rem;
    font-family: var(--font-mono);
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.top-bar {
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
}

.endpoint-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.endpoint-info .label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.url-badge {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.url-badge code {
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--primary);
}

/* Details Area */
.details-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    position: relative;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.glass-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

/* Inspector View */
.inspector-header {
    margin-bottom: 24px;
}

.req-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-family: var(--font-mono);
    margin-bottom: 8px;
}

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    border-radius: var(--radius);
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.tab-pane {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.pane-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
}

/* JSON Viewer */
pre {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-x: auto;
}

.json-key {
    color: var(--syn-key);
}

.json-string {
    color: var(--syn-string);
}

.json-number {
    color: var(--syn-number);
}

.json-boolean {
    color: var(--syn-boolean);
}

.json-null {
    color: var(--syn-null);
}

/* Headers Tab */
.headers-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.header-row {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.header-key {
    width: 30%;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.header-val {
    width: 70%;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    word-break: break-all;
}

/* Replay */
.replay-container {
    max-width: 600px;
}

.status-box {
    padding: 16px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-main);
    color: var(--bg-base);
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s;
    z-index: 1000;
}