:root {
    --bg-base: #0f1115; --bg-panel: #1a1d24; --bg-surface: #272b36; --border-color: #363b49;
    --accent: #3b82f6; --accent-hover: #2563eb; --danger: #ef4444; --text-main: #f3f4f6;
    --text-muted: #9ca3af; --radius: 8px; --font-family: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: var(--font-family); background-color: var(--bg-base); color: var(--text-main); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* UI Layout */
header { height: 60px; background-color: var(--bg-panel); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
main { display: flex; flex: 1; overflow: hidden; }
.controls-panel { width: 340px; background-color: var(--bg-panel); border-right: 1px solid var(--border-color); padding: 24px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }
.preview-panel { flex: 1; padding: 40px; background-color: var(--bg-base); overflow-y: auto; display: flex; flex-direction: column; align-items: center; }

/* Buttons & Inputs */
button { background-color: var(--bg-surface); color: var(--text-main); border: 1px solid var(--border-color); padding: 8px 16px; border-radius: var(--radius); font-size: 0.85rem; cursor: pointer; transition: 0.2s; }
button:hover { background-color: #3a3a3a; }
button.primary { background-color: var(--accent); border-color: var(--accent); color: white; }
button.primary:hover { background-color: var(--accent-hover); }
button.danger-btn { background-color: transparent; border-color: var(--danger); color: var(--danger); width: 100%; }
button.danger-btn:hover { background-color: var(--danger); color: white; }
.mt-2 { margin-top: 8px; }

/* Control Groups & Selects */
.control-group { display: flex; flex-direction: column; gap: 12px; }
.control-group h3 { font-size: 0.8rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 1px; }
.box-actions { display: flex; gap: 8px; }
.box-actions button { flex: 1; }
.divider { border: 0; height: 1px; background: var(--border-color); margin: 5px 0; }
.hidden { display: none !important; }

.slider-wrapper { display: flex; flex-direction: column; gap: 8px; }
.slider-header { display: flex; justify-content: space-between; font-size: 0.85rem; }
.slider-value { color: var(--accent); font-weight: 600; }
input[type="range"] { -webkit-appearance: none; width: 100%; height: 6px; background: var(--bg-surface); border-radius: 4px; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; }

.select-group { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; margin-bottom: 8px;}
select { background: var(--bg-surface); color: var(--text-main); border: 1px solid var(--border-color); padding: 4px 8px; border-radius: 4px; outline: none; }

.color-picker-wrapper { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
input[type="color"] { background: none; border: none; cursor: pointer; height: 30px; width: 50px; border-radius: 4px; }
.property-tag { background: var(--bg-surface); padding: 6px 12px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-align: center; }
.button-options-wrapper { background: rgba(0,0,0,0.2); padding: 10px; border-radius: var(--radius); border: 1px dashed var(--border-color); }

/* Live Preview Grid */
.preview-container { width: 100%; max-width: 1200px; background-color: transparent; min-height: 400px; display: grid; grid-template-columns: repeat(12, 1fr); align-content: start; }
.helper-text { margin-top: 20px; font-size: 0.85rem; color: var(--text-muted); }

/* Boxes */
.preview-box { border: 1px solid var(--border-color); border-radius: var(--radius); cursor: grab; user-select: none; position: relative; transition: border 0.2s, box-shadow 0.2s, transform 0.1s; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #111; }
.preview-box.selected { border: 2px solid var(--accent); box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2); z-index: 10; }
.preview-box:active { cursor: grabbing; }
.preview-box.dragging { opacity: 0.5; transform: scale(0.98); z-index: 100; }

/* Drag & Drop Visuals */
.preview-box::after { content: ''; position: absolute; inset: 0; pointer-events: none; transition: 0.2s; }
.preview-box.drop-merge::after { background: rgba(59, 130, 246, 0.3); border: 2px dashed var(--accent); }
.preview-box.drop-left::after { border-left: 4px solid var(--accent); background: linear-gradient(90deg, rgba(59,130,246,0.2) 0%, transparent 20%); }
.preview-box.drop-right::after { border-right: 4px solid var(--accent); background: linear-gradient(-90deg, rgba(59,130,246,0.2) 0%, transparent 20%); }

/* Special Preview Contents */
.box-content-standard { font-weight: 600; color: inherit; font-size: 0.9rem; pointer-events: none;}
.box-content-navbar { width: 100%; height: 100%; display: flex; align-items: center; padding: 0 20px; justify-content: space-between; font-weight: 600; pointer-events: none;}
.box-content-navbar .links { display: flex; gap: 15px; font-size: 0.8rem; opacity: 0.8; }
.box-content-hero { width: 100%; display: flex; flex-direction: column; justify-content: center; pointer-events: none; }
.box-content-media { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #e2e8f0; color: #64748b; font-size: 1.5rem; }
.box-content-buttons { width: 100%; display: flex; gap: 8px; padding: 20px; pointer-events: none; }
.btn-mock { padding: 8px 16px; font-size: 0.8rem; color: white; display: inline-block;}

/* New: Carousel & Accordion Preview Styling */
.box-content-carousel { width: 100%; height: 100%; display: flex; justify-content: space-between; align-items: center; background: #cbd5e1; padding: 0 20px; color: #475569; font-size: 2rem; pointer-events: none;}
.box-content-accordion { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 4px; padding: 20px; pointer-events: none; }
.accordion-mock-row { background: #e2e8f0; height: 30px; width: 100%; border-radius: 4px; border-left: 4px solid var(--accent); }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content { background: var(--bg-panel); width: 800px; max-width: 90%; border-radius: var(--radius); border: 1px solid var(--border-color); display: flex; flex-direction: column; box-shadow: 0 20px 40px rgba(0,0,0,0.4); }
.modal-header { padding: 16px 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 24px; display: flex; gap: 20px; flex-direction: column; max-height: 75vh; overflow-y: auto; }
.code-section { display: flex; flex-direction: column; gap: 8px; }
.code-section label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }

/* Adjusted textarea height to accommodate the 3rd box (JS) */
textarea { width: 100%; height: 120px; background-color: var(--bg-base); color: #a5b4fc; border: 1px solid var(--border-color); border-radius: var(--radius); padding: 12px; font-family: 'Courier New', monospace; font-size: 0.8rem; resize: vertical; outline: none; white-space: pre; }