:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-elevated: #222222;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent: #22c55e;
    --accent-hover: #16a34a;
    --accent-muted: rgba(34, 197, 94, 0.15);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --info: #3b82f6;
    --border: #2a2a2a;
    --border-light: #333333;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --radius: 8px;
    --radius-lg: 12px;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-code: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
    font-family: var(--font-ui);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 24px;
}

.logo h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--accent);
}

.nav {
    display: flex;
    gap: 4px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

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

.nav-btn.active {
    color: var(--accent);
    background: var(--accent-muted);
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

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

.btn-outline:hover {
    background: var(--bg-tertiary);
}

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

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

.btn-lg {
    padding: 12px 28px;
    font-size: 15px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

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

/* Inputs */
.input, .select {
    font-family: var(--font-ui);
    font-size: 14px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.input:focus, .select:focus {
    outline: none;
    border-color: var(--accent);
}

.input-sm {
    padding: 6px 10px;
    font-size: 13px;
}

.select {
    cursor: pointer;
}

.select-sm {
    padding: 6px 10px;
    font-size: 13px;
}

/* Main */
.main {
    padding: 32px 20px;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Webhook URL Section */
.webhook-url-section {
    margin-bottom: 24px;
}

.label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.url-display {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.url-display code {
    flex: 1;
    font-family: var(--font-code);
    font-size: 14px;
    color: var(--accent);
    word-break: break-all;
}

/* Request Builder */
.request-builder {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}

.request-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.method-select {
    width: 120px;
    font-weight: 600;
}

.request-row .input {
    flex: 1;
}

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

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 18px;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

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

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

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Code Editor */
.code-editor {
    width: 100%;
    min-height: 150px;
    padding: 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-code);
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
}

.code-editor:focus {
    outline: none;
    border-color: var(--accent);
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
}

/* KV Editor */
.kv-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.kv-row {
    display: flex;
    gap: 8px;
}

.kv-key, .kv-value {
    flex: 1;
}

.kv-remove {
    color: var(--text-muted);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
}

.kv-remove:hover {
    color: var(--danger);
}

/* Auto Repeat */
.auto-repeat-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.toggle-label input {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 22px;
    background: var(--bg-tertiary);
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--text-secondary);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.2s;
}

.toggle-label input:checked + .toggle-slider {
    background: var(--accent-muted);
}

.toggle-label input:checked + .toggle-slider::after {
    background: var(--accent);
    left: 21px;
}

.repeat-options {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.repeat-status {
    font-size: 13px;
    color: var(--accent);
}

/* Response Section */
.response-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.response-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.response-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.status-badge {
    font-family: var(--font-code);
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius);
    background: var(--accent-muted);
    color: var(--accent);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.meta-item {
    font-family: var(--font-code);
    font-size: 13px;
    color: var(--text-secondary);
}

.response-body {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    font-family: var(--font-code);
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.response-headers {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}

.response-header-item {
    display: flex;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

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

.header-name {
    font-weight: 500;
    color: var(--accent);
    min-width: 200px;
    font-family: var(--font-code);
}

.header-value {
    color: var(--text-secondary);
    font-family: var(--font-code);
    word-break: break-all;
}

/* Chart */
#responseChart {
    width: 100%;
    height: 200px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.chart-stats {
    display: flex;
    gap: 24px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.chart-stat {
    display: flex;
    gap: 6px;
}

.chart-stat-value {
    font-weight: 600;
    color: var(--accent);
    font-family: var(--font-code);
}

/* Compare View */
.compare-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.compare-side h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.compare-side .code-editor {
    min-height: 200px;
}

/* History */
.history-header, .templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-header h3, .templates-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.history-actions {
    display: flex;
    gap: 8px;
}

.history-list, .templates-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item, .template-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover, .template-item:hover {
    border-color: var(--accent);
}

.history-item-header, .template-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.history-item-method, .template-item-method {
    font-family: var(--font-code);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--accent-muted);
    color: var(--accent);
}

.history-item-url, .template-item-url {
    font-family: var(--font-code);
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.history-item-status {
    font-family: var(--font-code);
    font-size: 12px;
    font-weight: 500;
}

.history-item-status.success {
    color: var(--accent);
}

.history-item-status.error {
    color: var(--danger);
}

.history-item-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group .label {
    margin-bottom: 8px;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 20px 0;
    margin-top: 60px;
    text-align: center;
}

.footer p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .header .container {
        flex-wrap: wrap;
    }

    .nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .header-actions {
        order: 2;
    }

    .request-row {
        flex-wrap: wrap;
    }

    .method-select {
        width: 100%;
    }

    .compare-container {
        grid-template-columns: 1fr;
    }

    .repeat-options {
        flex-wrap: wrap;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
