:root {
    --bg-app: #0F172A;
    /* Slate 900 */
    --bg-sidebar: #1E293B;
    /* Slate 800 */
    --bg-card: #1E293B;
    --bg-input: #0B1120;
    --bg-hover: #334155;
    /* Slate 700 */

    --text-main: #F8FAFC;
    --text-muted: #94A3B8;

    --border: #334155;
    --border-focus: #3B82F6;
    /* Blue 500 */

    --primary: #3B82F6;
    --primary-hover: #2563EB;
    --accent: #10B981;
    /* Emerald 500 */
    --accent-hover: #059669;

    --danger: #EF4444;
    --warning: #F59E0B;

    --get: #3B82F6;
    --post: #10B981;
    --put: #F59E0B;
    --patch: #8B5CF6;
    --del: #EF4444;

    --font-sans: 'Inter', system-ui, sans-serif;
    --font-mono: 'Fira Code', monospace;
    --radius: 8px;
}

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

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

/* Utilities */
.hidden {
    display: none !important;
}

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

.flex-grow {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-auto {
    margin-top: auto;
}

.full-width {
    width: 100%;
}

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

.fs-sm {
    font-size: 0.85rem;
}

.font-medium {
    font-weight: 500;
}

.text-center {
    text-align: center;
}

.center-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.max-w-md {
    max-width: 28rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

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

.opacity-50 {
    opacity: 0.5;
}

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

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.brand {
    height: 60px;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
}

.logo {
    background: var(--primary);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-block {
    padding: 1.5rem 1rem;
    flex-shrink: 0;
}

.sidebar-heading {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.border-top {
    border-top: 1px solid var(--border);
}

.ep-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 1rem;
}

.ep-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

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

.ep-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.method-tag {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    width: 45px;
    text-align: center;
    color: #fff;
}

.method-tag.GET {
    background: var(--get);
}

.method-tag.POST {
    background: var(--post);
}

.method-tag.PUT {
    background: var(--put);
}

.method-tag.PATCH {
    background: var(--patch);
}

.method-tag.DELETE {
    background: var(--del);
}

.ep-path {
    font-size: 0.85rem;
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
}

.ep-item.active .ep-path {
    color: var(--text-main);
}

/* Main Workspace */
.workspace {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.workspace-header {
    height: 60px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    background: var(--bg-app);
    z-index: 5;
}

.live-url-box code {
    background: var(--bg-input);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border: 1px solid var(--border);
    margin-left: 0.5rem;
    color: var(--accent);
}

.sw-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.online {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.dot.offline {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

.content-scroll {
    flex-grow: 1;
    overflow-y: auto;
    position: relative;
}

/* States */
#welcome-state {
    display: none;
}

#welcome-state.active {
    display: flex;
}

#editor-state {
    display: none;
}

#editor-state.active {
    display: flex;
}

.editor-layout {
    display: flex;
    flex-direction: row;
    height: 100%;
    min-height: 500px;
}

@media (max-width: 1000px) {
    .editor-layout {
        flex-direction: column;
    }
}

.config-panel {
    flex: 3;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    border-right: 1px solid var(--border);
}

.tester-panel {
    flex: 2;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    background: rgba(30, 41, 59, 0.3);
}

/* Cards & Forms */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.card-header {
    margin-bottom: 1rem;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.inp {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    outline: none;
    font-family: var(--font-sans);
    transition: border 0.2s;
}

.inp:focus {
    border-color: var(--primary);
}

.url-builder {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.url-builder:focus-within {
    border-color: var(--primary);
}

.select-method {
    width: 100px;
    border: none;
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    text-align: center;
}

.path-input {
    border: none;
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 1rem;
}

.code-editor {
    flex-grow: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    color: #E2E8F0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    resize: none;
    line-height: 1.6;
    outline: none;
    transition: border 0.2s;
    min-height: 200px;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-weight: 500;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
}

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

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

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

.btn.outline:hover {
    border-color: var(--text-muted);
    background: var(--bg-hover);
}

.btn.sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn.lg {
    padding: 0.8rem 1.6rem;
    font-size: 1rem;
}

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

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

.danger-hover:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Tester Panel */
.code-output {
    background: var(--bg-input);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent);
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 100px;
}

.badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--bg-hover);
    font-family: var(--font-mono);
}

.badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Logs */
.log-card {
    min-height: 250px;
}

.log-container {
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.empty-logs {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 2rem;
    font-style: italic;
}

.log-item {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    animation: fade 0.3s;
}

@keyframes fade {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.log-path {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.log-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-main);
    color: var(--bg-app);
    padding: 0.75rem 1.5rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
}

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