/* ==========================================================================
   1. STUDIO DESIGN TOKENS, RESET & SHARED PRIMITIVES
   ========================================================================== */
@font-face {
    font-family: 'Inter Fallback';
    src: local('Arial');
    size-adjust: 107%;
    ascent-override: 90%;
    descent-override: 22%;
    line-gap-override: 0%;
}

@font-face {
    font-family: 'Outfit Fallback';
    src: local('Arial');
    size-adjust: 101%;
    ascent-override: 98%;
    descent-override: 24%;
    line-gap-override: 0%;
}

:root {
    color-scheme: dark;
    --bg-base: #0b0f19;
    --bg-deep: #070a12;
    --studio-theme-top: #0b0f19;
    --in-oklab: ;
    --surface-1: rgba(17, 24, 39, 0.88);
    --surface-2: rgba(24, 34, 52, 0.85);
    --surface-3: rgba(34, 47, 70, 0.78);
    --surface-modal: #111827;
    --border: rgba(148, 163, 184, 0.13);
    --border-hover: rgba(96, 165, 250, 0.32);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #6e8098;
    --accent: #60a5fa;
    --accent-strong: #3b82f6;
    --accent-cta-start: #2563eb;
    --accent-cta-end: #1d4ed8;
    --accent-glow: rgba(96, 165, 250, 0.12);
    --brand-start: #60a5fa;
    --brand-end: #1e3a8a;
    --success: #10b981;
    --success-text: #4fd1a5;
    --warning: #d97706;
    --warning-text: #f5b041;
    --danger: #e11d48;
    --danger-text: #f47280;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-pill: 9999px;
    --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@supports (background: linear-gradient(in oklab, white, black)) {
    :root {
        --in-oklab: in oklab;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Inter Fallback', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
    color-scheme: dark;
    background-color: var(--studio-theme-top, var(--bg-base));
}

body {
    background-color: var(--studio-theme-top, var(--bg-base));
    background-image:
        radial-gradient(80% 38% at 50% 0%, color-mix(in oklab, var(--brand-start) 10%, transparent) 0%, transparent 70%),
        radial-gradient(circle at 85% 85%, rgba(30, 58, 138, 0.12) 0%, transparent 50%),
        linear-gradient(180deg var(--in-oklab), var(--studio-theme-top, var(--bg-base)) 0%, #0f1626 52%, var(--bg-base) 100%);
    color: var(--text-main);
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(32px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(120px, calc(100px + env(safe-area-inset-bottom))) max(16px, env(safe-area-inset-left));
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Centered Studio Layout */
.studio-container {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
/* Section Cards */
.card {
    background: var(--surface-1);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 28px -10px rgba(0, 0, 0, 0.45);
    transition: var(--transition);
}

.api-reference-card {
    padding: 18px 20px;
}

.dialog-section-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

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

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Outfit', 'Outfit Fallback', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
}

.card-title-text {
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    line-height: inherit;
}

.card-step-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--accent);
    border: 1px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}
.badge-pill {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
}

.badge-pill.active {
    background: rgba(16, 185, 129, 0.14);
    color: var(--success-text);
    border-color: rgba(16, 185, 129, 0.3);
}

.badge-pill.inactive {
    background: rgba(225, 29, 72, 0.14);
    color: var(--danger-text);
    border-color: rgba(225, 29, 72, 0.3);
}

.badge-pill.warning {
    background: rgba(217, 119, 6, 0.16);
    color: var(--warning-text);
    border-color: rgba(217, 119, 6, 0.35);
}

.table-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

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

.table-btn.danger:hover {
    border-color: var(--danger);
    color: var(--danger-text);
    background: rgba(225, 29, 72, 0.1);
}
.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary-action {
    background: linear-gradient(135deg, var(--accent-cta-start) 0%, var(--accent-cta-end) 100%);
    color: #f8fafc;
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 14px rgba(37, 99, 235, 0.28);
}

.btn-primary-action:hover { filter: brightness(1.08); }

.btn-secondary-action {
    background: var(--surface-2);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary-action:hover {
    border-color: var(--accent);
    background: rgba(96, 165, 250, 0.1);
}
/* Inputs & Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-label span.req {
    color: var(--accent);
}

.input-row {
    display: flex;
    align-items: center;
    position: relative;
}

.input-text, .select-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-main);
    transition: var(--transition);
    outline: none;
}

.input-text:focus, .select-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--surface-2);
}

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

.input-action-btn {
    position: absolute;
    right: 8px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.input-action-btn:hover {
    background: var(--accent);
    color: #0b0f19;
    border-color: var(--accent);
}
.filter-select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.filter-search {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    min-width: 200px;
    flex: 1;
    outline: none;
}

.filter-select:focus, .filter-search:focus {
    border-color: var(--accent);
}

@media (max-width: 768px) {
body {
        padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(96px, calc(80px + env(safe-area-inset-bottom))) max(12px, env(safe-area-inset-left));
    }

    .studio-container {
        gap: 8px;
    }
    input[type="text"],
    input[type="url"],
    input[type="password"],
    input[type="email"],
    select,
    textarea,
    .input-text,
    .url-slug-input,
    .auth-input,
    .filter-select,
    .filter-search {
        font-size: 16px !important;
    }
}
