/* ── RESET & ROOT ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0d0d0f;
    --card:      #111115;
    --card-2:    #16161b;
    --border:    rgba(255,255,255,0.06);
    --neon:      #eaff4f;
    --neon-dim:  rgba(234,255,79,0.15);
    --neon-glow: rgba(234,255,79,0.35);
    --green:     #3dffa0;
    --red:       #ff5f6d;
    --blue:      #5fbfff;
    --text:      #f0f0f5;
    --text-dim:  #5a5a70;
    --text-mid:  #9090a8;
    --font-ui:   'Syne', sans-serif;
    --font-code: 'Space Mono', monospace;
    --radius:    14px;
    --radius-sm: 8px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── BACKGROUND EFFECTS ──────────────────────────── */
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    min-height: 100vh;
    padding: 24px 20px;
    overflow-x: hidden;
    position: relative;
}

.noise {
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    opacity: 0.4;
}

.glow-orb {
    position: fixed; border-radius: 50%;
    filter: blur(100px); pointer-events: none; z-index: 0; opacity: 0.12;
}
.orb-1 { width: 500px; height: 500px; background: var(--neon); top: -150px; right: -100px; }
.orb-2 { width: 400px; height: 400px; background: #5fbfff; bottom: -100px; left: -100px; }

.container {
    max-width: 1100px; margin: 0 auto;
    position: relative; z-index: 1;
}

/* ── HEADER ──────────────────────────────────────── */
header {
    display: flex; align-items: center; gap: 18px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    animation: fadeDown 0.5s ease both;
}

.logo-wrap {
    position: relative; width: 52px; height: 52px; flex-shrink: 0;
}
.logo-icon {
    width: 52px; height: 52px;
    background: var(--card-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(255,255,255,0.05), inset 0 1px 0 rgba(255,255,255,0.08);
    position: relative; z-index: 1;
}
.logo-icon img {
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 6px;
}
.logo-pulse {
    position: absolute; inset: -4px;
    border-radius: 18px;
    border: 1px solid var(--neon);
    opacity: 0;
    animation: pulse 3s ease-in-out 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.08); }
}

.header-text { flex: 1; }
h1 {
    font-size: 28px; font-weight: 800; letter-spacing: -0.5px;
    line-height: 1;
}
h1 span { color: var(--neon); }

.tagline {
    font-family: var(--font-code);
    font-size: 10px; color: var(--text-dim);
    letter-spacing: 3px; margin-top: 5px;
}
.version {
    color: var(--neon); padding: 1px 5px;
    background: var(--neon-dim); border-radius: 3px;
}

.header-status {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--font-code); font-size: 11px;
    color: var(--text-dim); letter-spacing: 2px;
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-dim);
    transition: var(--transition);
}
.status-dot.active {
    background: var(--green);
    box-shadow: 0 0 10px var(--green);
    animation: blink 2s ease-in-out infinite;
}
.status-dot.loading {
    background: var(--neon);
    box-shadow: 0 0 10px var(--neon-glow);
    animation: spin-dot 1s linear infinite;
}
.status-dot.error {
    background: var(--red);
    box-shadow: 0 0 10px var(--red);
    animation: none;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
@keyframes spin-dot {
    0% { transform: rotate(0deg) translateX(4px); }
    100% { transform: rotate(360deg) translateX(4px); }
}

/* ── REQUEST BOX ─────────────────────────────────── */
.request-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 6px 6px 16px;
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px;
    animation: fadeUp 0.5s ease 0.1s both;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.request-box:focus-within {
    border-color: rgba(234,255,79,0.25);
    box-shadow: 0 0 0 1px rgba(234,255,79,0.1), 0 8px 32px rgba(0,0,0,0.4);
}

.request-label {
    font-family: var(--font-code); font-size: 9px;
    letter-spacing: 3px; color: var(--text-dim);
    white-space: nowrap; flex-shrink: 0;
}

.input-group {
    display: flex; align-items: center; gap: 10px; flex: 1;
}

.method-wrap {
    flex-shrink: 0;
}
select {
    background: var(--card-2);
    border: 1px solid var(--border);
    color: var(--neon);
    font-family: var(--font-code);
    font-size: 12px; font-weight: 700;
    letter-spacing: 1px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    outline: none; cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: var(--transition);
    min-width: 90px; text-align: center;
}
select:hover { border-color: var(--neon-dim); }
select:focus { border-color: var(--neon); box-shadow: 0 0 0 2px var(--neon-dim); }

.url-wrap {
    flex: 1; position: relative; display: flex; align-items: center;
}
.url-icon {
    position: absolute; left: 12px;
    color: var(--text-dim); font-size: 18px;
    pointer-events: none; line-height: 1;
}
input[type="text"] {
    width: 100%;
    background: var(--card-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-code);
    font-size: 13px;
    padding: 10px 14px 10px 36px;
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
}
input[type="text"]:focus {
    border-color: var(--neon);
    box-shadow: 0 0 0 2px var(--neon-dim);
    background: #1a1a20;
}
input::placeholder { color: var(--text-dim); }

#send-btn {
    flex-shrink: 0;
    background: var(--neon);
    color: #0d0d0f;
    font-family: var(--font-ui);
    font-size: 13px; font-weight: 800;
    letter-spacing: 1.5px;
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: var(--transition);
    position: relative; overflow: hidden;
}
#send-btn::before {
    content: '';
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.15);
    transform: translateX(-110%) skewX(-15deg);
    transition: transform 0.4s ease;
}
#send-btn:hover::before { transform: translateX(110%) skewX(-15deg); }
#send-btn:hover {
    box-shadow: 0 0 24px var(--neon-glow), 0 4px 16px rgba(0,0,0,0.4);
    transform: translateY(-1px);
}
#send-btn:active { transform: translateY(0); }
#send-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-arrow { font-size: 16px; transition: transform var(--transition); }
#send-btn:hover .btn-arrow { transform: translateX(3px); }

