/* ===== API Response Mocker — Design System ===== */
/* Palette: Indigo-Violet gradient | BG: #0F0A1A */

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

:root {
    --primary: #6366F1;
    --primary-light: #818CF8;
    --primary-dim: rgba(99, 102, 241, 0.12);
    --primary-glow: rgba(99, 102, 241, 0.3);
    --accent: #8B5CF6;
    --accent-dim: rgba(139, 92, 246, 0.12);
    --danger: #EF4444;
    --danger-dim: rgba(239, 68, 68, 0.12);
    --success: #22C55E;
    --success-dim: rgba(34, 197, 94, 0.12);
    --warning: #F59E0B;
    --bg-base: #0B0E18;
    --bg-surface: #141829;
    --bg-elevated: #1C2038;
    --bg-hover: #252A42;
    --bg-input: #111527;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border: rgba(148, 163, 184, 0.1);
    --border-focus: rgba(99, 102, 241, 0.5);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-xs: 4px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ===== App Layout ===== */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: linear-gradient(180deg, rgba(20, 24, 41, 0.95) 0%, rgba(11, 14, 24, 0.98) 100%);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-left h1 {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
}

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

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

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

.btn-primary:hover {
    box-shadow: 0 4px 16px var(--primary-glow);
    transform: translateY(-1px);
}

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

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: rgba(148, 163, 184, 0.2);
}

.btn-accent {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.btn-accent:hover {
    background: rgba(139, 92, 246, 0.2);
}

.btn-danger {
    background: var(--danger-dim);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.75rem;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.7rem;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-save {
    width: 100%;
    justify-content: center;
    padding: 10px;
    font-size: 0.85rem;
    margin-top: 8px;
}

/* ===== Main Layout ===== */
.main-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 0;
    overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 8px;
}

.sidebar-header h2 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.endpoint-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0 16px 10px;
    border-bottom: 1px solid var(--border);
}

/* ===== Endpoint List ===== */
.endpoint-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-hover) transparent;
}

.endpoint-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    margin-bottom: 2px;
}

.endpoint-item:hover {
    background: var(--bg-hover);
}

.endpoint-item.active {
    background: var(--primary-dim);
    border-color: rgba(99, 102, 241, 0.2);
}

.endpoint-item .method-badge {
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-mono);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    min-width: 40px;
    text-align: center;
}

.endpoint-item .ep-path {
    font-size: 0.78rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.endpoint-item .ep-status {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Method colors */
.method-GET {
    background: var(--success-dim);
    color: var(--success);
}

.method-POST {
    background: rgba(59, 130, 246, 0.12);
    color: #60A5FA;
}

.method-PUT {
    background: rgba(245, 158, 11, 0.12);
    color: #FBBF24;
}

.method-PATCH {
    background: rgba(139, 92, 246, 0.12);
    color: #A78BFA;
}

.method-DELETE {
    background: var(--danger-dim);
    color: #F87171;
}

/* ===== Empty State ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 8px;
    padding: 32px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state p {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.empty-state span {
    font-size: 0.72rem;
}

/* ===== Editor Panel ===== */
.editor-panel {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-hover) transparent;
}

.editor-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 12px;
    color: var(--text-muted);
    text-align: center;
}

.editor-placeholder h3 {
    font-size: 1rem;
    color: var(--text-secondary);
}

.editor-placeholder p {
    font-size: 0.8rem;
}

/* ===== Editor Form ===== */
.editor-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    flex: 1;
}

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

.form-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.form-header-actions {
    display: flex;
    gap: 6px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.flex-grow {
    flex: 1;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.label-hint {
    font-weight: 400;
    text-transform: none;
    color: var(--text-muted);
    letter-spacing: 0;
}

.method-group {
    flex: 0 0 120px;
}

.path-group {
    flex: 1;
}

/* ===== Inputs ===== */
.input,
.select {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.input:focus,
.select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

.select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.method-select {
    font-family: var(--font-mono);
    font-weight: 600;
}

/* ===== Code Editor ===== */
.code-editor {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    resize: vertical;
    min-height: 200px;
    outline: none;
    tab-size: 2;
    transition: var(--transition);
}

.code-editor:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.code-editor::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.json-error {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: #FCA5A5;
    padding: 4px 0;
    display: none;
}

.json-error.visible {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

/* ===== Section Header ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== Headers Container ===== */
.headers-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.header-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-row .input {
    flex: 1;
    padding: 6px 10px;
    font-size: 0.8rem;
}

.header-row .btn-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

/* ===== Test Panel ===== */
.test-panel {
    width: 380px;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-hover) transparent;
}

.test-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.test-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
}

.test-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.method-badge {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-mono);
    padding: 3px 8px;
    border-radius: var(--radius-xs);
}

.test-path {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.status-badge {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-mono);
    padding: 3px 8px;
    border-radius: var(--radius-xs);
    background: var(--success-dim);
    color: var(--success);
}

.status-badge.error {
    background: var(--danger-dim);
    color: var(--danger);
}

.delay-badge {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.test-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.test-section h4 {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.test-output {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-base);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.82rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
    backdrop-filter: blur(12px);
}

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

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.endpoint-item {
    animation: fadeIn 0.2s ease-out;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 200px;
    }

    .test-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}

@media (max-width: 600px) {
    .header {
        padding: 10px 16px;
        flex-direction: column;
        gap: 8px;
    }

    .form-row {
        flex-direction: column;
    }

    .method-group {
        flex: auto;
    }

    .editor-form {
        padding: 16px;
    }

    .test-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}