/**
 * Artifact Renderer v2.0 — Styles
 * Slide-in panel with responsive preview, edit panel, and actions
 */

/* ── Panel Container ── */
.art-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 50%;
  height: 100vh;
  background: var(--bg-elevated, #1a1a2e);
  border-left: 1px solid var(--border, #2d2d44);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
}
.art-panel.visible {
  transform: translateX(0);
}

/* ── Header ── */
.art-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-secondary, #16162a);
  border-bottom: 1px solid var(--border, #2d2d44);
  flex-shrink: 0;
  gap: 8px;
}
.art-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.art-header-center {
  flex-shrink: 0;
}
.art-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.art-icon { font-size: 18px; }
.art-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #e0e0e0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.art-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent, #6366f1);
  background: var(--accent-dim, rgba(99, 102, 241, 0.15));
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ── Viewport Toggle ── */
.art-viewport-toggle {
  display: flex;
  background: var(--bg-tertiary, #1e1e38);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
.art-vp-btn {
  width: 32px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text3, #666);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.art-vp-btn:hover { color: var(--text, #e0e0e0); background: var(--bg-secondary, #16162a); }
.art-vp-btn.active { color: var(--accent, #6366f1); background: var(--bg, #0f0f23); }

/* ── Action Buttons ── */
.art-action-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border, #2d2d44);
  background: transparent;
  color: var(--text2, #999);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.art-action-btn:hover {
  background: var(--bg-tertiary, #1e1e38);
  color: var(--text, #e0e0e0);
  border-color: var(--text3, #666);
}
.art-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ── Body ── */
.art-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--bg, #0f0f23);
}

/* ── Iframe Wrap ── */
.art-iframe-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #f8fafc;
  border-radius: 0;
  transition: max-width 0.3s ease;
}
.art-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

/* ── Loading ── */
.art-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg, #0f0f23);
  color: var(--text2, #999);
  font-size: 14px;
  z-index: 10;
}
.art-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border, #2d2d44);
  border-top-color: var(--accent, #6366f1);
  border-radius: 50%;
  animation: art-spin 0.8s linear infinite;
}
@keyframes art-spin { to { transform: rotate(360deg); } }

/* ── Edit Panel ── */
.art-edit-panel {
  width: 280px;
  flex-shrink: 0;
  flex-direction: column;
  background: var(--bg-secondary, #16162a);
  border-left: 1px solid var(--border, #2d2d44);
  padding: 12px;
  gap: 10px;
}
.art-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #e0e0e0);
  margin-bottom: 8px;
}
.art-edit-close {
  background: none;
  border: none;
  color: var(--text3, #666);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}
.art-edit-close:hover { color: var(--text, #e0e0e0); }
.art-edit-input {
  width: 100%;
  min-height: 80px;
  background: var(--bg, #0f0f23);
  border: 1px solid var(--border, #2d2d44);
  border-radius: 8px;
  color: var(--text, #e0e0e0);
  font-size: 13px;
  font-family: inherit;
  padding: 10px;
  resize: vertical;
  outline: none;
}
.art-edit-input:focus { border-color: var(--accent, #6366f1); }
.art-edit-input::placeholder { color: var(--text3, #666); }
.art-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.art-edit-submit {
  background: var(--accent, #6366f1);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.art-edit-submit:hover { filter: brightness(1.1); transform: translateY(-1px); }
.art-edit-hint { font-size: 11px; color: var(--text3, #666); }
.art-edit-history { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.art-edit-item {
  font-size: 11px;
  color: var(--text2, #999);
  padding: 6px 8px;
  background: var(--bg, #0f0f23);
  border-radius: 4px;
  line-height: 1.4;
}
.art-edit-ver {
  font-weight: 600;
  color: var(--accent, #6366f1);
  margin-right: 4px;
}
.art-edit-time { color: var(--text3, #666); float: right; }

/* ── Footer ── */
.art-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-secondary, #16162a);
  border-top: 1px solid var(--border, #2d2d44);
  flex-shrink: 0;
}
.art-status { font-size: 12px; color: var(--text2, #999); }
.art-meta { font-size: 11px; color: var(--text3, #666); }

/* ── Toast ── */
.art-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated, #1a1a2e);
  color: var(--text, #e0e0e0);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border, #2d2d44);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10000;
}
.art-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .art-panel { width: 100%; }
  .art-edit-panel { width: 240px; }
}
@media (max-width: 768px) {
  .art-edit-panel { display: none !important; }
  .art-header-center { display: none; }
}

/* ── Fullscreen ── */
.art-panel:fullscreen {
  width: 100%;
  transform: none;
}
.art-panel:fullscreen .art-iframe-wrap {
  max-width: 100% !important;
}
