* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: #0c0c0c; color: #e0e0e0; display: flex; height: 100vh; overflow: hidden; }

/* ====== Scrollbar ====== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ====== Sidebar ====== */
#sidebar { width: 280px; min-width: 280px; background: #111; border-right: 1px solid #222; display: flex; flex-direction: column; overflow: hidden; }
#sidebar-header { padding: 12px 16px; border-bottom: 1px solid #222; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
#sidebar-header h1 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
#sidebar-header h1 .logo-icon { color: #a3e635; }
.badge { font-size: 9px; background: #1a2a10; color: #a3e635; padding: 2px 8px; border-radius: 4px; border: 1px solid #2a4a1a; text-transform: uppercase; letter-spacing: 0.5px; }

#site-search-wrap { padding: 8px; border-bottom: 1px solid #1a1a1a; flex-shrink: 0; }
#site-search { width: 100%; background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 6px; padding: 7px 10px; color: #ccc; font-size: 11px; outline: none; }
#site-search:focus { border-color: #a3e635; }

#container-list { padding: 6px; overflow-y: auto; flex: 1; }
#sidebar-footer { flex-shrink: 0; border-top: 1px solid #1a1a1a; }

.container-item { background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 8px; padding: 9px 12px; margin-bottom: 5px; cursor: pointer; transition: all 0.12s; }
.container-item:hover { border-color: #3a3a3a; background: #1e1e1e; }
.container-item.active { border-color: #a3e635; background: #1a2a10; }
.container-item .name-row { display: flex; justify-content: space-between; align-items: center; }
.container-name { font-size: 13px; font-weight: 600; color: #fff; }
.container-type { font-size: 8px; background: #1a1a1a; padding: 1px 5px; border-radius: 3px; color: #666; }
.container-item .meta-row { font-size: 10px; color: #555; display: flex; gap: 8px; margin-top: 3px; }
.container-item .meta-row .status { display: flex; align-items: center; gap: 3px; }
.container-item .meta-row .status.online { color: #22c55e; }
.container-item .meta-row .status.offline { color: #ef4444; }
.container-item .source-badge { font-size: 8px; background: #1a1a2a; color: #60a5fa; padding: 1px 5px; border-radius: 3px; }

.loading { text-align: center; padding: 40px 20px; color: #555; font-size: 13px; }
.loading .spinner { width: 24px; height: 24px; border: 2px solid #2a2a2a; border-top-color: #a3e635; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ====== Main area ====== */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ====== Toolbar ====== */
#toolbar { background: #111; border-bottom: 1px solid #222; padding: 5px 10px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; min-height: 38px; flex-shrink: 0; }
#project-name { font-size: 13px; font-weight: 600; color: #fff; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
#toolbar button { background: #1a1a1a; border: 1px solid #2a2a2a; color: #ccc; padding: 4px 10px; border-radius: 5px; font-size: 11px; cursor: pointer; transition: all 0.12s; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
#toolbar button:hover { background: #2a2a2a; border-color: #3a3a3a; color: #fff; }
#toolbar button.primary { background: #a3e635; color: #0c0c0c; font-weight: 600; border-color: #a3e635; }
#toolbar button.primary:hover { background: #84cc16; }
#toolbar button.primary:disabled { opacity: 0.35; cursor: not-allowed; }
.sep { width: 1px; height: 18px; background: #2a2a2a; margin: 0 3px; flex-shrink: 0; }
#status-msg { font-size: 10px; color: #555; margin-left: 6px; white-space: nowrap; }

/* ====== Mode tabs ====== */
#mode-tabs { display: flex; gap: 2px; }
.mode-btn { font-size: 11px !important; padding: 3px 10px !important; border-radius: 4px !important; }
.mode-btn.active { background: #2a3a1a !important; border-color: #4a6a2a !important; color: #a3e635 !important; }

/* ====== Content area ====== */
#content-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.mode-content { display: none; flex: 1; overflow: hidden; }
.mode-content.active { display: flex; }

/* ====== Visual Mode ====== */
#visual-panel { flex: 1; display: flex; overflow: hidden; }

/* Visual inspector */
#visual-inspector { width: 300px; min-width: 300px; background: #0e0e0e; border-right: 1px solid #222; display: flex; flex-direction: column; overflow: hidden; }
.inspector-header { padding: 8px 12px; background: #111; border-bottom: 1px solid #222; display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.ins-badge { font-size: 9px; background: #1a1a1a; padding: 1px 6px; border-radius: 3px; color: #888; }

#ins-status-bar { padding: 6px 8px; border-bottom: 1px solid #1a1a1a; display: flex; align-items: center; gap: 6px; flex-shrink: 0; font-size: 10px; }
.ins-btn { padding: 3px 8px; border-radius: 4px; cursor: pointer; background: #1a1a1a; border: 1px solid #2a2a2a; color: #888; font-size: 10px; }
.ins-btn:hover { background: #252525; }
.ins-btn.active { background: #1a2a10; border-color: #4a6a2a; color: #a3e635; }
.sep-h { width: 1px; height: 14px; background: #2a2a2a; }
#ins-element-path { color: #60a5fa; font-family: monospace; font-size: 9px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#ins-element-info { padding: 8px; overflow-y: auto; flex: 1; }
.ins-placeholder { text-align: center; padding: 30px 10px; color: #444; font-size: 11px; line-height: 1.6; }

#ins-properties { padding: 8px; overflow-y: auto; flex: 1; }
.ins-section { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #1a1a1a; }
.ins-section:last-child { border-bottom: none; }
.ins-section-title { font-size: 10px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.ins-field { margin-bottom: 6px; }
.ins-field label { display: block; font-size: 9px; color: #555; margin-bottom: 2px; }
.ins-field input[type="text"],
.ins-field input[type="number"],
.ins-field select { width: 100%; background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 4px; padding: 5px 7px; color: #ccc; font-size: 11px; outline: none; }
.ins-field input:focus,
.ins-field select:focus { border-color: #a3e635; }
.ins-field input[type="color"] { width: 100%; height: 32px; background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 4px; cursor: pointer; padding: 2px; }
.ins-field-row { display: flex; gap: 6px; }
.ins-field.half { flex: 1; }
.range-wrap { display: flex; align-items: center; gap: 6px; }
.range-wrap input[type="range"] { flex: 1; accent-color: #a3e635; }
.range-wrap span { font-size: 10px; color: #888; min-width: 35px; text-align: right; }

.ins-apply { width: 100%; background: #2a3a1a; border: 1px solid #4a6a2a; color: #a3e635; padding: 6px; border-radius: 5px; font-size: 10px; cursor: pointer; font-weight: 600; margin-top: 4px; }
.ins-apply:hover { background: #3a4a2a; }

.ins-info-line { font-size: 10px; color: #666; padding: 2px 0; }
.ins-info-line span { color: #aaa; font-family: monospace; }

#ins-css-output { display: none; }
#ins-css-output.show { display: block; }

/* Visual preview */
#visual-preview { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#visual-preview-header { background: #111; border-bottom: 1px solid #1a1a1a; padding: 5px 10px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; font-size: 10px; color: #666; }
#vp-status { font-size: 10px; color: #888; }
#vp-edit-indicator { font-size: 9px; padding: 1px 6px; border-radius: 3px; }
#vp-edit-indicator.editing { background: #1a3a1a; color: #84cc16; }
#vp-edit-indicator.idle { background: #1a1a1a; color: #666; }

.toggle-wrap { display: flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.toggle-slider { width: 28px; height: 14px; background: #333; border-radius: 7px; position: relative; transition: all 0.15s; }
.toggle-slider::after { content: ''; position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #888; top: 2px; left: 2px; transition: all 0.15s; }
.toggle-wrap input:checked + .toggle-slider { background: #2a5a1a; }
.toggle-wrap input:checked + .toggle-slider::after { background: #a3e635; left: 16px; }
.toggle-wrap input { display: none; }
.toggle-label { font-size: 10px; color: #888; }

#vp-preview-wrap { flex: 1; position: relative; overflow: hidden; background: #fff; }
#vp-frame { width: 100%; height: 100%; border: none; }
#vp-overlay { position: absolute; inset: 0; background: transparent; z-index: 10; cursor: crosshair; transition: background 0.15s; }
#vp-overlay:not(.hidden) { background: rgba(0,0,0,0.03); }
#vp-overlay.hidden { pointer-events: none; }
.vp-overlay-hint { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.75); color: #a3e635; padding: 6px 14px; border-radius: 6px; font-size: 11px; white-space: nowrap; backdrop-filter: blur(4px); pointer-events: none; }

/* Hover highlight element on preview */
.vp-highlight { outline: 2px solid #a3e635 !important; outline-offset: 2px !important; background: rgba(163, 230, 53, 0.08) !important; }
.vp-selected { outline: 2px solid #60a5fa !important; outline-offset: 2px !important; background: rgba(96, 165, 250, 0.1) !important; }

#vp-load-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #1a1a1a; border: 1px solid #333; color: #ccc; padding: 10px 24px; border-radius: 8px; cursor: pointer; font-size: 13px; z-index: 5; }
#vp-load-btn:hover { background: #252525; }

/* ====== Code Mode ====== */
#code-view { flex: 1; display: flex; overflow: hidden; }
#file-panel { width: 200px; min-width: 200px; background: #0e0e0e; border-right: 1px solid #222; overflow-y: auto; padding: 6px; }
#file-panel .file-item { display: flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 4px; cursor: pointer; font-size: 11px; color: #888; transition: all 0.08s; }
#file-panel .file-item:hover { background: #1a1a1a; color: #ccc; }
#file-panel .file-item.active { background: #1a2a10; color: #a3e635; }
#file-panel .file-item .ext { font-size: 8px; background: #1a1a1a; padding: 1px 4px; border-radius: 3px; color: #555; margin-left: auto; }
#file-panel .file-section { font-size: 9px; font-weight: 600; color: #444; text-transform: uppercase; letter-spacing: 1px; padding: 10px 7px 4px; }

#editor-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tab-bar { height: 30px; background: #0e0e0e; border-bottom: 1px solid #222; display: flex; align-items: center; padding: 0 8px; gap: 2px; flex-shrink: 0; }
.tab-bar .tab { font-size: 11px; background: transparent; border: none; color: #555; padding: 4px 12px; border-radius: 4px 4px 0 0; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.1s; }
.tab-bar .tab:hover { color: #999; }
.tab-bar .tab.active { color: #a3e635; background: #111; border-bottom-color: #a3e635; }
.tab-content { flex: 1; display: none; min-height: 0; }
.tab-content.active { display: flex; flex-direction: column; }
#editor-container { flex: 1; min-height: 0; }
#preview-container { flex: 1; min-height: 0; }
#preview-container iframe { width: 100%; height: 100%; border: none; background: #fff; }

/* ====== Preview Only Mode ====== */
.full-preview-wrap { flex: 1; background: #fff; }
.full-preview-wrap iframe { width: 100%; height: 100%; border: none; }

/* ====== Deploy Modal ====== */
#deploy-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 999; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
#deploy-modal.show { display: flex; }
#deploy-modal .modal { background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 10px; padding: 20px; max-width: 650px; width: 92%; max-height: 80vh; display: flex; flex-direction: column; }
#deploy-modal h2 { font-size: 15px; color: #fff; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
#deploy-modal .log { background: #0c0c0c; border: 1px solid #222; border-radius: 6px; padding: 10px; font-family: 'Courier New', monospace; font-size: 10px; color: #888; white-space: pre-wrap; overflow-y: auto; flex: 1; min-height: 120px; max-height: 350px; margin-bottom: 12px; line-height: 1.5; }
#deploy-modal .close-btn { background: #2a2a2a; border: none; color: #ccc; padding: 7px 18px; border-radius: 5px; cursor: pointer; font-size: 12px; align-self: flex-end; }
#deploy-modal .close-btn:hover { background: #3a3a3a; }

/* ====== Toast ====== */
.toast { position: fixed; bottom: 20px; right: 20px; background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 6px; padding: 10px 16px; font-size: 12px; color: #ccc; box-shadow: 0 6px 20px rgba(0,0,0,0.5); transform: translateY(80px); opacity: 0; transition: all 0.25s; z-index: 1000; pointer-events: none; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: #a3e635; }
.toast.error { border-color: #f87171; }
.toast.saving { border-color: #60a5fa; }
