/* ============================================
   HTTP Method Tester — Design System
   ============================================ */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.85);
    --bg-glass: rgba(30, 41, 59, 0.6);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.3);
    --success: #4ade80;
    --error: #f87171;
    --warning: #fbbf24;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, sans-serif;
}

[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.7);
    --border-glass: rgba(0, 0, 0, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
}

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

html {
    font-size: 16px;
}

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

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse 600px 400px at 25% 25%, rgba(139, 92, 246, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.app {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

.header {
    padding: 16px 0 12px;
}

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

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

.logo-icon {
    font-size: 1.5rem;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.logo h1 {
    font-size: 1.1rem;
    font-weight: 700;
}

.tagline {
    font-size: 0.66rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.icon-btn:hover {
    color: var(--accent);
}

.icon {
    width: 18px;
    height: 18px;
}

.moon-icon {
    display: none;
}

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

[data-theme="light"] .moon-icon {
    display: block;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-glow);
}

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

.btn-secondary {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
}

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

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

.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 0;
}

.btn-text:hover {
    text-decoration: underline;
}

.section {
    margin-bottom: 20px;
}

/* URL Row */
.url-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.url-row select {
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-family: var(--font);
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    min-width: 100px;
}

.url-row input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.84rem;
    transition: border-color var(--transition);
}

.url-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.url-row input::placeholder {
    color: var(--text-muted);
}

/* Request Tabs */
.req-tabs,
.resp-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 0;
}

.req-tab,
.resp-tab {
    padding: 8px 16px;
    border: none;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.req-tab.active,
.resp-tab.active {
    background: var(--bg-card);
    color: var(--accent);
    border-color: var(--accent);
}

.req-tab:hover,
.resp-tab:hover {
    color: var(--text-secondary);
}

/* Tab Panels */
.tab-panel {
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 0 var(--radius) var(--radius) var(--radius);
    min-height: 60px;
}

/* Headers Editor */
.header-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    align-items: center;
}

.header-row input {
    flex: 1;
    padding: 7px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.78rem;
}

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

.header-row input::placeholder {
    color: var(--text-muted);
}

.header-row .remove-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(248, 113, 113, 0.1);
    color: var(--error);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Body */
.body-type-select {
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.76rem;
    margin-bottom: 8px;
    cursor: pointer;
}

textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.8rem;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
}

textarea::placeholder {
    color: var(--text-muted);
}

/* History */
.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-glass);
    cursor: pointer;
    transition: all var(--transition);
}

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

.history-method {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--bg-secondary);
}

.history-url {
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.history-status {
    font-size: 0.68rem;
    font-weight: 700;
}

.empty-msg {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

/* Response */
.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.response-header h2 {
    font-size: 0.92rem;
    font-weight: 700;
}

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

.status-badge {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.status-2xx {
    background: rgba(74, 222, 128, 0.15);
    color: var(--success);
}

.status-3xx {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
}

.status-4xx {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.status-5xx {
    background: rgba(248, 113, 113, 0.15);
    color: var(--error);
}

.response-time,
.response-size {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.response-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 0 var(--radius) var(--radius) var(--radius);
    overflow: hidden;
}

.resp-actions {
    display: flex;
    gap: 6px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-glass);
}

.response-code {
    padding: 14px;
    font-family: monospace;
    font-size: 0.78rem;
    color: var(--accent);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
    margin: 0;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.82rem;
    opacity: 0;
    transition: all 0.35s ease;
    z-index: 100;
    pointer-events: none;
}

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

.hidden {
    display: none !important;
}

/* Loading animation */
.sending .btn-primary {
    pointer-events: none;
    opacity: 0.7;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.loading-text {
    animation: pulse 1s infinite;
}

@media (max-width: 640px) {
    .url-row {
        flex-direction: column;
    }

    .url-row select {
        min-width: 100%;
    }

    .response-meta {
        flex-wrap: wrap;
    }
}