/* ═══════════════════════════════════════════════════════════════════════════
   NEWTON INTERFACE BUILDER - Design System
   Claude-esque + Apple HIG 2026
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   Design Tokens
   ───────────────────────────────────────────────────────────────────────────── */

:root {
    /* Surface Colors - Warm Dark Theme */
    --surface-primary: #0d0d0d;
    --surface-secondary: #161616;
    --surface-tertiary: #1e1e1e;
    --surface-elevated: #252525;
    --surface-overlay: rgba(30, 30, 30, 0.95);

    /* Warm Accent Colors - Claude Palette */
    --accent-primary: #da7756;
    --accent-primary-hover: #e8937a;
    --accent-secondary: #c75b39;
    --accent-glow: rgba(218, 119, 86, 0.3);
    --accent-dim: rgba(218, 119, 86, 0.12);

    /* Newton Teal - Verification */
    --newton-primary: #4ecdc4;
    --newton-secondary: #3bb8b0;
    --newton-glow: rgba(78, 205, 196, 0.35);
    --newton-dim: rgba(78, 205, 196, 0.12);

    /* Semantic Colors */
    --success: #34c759;
    --success-dim: rgba(52, 199, 89, 0.15);
    --warning: #ffcc00;
    --warning-dim: rgba(255, 204, 0, 0.15);
    --error: #ff3b30;
    --error-dim: rgba(255, 59, 48, 0.15);
    --info: #5ac8fa;
    --info-dim: rgba(90, 200, 250, 0.15);

    /* Text Colors */
    --text-primary: #fafafa;
    --text-secondary: rgba(250, 250, 250, 0.7);
    --text-tertiary: rgba(250, 250, 250, 0.45);
    --text-quaternary: rgba(250, 250, 250, 0.25);

    /* Borders & Separators */
    --border-primary: rgba(255, 255, 255, 0.08);
    --border-secondary: rgba(255, 255, 255, 0.04);
    --border-focus: var(--accent-primary);

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', system-ui, sans-serif;
    --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

    /* Spacing Scale - 4px base */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
    --space-9: 48px;
    --space-10: 64px;

    /* Border Radius */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 40px var(--accent-glow);
    --shadow-newton: 0 0 30px var(--newton-glow);

    /* Glass Effect */
    --glass-bg: rgba(30, 30, 30, 0.7);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-blur: 24px;

    /* Transitions */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out-expo: cubic-bezier(0.87, 0, 0.13, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Layout */
    --nav-height: 72px;
    --sidebar-width: 280px;
    --max-width: 1400px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CSS Reset & Base
   ───────────────────────────────────────────────────────────────────────────── */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--surface-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Gradient Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(218, 119, 86, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 60% at 80% 20%, rgba(78, 205, 196, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse 50% 50% at 50% 90%, rgba(218, 119, 86, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

::selection {
    background: var(--accent-primary);
    color: var(--text-primary);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Layout
   ───────────────────────────────────────────────────────────────────────────── */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--newton-primary), var(--accent-primary));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: var(--surface-primary);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
}

.sidebar-section {
    margin-bottom: var(--space-6);
}

.sidebar-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
    padding: 0 var(--space-3);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--duration-fast) var(--ease-out-expo);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: var(--surface-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent-primary);
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-primary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 12px;
    color: var(--text-tertiary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

.status-dot.disconnected {
    background: var(--error);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.content-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
}

.content-title {
    font-size: 24px;
    font-weight: 600;
}

.content-body {
    flex: 1;
    padding: var(--space-6);
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Cards
   ───────────────────────────────────────────────────────────────────────────── */

.card {
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-bottom: var(--space-4);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

.card-interactive {
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out-expo);
}

.card-interactive:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out-expo);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--surface-primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-primary-hover);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--surface-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-elevated);
    border-color: var(--text-tertiary);
}

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

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-tertiary);
    color: var(--text-primary);
}

