/* panel-vista-previa.css: the live preview column (public/preview.js) and
   its drawer on narrower screens.
   Loaded right after the file before it; the order of every panel file is in
   panel-login.css. */

/* Live preview panel (public/preview.js): the owner's profile, framed at
   /<username>?preview=1, next to the form on wide screens and as a drawer
   over it on narrower ones. */
.preview-toggle-btn {
  height: 38px;
}

.preview-toggle-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.preview-toggle-btn[aria-expanded="true"] {
  border-color: var(--accent-color);
  background: rgba(225, 29, 72, 0.12);
}

.live-preview-panel {
  width: 400px;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 18px 20px;
  background: rgba(9, 10, 15, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--card-border);
}

.live-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.live-preview-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.live-preview-title h2 {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 800;
  margin: 0;
  white-space: nowrap;
}

.live-preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
  flex-shrink: 0;
}

.live-preview-actions {
  display: flex;
  gap: 6px;
}

.live-preview-icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.live-preview-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.live-preview-icon-btn svg {
  width: 18px;
  height: 18px;
}

.live-preview-hint {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.live-preview-device {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #000;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.live-preview-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.live-preview-device.is-loading .live-preview-loading {
  display: flex;
}

.live-preview-device.is-loading iframe {
  visibility: hidden;
}

.live-preview-device iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #08090c;
}

/* With the preview column open, two form columns only fit from 1600 px. */

@media (min-width: 1200px) and (max-width: 1599px) {
  body.live-preview-open .settings-grid-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Narrower screens: a drawer over the form, closed until opened. */

@media (max-width: 1199px) {
  .live-preview-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100%);
    z-index: 10001;
    box-shadow: -18px 0 40px rgba(0, 0, 0, 0.55);
  }
}

@media (max-width: 480px) {
  .live-preview-panel {
    padding: 14px 12px 16px;
  }

  .preview-toggle-btn span {
    display: none;
  }

  .preview-toggle-btn {
    padding: 10px;
  }
}