/* ── GRID ────────────────────────────────────────── */
.grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 16px;
    animation: fadeUp 0.5s ease 0.2s both;
}

/* ── PANELS ──────────────────────────────────────── */
.response-area, .history-area, .info-area {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.sidebar { display: flex; flex-direction: column; gap: 16px; }

.area-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
    display: flex; align-items: center; justify-content: space-between;
}
.area-title {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--font-code);
    font-size: 10px; font-weight: 700;
    letter-spacing: 3px; color: var(--text-dim);
}
.area-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--neon);
    box-shadow: 0 0 6px var(--neon);
}

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

.status-badge, .timing-badge {
    font-family: var(--font-code); font-size: 10px; font-weight: 700;
    letter-spacing: 1px; padding: 3px 9px;
    border-radius: 20px; display: none;
}
.status-badge.ok {
    display: inline-flex;
    color: var(--green); background: rgba(61,255,160,0.1);
    border: 1px solid rgba(61,255,160,0.25);
}
.status-badge.err {
    display: inline-flex;
    color: var(--red); background: rgba(255,95,109,0.1);
    border: 1px solid rgba(255,95,109,0.25);
}
.timing-badge {
    display: none;
    color: var(--text-dim); background: var(--card-2);
    border: 1px solid var(--border);
}
.timing-badge.visible { display: inline-flex; }

.response-body-wrap {
    display: flex;
    max-height: 520px;
    overflow: auto;
}
.line-numbers {
    padding: 20px 12px 20px 16px;
    font-family: var(--font-code); font-size: 13px;
    line-height: 1.7; color: var(--text-dim);
    user-select: none; text-align: right;
    border-right: 1px solid var(--border);
    min-width: 48px; background: rgba(0,0,0,0.15);
    flex-shrink: 0;
}
pre#response-body {
    padding: 20px;
    font-family: var(--font-code);
    font-size: 13px; line-height: 1.7;
    overflow: visible;
    color: var(--green);
    flex: 1; white-space: pre-wrap; word-break: break-all;
}

/* JSON syntax highlight via CSS tricks */
pre.loading { color: var(--text-mid) !important; }
pre.error   { color: var(--red) !important; }

/* ── HISTORY ─────────────────────────────────────── */
.clear-btn {
    background: none; border: none;
    font-family: var(--font-code);
    font-size: 9px; letter-spacing: 2px;
    color: var(--text-dim); cursor: pointer;
    padding: 4px 8px; border-radius: 4px;
    transition: var(--transition);
}
.clear-btn:hover { color: var(--red); background: rgba(255,95,109,0.1); }

.history-list { padding: 8px; }

.history-item {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    transition: var(--transition);
    border: 1px solid transparent;
    animation: slideIn 0.3s ease both;
}
.history-item:hover {
    background: var(--card-2);
    border-color: var(--border);
}
.history-item:last-child { margin-bottom: 0; }

.hi-method {
    font-family: var(--font-code);
    font-size: 9px; font-weight: 700; letter-spacing: 1px;
    padding: 2px 7px; border-radius: 4px;
    flex-shrink: 0;
}
.hi-method.ok   { color: var(--green); background: rgba(61,255,160,0.1); }
.hi-method.err  { color: var(--red); background: rgba(255,95,109,0.1); }
.hi-method.warn { color: var(--neon); background: var(--neon-dim); }

.hi-url {
    font-family: var(--font-code);
    font-size: 10px; color: var(--text-dim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 1;
}

.hi-empty {
    text-align: center; padding: 24px 12px;
    font-family: var(--font-code); font-size: 10px;
    color: var(--text-dim); letter-spacing: 2px;
}

/* ── STATS ───────────────────────────────────────── */
.stats-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    padding: 12px 8px; gap: 4px;
}
.stat-item {
    display: flex; flex-direction: column; align-items: center;
    padding: 12px; border-radius: var(--radius-sm);
    background: var(--card-2); border: 1px solid var(--border);
    transition: var(--transition);
}
.stat-item:hover { border-color: rgba(234,255,79,0.15); }
.stat-value {
    font-family: var(--font-code);
    font-size: 22px; font-weight: 700; color: var(--neon);
    line-height: 1;
    transition: var(--transition);
}
.stat-label {
    font-family: var(--font-code);
    font-size: 9px; color: var(--text-dim);
    letter-spacing: 2px; margin-top: 6px;
}

/* ── ANIMATIONS ──────────────────────────────────── */
@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── SCROLLBAR ───────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 780px) {
    .grid { grid-template-columns: 1fr; }
    .request-label { display: none; }
    .sidebar { flex-direction: row; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 540px) {
    body { padding: 12px; }
    .input-group { flex-wrap: wrap; }
    input[type="text"] { min-width: 0; }
    #send-btn { width: 100%; justify-content: center; }
    .sidebar { flex-direction: column; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}