.btn-newton {
    background: var(--newton-primary);
    color: var(--surface-primary);
}

.btn-newton:hover:not(:disabled) {
    background: var(--newton-secondary);
    box-shadow: var(--shadow-newton);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
}

.btn-lg {
    padding: var(--space-4) var(--space-7);
    font-size: 16px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Inputs
   ───────────────────────────────────────────────────────────────────────────── */

.input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-sans);
    font-size: 14px;
    background: var(--surface-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: all var(--duration-fast) var(--ease-out-expo);
}

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

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

.textarea {
    min-height: 120px;
    resize: vertical;
}

.input-group {
    margin-bottom: var(--space-4);
}

.input-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Select
   ───────────────────────────────────────────────────────────────────────────── */

.select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-sans);
    font-size: 14px;
    background: var(--surface-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    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'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-4) center;
}

.select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Badges
   ───────────────────────────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.badge-success {
    background: var(--success-dim);
    color: var(--success);
}

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

.badge-warning {
    background: var(--warning-dim);
    color: var(--warning);
}

.badge-info {
    background: var(--info-dim);
    color: var(--info);
}

.badge-newton {
    background: var(--newton-dim);
    color: var(--newton-primary);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Templates Grid
   ───────────────────────────────────────────────────────────────────────────── */

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-4);
}

.template-card {
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out-expo);
}

.template-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.template-preview {
    height: 160px;
    background: var(--surface-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    border-bottom: 1px solid var(--border-primary);
}

.template-info {
    padding: var(--space-4);
}

.template-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.template-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.template-tag {
    font-size: 11px;
    padding: var(--space-1) var(--space-2);
    background: var(--surface-tertiary);
    border-radius: var(--radius-xs);
    color: var(--text-tertiary);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Builder Area
   ───────────────────────────────────────────────────────────────────────────── */

.builder-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: var(--space-4);
    height: calc(100vh - 200px);
}

.builder-canvas {
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.canvas-toolbar {
    padding: var(--space-3) var(--space-4);
    background: var(--surface-tertiary);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.canvas-tabs {
    display: flex;
    gap: var(--space-1);
}

.canvas-tab {
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-xs);
    color: var(--text-tertiary);
    cursor: pointer;
    background: transparent;
    border: none;
    transition: all var(--duration-fast);
}

.canvas-tab:hover {
    color: var(--text-secondary);
}

.canvas-tab.active {
    background: var(--surface-secondary);
    color: var(--text-primary);
}

.canvas-preview {
    flex: 1;
    padding: var(--space-4);
    overflow: auto;
}

.canvas-code {
    flex: 1;
    padding: var(--space-4);
    overflow: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    background: var(--surface-primary);
}

.canvas-code pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.builder-panel {
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: var(--space-4);
    background: var(--surface-tertiary);
    border-bottom: 1px solid var(--border-primary);
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
}

.panel-content {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Variables Form
   ───────────────────────────────────────────────────────────────────────────── */

.variables-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.variable-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.variable-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Code Block
   ───────────────────────────────────────────────────────────────────────────── */

.code-block {
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    overflow-x: auto;
}

.code-block pre {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
}

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

/* Syntax Highlighting */
.code-keyword { color: var(--accent-primary); }
.code-string { color: var(--success); }
.code-number { color: var(--newton-primary); }
.code-comment { color: var(--text-tertiary); }
.code-tag { color: var(--accent-primary); }
.code-attr { color: var(--newton-primary); }

/* ─────────────────────────────────────────────────────────────────────────────
   Loading & Status
   ───────────────────────────────────────────────────────────────────────────── */

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-primary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: var(--surface-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Toast Notifications
   ───────────────────────────────────────────────────────────────────────────── */

.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    background: var(--surface-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s var(--ease-out-expo);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--error); }
.toast-info { border-left: 3px solid var(--info); }

/* ─────────────────────────────────────────────────────────────────────────────
   Docs View
   ───────────────────────────────────────────────────────────────────────────── */

.docs-content {
    max-width: 800px;
}

.docs-section {
    margin-bottom: var(--space-8);
}

.docs-heading {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-primary);
}

.docs-subheading {
    font-size: 16px;
    font-weight: 600;
    margin-top: var(--space-6);
    margin-bottom: var(--space-3);
}

.docs-text {
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
    line-height: 1.7;
}

.docs-list {
    list-style: none;
    margin-bottom: var(--space-4);
}

.docs-list li {
    padding: var(--space-2) 0;
    padding-left: var(--space-4);
    color: var(--text-secondary);
    position: relative;
}

.docs-list li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: 600;
}

.endpoint-card {
    background: var(--surface-tertiary);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
}

.endpoint-method {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-xs);
    margin-right: var(--space-2);
}

