/* Claude-Style Artifact / Live Preview Canvas */
.canvas-panel {
  width: 0;
  overflow: hidden;
  background: #17181a;
  border-right: 1px solid transparent;
  display: flex;
  flex-direction: column;
  transition: width 0.34s var(--spring), border-color 0.25s;
  z-index: 85;
}
.canvas-panel.open {
  width: 50%;
  min-width: 400px;
  border-right-color: var(--border-strong);
}
.canvas-header {
  padding: 10px 14px;
  background: #1e1f20;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.canvas-tabs {
  display: inline-flex;
  background: #131314;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.canvas-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
.canvas-tab.active { background: var(--bg-surface-2); color: #fff; font-weight: 600; }

.canvas-viewport-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #141517;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.vp-btns { display: flex; gap: 4px; }
.vp-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 11.5px;
  cursor: pointer;
}
.vp-btn.active { background: var(--bg-surface-2); border-color: var(--border); color: var(--accent); }

.canvas-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  background: #0d0e10;
}
.canvas-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  display: none;
  transition: width 0.25s var(--spring);
}
.canvas-iframe.active { display: block; }
.canvas-iframe.tablet { width: 768px; max-width: 100%; border-left: 1px solid var(--border-strong); border-right: 1px solid var(--border-strong); }
.canvas-iframe.mobile { width: 390px; max-width: 100%; border-left: 1px solid var(--border-strong); border-right: 1px solid var(--border-strong); }

.canvas-editor {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 16px;
  background: #0d0e10;
  color: #d7e3fc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  direction: ltr;
  text-align: left;
  display: none;
  tab-size: 2;
}
.canvas-editor.active { display: block; }

.canvas-footer {
  padding: 10px 14px;
  background: #1e1f20;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

/* VPS Live Resource Monitor Dashboard */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.metric-card {
  background: #141517;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.metric-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }
.metric-val { font-size: 22px; font-weight: 700; color: #fff; direction: ltr; text-align: right; }
.metric-bar-bg { height: 7px; border-radius: 6px; background: rgba(255,255,255,0.08); overflow: hidden; }
.metric-bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #4285f4, #81c995); transition: width 0.4s var(--spring); }
.metric-bar-fill.high { background: linear-gradient(90deg, #fdd663, #f28b82); }
.metric-sub { font-size: 11px; color: var(--text-muted); direction: ltr; text-align: right; }

.service-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.service-row {
  background: #141517;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.service-name { font-family: ui-monospace, monospace; direction: ltr; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* SFTP File Explorer & Remote Code Editor */
.sftp-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.sftp-list {
  max-height: 310px;
  overflow-y: auto;
  background: #131416;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sftp-row {
  padding: 8px 10px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.14s;
}
.sftp-row:hover { background: rgba(255, 255, 255, 0.06); }
.sftp-name { display: flex; align-items: center; gap: 8px; direction: ltr; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sftp-meta { font-size: 11px; color: var(--text-muted); font-family: ui-monospace, monospace; flex-shrink: 0; }
.sftp-editor-wrap { display: none; flex-direction: column; gap: 10px; }
.sftp-editor-wrap.open { display: flex; }
.sftp-textarea {
  width: 100%;
  height: 320px;
  background: #0b0c0e;
  color: #d7e3fc;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  direction: ltr;
  text-align: left;
  outline: none;
  resize: vertical;
}

/* Interactive SSH Terminal */
.term-quick-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.term-chip {
  background: #141517;
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-family: ui-monospace, monospace;
  cursor: pointer;
}
.term-chip:hover { background: var(--bg-surface-2); }
.term-out {
  background: #0a0b0d;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #c4d7f5;
  height: 270px;
  overflow-y: auto;
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 450;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 95vw; max-height: 92dvh; border-radius: 14px; }

@media (max-width: 920px) {
  .canvas-panel.open {
    position: fixed;
    inset: 0;
    width: 100%;
    min-width: 0;
    z-index: 240;
  }
  .metrics-grid { grid-template-columns: 1fr; }
}
