:root {
    --bg-main: #f8fafc;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --border: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --shadow-sm: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.06), 0 4px 6px -4px rgb(0 0 0 / 0.06);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    margin: 0; padding: 0;
    display: flex; flex-direction: column;
    min-height: 100vh;
}

.studio-banner {
    background: #0f172a; color: #ffffff;
    padding: 24px 40px; border-bottom: 1px solid #1e293b;
}
.studio-banner h1 { font-size: 22px; margin: 0 0 6px 0; font-weight: 800; letter-spacing: -0.02em; }
.studio-banner p { font-size: 13px; margin: 0; color: #94a3b8; }

.workspace-container {
    display: grid; grid-template-columns: 1.1fr 0.9fr;
    flex-grow: 1; height: calc(100vh - 92px); overflow: hidden;
}

.panel-editor { padding: 32px 40px; overflow-y: auto; background: #f1f5f9; }
.panel-preview { padding: 32px 40px; background: #cbd5e1; display: flex; flex-direction: column; gap: 14px; }
.preview-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: #475569; margin: 0; }

/* Workspace Top Meta Bar */
.workspace-meta-bar {
    display: flex; justify-content: space-between; align-items: center;
    background: #ffffff; padding: 12px 20px; border-radius: 12px;
    margin-bottom: 20px; border: 1px solid var(--border);
}
.save-status-indicator { font-size: 12px; font-weight: 600; color: #059669; }
.btn-clear-workspace {
    background: transparent; border: 1px solid #fca5a5; color: #ef4444;
    padding: 6px 12px; font-size: 12px; font-weight: 600; border-radius: 8px; cursor: pointer;
    transition: all 0.2s ease;
}
.btn-clear-workspace:hover { background: #fee2e2; }

.iframe-container {
    flex-grow: 1; background: #ffffff; border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(15,23,42,0.25);
    overflow: hidden; border: 1px solid rgba(0,0,0,0.05);
}
iframe { width: 100%; height: 100%; border: none; display: block; }

.card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px;
    padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

@keyframes rowFlash {
    0% { background-color: rgba(37, 99, 235, 0.15); }
    100% { background-color: #ffffff; }
}
.row-flash { animation: rowFlash 0.5s ease-out; }

.status-panel-tips { background: #fffbeb; border: 1px solid #fde68a; }
.tips-list { margin: 0; padding-left: 20px; font-size: 13px; color: #92400e; line-height: 1.6; }
.tips-list li { margin-bottom: 8px; }

.section-header-config {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px dashed var(--border);
}
.config-tag {
    font-size: 10px; text-transform: uppercase; color: var(--accent); font-weight: 800;
    background: rgba(37, 99, 235, 0.08); padding: 4px 10px; border-radius: 6px; white-space: nowrap;
}

.header-input-field {
    font-family: inherit; font-weight: 800; font-size: 16px; color: var(--text-main);
    border: none; background: transparent; padding: 4px 8px; width: 100%;
}
.header-input-field:focus { background: #f1f5f9; outline: none; border-radius: 8px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.span-2 { grid-column: span 2; }

.label-editable {
    font-family: inherit; font-size: 12px; font-weight: 700; color: var(--text-muted);
    border: none; background: transparent; padding: 0; margin: 0; text-transform: capitalize;
}
.label-editable:focus { outline: none; color: var(--accent); border-bottom: 1px dashed var(--accent); }
.label-static { font-size: 12px; font-weight: 700; color: var(--text-muted); }

input[type="text"], input[type="url"], select, textarea {
    font-family: inherit; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: 10px; font-size: 14px; background: #f8fafc; color: var(--text-main);
    transition: all 0.2s ease;
}
input[type="text"]:focus, input[type="url"]:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent); background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}
textarea { height: 80px; resize: vertical; }

.preset-badge-row {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border);
}
.preset-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }

.badge-btn {
    background: #f1f5f9; color: #334155; font-size: 12px; font-weight: 600;
    padding: 8px 14px; border-radius: 20px; border: 1px solid transparent;
    cursor: pointer; transition: all 0.2s ease;
}
.badge-btn:hover { background: #e2e8f0; color: var(--accent); transform: translateY(-1px); border-color: rgba(37, 99, 235, 0.15); }

#dynamicLinksContainer { display: flex; flex-direction: column; gap: 14px; }

.link-item-pair {
    display: flex; flex-direction: column; gap: 12px; background: #ffffff;
    padding: 18px; border-radius: 14px; border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    position: relative;
}

/* 📊 Drag and Drop Reordering Visual Layout Styles */
.link-item-pair.dragging-state {
    opacity: 0.4;
    border: 2px dashed var(--accent);
    background: #eff6ff;
}

.drag-handle-grip {
    cursor: grab; display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: var(--text-muted); padding: 0 4px; user-select: none;
}
.drag-handle-grip:active { cursor: grabbing; }

.link-item-pair.row-divider-type {
    border-left: 4px solid #64748b; background: #f8fafc;
}

.row-controls {
    display: grid; grid-template-columns: auto auto 1.5fr 2.5fr auto auto auto;
    gap: 10px; align-items: center;
}
.row-divider-type .row-controls {
    grid-template-columns: auto auto 4fr auto;
}

.field-label-hint { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; display: inline-block; }
.smart-icon-indicator { font-size: 20px; text-align: center; min-width: 28px; }

/* 📉 File Size Tracker Notification Badges */
.file-status-msg {
    font-size: 11px; color: #059669; font-weight: 600; padding: 6px 12px;
    background: #ecfdf5; border-radius: 6px; border: 1px solid #a7f3d0;
    margin-top: 4px; display: inline-block; width: fit-content;
}
.file-status-msg.error-alert {
    color: #dc2626 !important; background: #fef2f2 !important; border-color: #fca5a5 !important;
}

.btn-icon {
    font-size: 14px; padding: 12px; border-radius: 10px; background: #f8fafc;
    border: 1px solid var(--border); cursor: pointer; transition: all 0.15s ease;
}
.btn-icon:hover { background: #e2e8f0; }

.pin-star-btn.star-active { background: #fef3c7; color: #d97706; border-color: #fcd34d; }
.remove-node-btn { background: #fee2e2; color: #ef4444; border: 1px solid #fca5a5; }
.remove-node-btn:hover { background: #ef4444; color: white; }

.file-picker-wrapper { position: relative; display: inline-block; width: auto; height: auto; }
.file-picker-wrapper input[type="file"] { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }

.add-node-btn { 
    width: 100%; margin-top: 18px; padding: 14px; border: 2px dashed var(--accent); 
    background: #ffffff; color: var(--accent); font-weight: 700; cursor: pointer;
}
.add-node-btn:hover { background: rgba(37, 99, 235, 0.04); }

.upload-zone {
    border: 2px dashed var(--border); padding: 24px; border-radius: 12px;
    text-align: center; background: #f8fafc; position: relative; overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover { border-color: var(--accent); background: #f1f5f9; }
.upload-zone input[type="file"] { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }

.action-row { display: flex; margin-top: 16px; border-top: 1px solid var(--border); padding-top: 24px; }
button { font-family: inherit; font-size: 14px; font-weight: 700; border-radius: 10px; transition: all 0.2s ease; cursor: pointer; }

.btn-primary { 
    background-color: var(--accent); color: white; flex-grow: 1; padding: 18px; 
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); border: none;
}
.btn-primary:hover { background-color: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3); }
.btn-primary:disabled { background-color: #cbd5e1; color: #94a3b8; box-shadow: none; cursor: not-allowed; }