.endpoint-method.get { background: var(--info-dim); color: var(--info); }
.endpoint-method.post { background: var(--success-dim); color: var(--success); }

.endpoint-path {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
}

.endpoint-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: var(--space-2);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Empty State
   ───────────────────────────────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: var(--space-10);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.empty-description {
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Verification Result
   ───────────────────────────────────────────────────────────────────────────── */

.verification-result {
    background: var(--surface-tertiary);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    margin-top: var(--space-4);
}

.verification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.verification-time {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-tertiary);
}

.verification-details {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}

.verification-details div {
    padding: var(--space-1) 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Views
   ───────────────────────────────────────────────────────────────────────────── */

.view {
    display: none;
}

.view.active {
    display: block;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .sidebar {
        width: 64px;
    }

    .sidebar-title,
    .sidebar-section-label,
    .nav-item span:not(.nav-icon) {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: var(--space-3);
    }

    .main-content {
        margin-left: 64px;
    }

    .builder-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* Mobile bottom navigation bar */
    .sidebar {
        width: 100% !important;
        position: fixed !important;
        bottom: 0 !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        height: auto !important;
        min-height: 56px;
        flex-direction: row !important;
        overflow-x: auto;
        padding: 0 !important;
        border-top: 1px solid var(--border-primary);
        border-right: none;
        z-index: 1000;
    }

    /* Hide non-essential sidebar elements */
    .sidebar-header,
    .sidebar-footer,
    .sidebar-section-label {
        display: none !important;
    }

    .sidebar-content {
        display: flex !important;
        flex-direction: row !important;
        padding: var(--space-2) !important;
        gap: var(--space-1) !important;
        width: 100%;
        justify-content: center;
        overflow-x: auto;
    }

    .sidebar-section {
        display: flex !important;
        flex-direction: row !important;
        margin-bottom: 0 !important;
        gap: var(--space-1);
    }

    .sidebar-nav {
        flex-direction: row !important;
        gap: var(--space-1) !important;
    }

    /* Mobile nav items */
    .nav-item {
        flex-direction: column !important;
        padding: var(--space-2) var(--space-3) !important;
        font-size: 10px !important;
        gap: var(--space-1) !important;
        min-width: 56px;
        text-align: center;
        justify-content: center;
        align-items: center;
    }

    .nav-icon {
        font-size: 20px !important;
        width: auto !important;
    }

    .nav-item span:not(.nav-icon) {
        font-size: 10px;
    }

    /* Adjust main content for bottom nav */
    .main-content {
        margin-left: 0 !important;
        margin-bottom: 70px !important;
    }

    .content-header {
        flex-direction: column;
        gap: var(--space-3);
        align-items: flex-start;
    }

    .content-header > div {
        width: 100%;
        flex-direction: column !important;
    }

    .content-header input,
    .content-header select {
        width: 100% !important;
    }

    .templates-grid {
        grid-template-columns: 1fr;
    }

    .builder-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .builder-panel {
        min-height: 300px;
    }

    /* Better touch targets */
    .btn {
        min-height: 44px;
    }

    .input,
    .select {
        font-size: 16px; /* Prevent iOS zoom */
    }
}
