/* ── Glass Floating Panels — Contextual property editors ── */

.pb-glass-panel {
  position: absolute;
  z-index: var(--pb-z-raised);
  background: var(--pb-surface);
  border-radius: var(--pb-radius-island);
  box-shadow: var(--pb-shadow-dropdown);
  font-family: inherit;
  font-size: var(--pb-font-sm);
  color: var(--pb-text);
  overflow: hidden;
  pointer-events: auto;
}

/* ── Header ── */

.pb-glass-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--pb-space-4) + var(--pb-space-1)) calc(var(--pb-space-4) + var(--pb-space-3));
  border-bottom: 1px solid var(--pb-border);
}

.pb-glass-panel-title {
  font-weight: 600;
  font-size: var(--pb-font-md);
  color: var(--pb-text-bright);
}

/* ── Element action buttons (Reset, Delete) ── */

.pb-glass-panel-actions {
  display: flex;
  align-items: center;
  gap: var(--pb-space-1);
}

.pb-glass-panel-action {
  background: none;
  border: none;
  padding: var(--pb-space-2);
  cursor: pointer;
  border-radius: var(--pb-radius);
  color: var(--pb-text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--pb-transition), background var(--pb-transition);
}

.pb-glass-panel-action:hover {
  color: var(--pb-text);
  background: var(--pb-surface-hover);
}

.pb-glass-panel-delete:hover {
  color: #ef4444;
}

.pb-glass-panel-action:focus-visible {
  outline: 2px solid var(--pb-accent);
  outline-offset: 2px;
}

.pb-glass-panel-close {
  background: none;
  border: none;
  font-size: var(--pb-font-2xl);
  color: var(--pb-text-dim);
  cursor: pointer;
  padding: 0 var(--pb-space-1);
  line-height: 1;
  border-radius: var(--pb-radius);
  transition: color var(--pb-transition), background var(--pb-transition);
}

.pb-glass-panel-close:hover {
  color: var(--pb-text);
  background: var(--pb-surface-hover);
}

.pb-glass-panel-close:active {
  color: var(--pb-text-bright);
  background: var(--pb-bg-hover);
}

.pb-glass-panel-close:focus-visible,
.pb-gp-segmented button:focus-visible,
.pb-gp-swatch:focus-visible,
.pb-gp-input:focus-visible,
.pb-gp-advanced summary:focus-visible,
.pb-gp-action-btn:focus-visible {
  outline: 2px solid var(--pb-accent);
  outline-offset: 2px;
}

/* ── Body ── */

.pb-glass-panel-body {
  padding: var(--pb-space-5) calc(var(--pb-space-4) + var(--pb-space-3));
  max-height: 400px;
  overflow-y: auto;
}

/* ── Field rows ── */

.pb-gp-field {
  margin-bottom: var(--pb-space-5);
}

.pb-gp-field-hidden {
  display: none;
}

.pb-gp-field:last-child {
  margin-bottom: 0;
}

.pb-gp-label {
  display: block;
  font-size: var(--pb-font-sm);
  font-weight: 600;
  color: var(--pb-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--pb-space-3);
}

.pb-gp-hint {
  display: block;
  font-size: var(--pb-font-xs);
  color: var(--pb-text-dim);
  margin-bottom: var(--pb-space-2);
  opacity: 0.7;
}

/* ── Segmented controls (pill toggles) ── */

.pb-gp-segmented {
  display: flex;
  background: var(--pb-surface-hover);
  border-radius: var(--pb-radius-lg);
  padding: var(--pb-space-1);
  gap: var(--pb-space-1);
}

.pb-gp-segmented-wrap { flex-wrap: wrap; }
.pb-gp-segmented-wrap button { flex: 0 0 auto; }

.pb-gp-segmented button {
  flex: 1;
  background: none;
  border: none;
  padding: var(--pb-space-3) var(--pb-space-4);
  font-size: var(--pb-font-base);
  font-family: inherit;
  color: var(--pb-text-dim);
  cursor: pointer;
  border-radius: var(--pb-radius-md);
  transition: background var(--pb-transition), color var(--pb-transition);
  white-space: nowrap;
}

.pb-gp-segmented button:hover {
  color: var(--pb-text);
}

.pb-gp-segmented button.pb-gp-active {
  background: var(--pb-surface);
  color: var(--pb-text-bright);
  font-weight: 600;
  box-shadow: var(--pb-shadow-panel);
}

/* ── Color swatches ── */

.pb-gp-swatches {
  display: flex;
  gap: var(--pb-space-4);
}

.pb-gp-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--pb-transition), transform var(--pb-transition);
  padding: 0;
  background: none;
}

.pb-gp-swatch:hover {
  transform: scale(1.1);
}

.pb-gp-swatch.pb-gp-active {
  border-color: var(--pb-accent);
}

.pb-gp-swatch-inner {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid var(--pb-border);
}

/* ── Text inputs ── */

.pb-gp-input {
  width: 100%;
  padding: var(--pb-space-3) calc(var(--pb-space-4) + var(--pb-space-1));
  font-size: var(--pb-font-md);
  font-family: inherit;
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-lg);
  background: var(--pb-surface-2);
  color: var(--pb-text-bright);
  outline: none;
  transition: border-color var(--pb-transition);
  box-sizing: border-box;
}

.pb-gp-input:focus {
  border-color: var(--pb-accent);
}

/* ── Inline row (label + control side by side) ── */

.pb-gp-inline {
  display: flex;
  align-items: center;
  gap: var(--pb-space-4);
}

.pb-gp-inline .pb-gp-label {
  margin-bottom: 0;
  min-width: 50px;
}

.pb-gp-inline .pb-gp-segmented {
  flex: 1;
}

/* ── Advanced accordion ── */

.pb-gp-advanced {
  border-top: 1px solid var(--pb-border);
  margin-top: var(--pb-space-4);
  padding-top: 0;
}

.pb-gp-advanced summary {
  padding: calc(var(--pb-space-4) + var(--pb-space-1)) 0;
  font-size: var(--pb-font-base);
  font-weight: 600;
  color: var(--pb-text-dim);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--pb-space-2);
  user-select: none;
}

.pb-gp-advanced summary::before {
  content: '\25B6';
  font-size: 8px;
  transition: transform var(--pb-transition);
}

.pb-gp-advanced[open] summary::before {
  transform: rotate(90deg);
}

.pb-gp-advanced-body {
  padding-bottom: var(--pb-space-2);
}

/* ── Action buttons (Replace, Stock Photo, etc.) ── */

.pb-gp-action-btn {
  flex: 1;
  padding: var(--pb-space-3) var(--pb-space-5);
  font-size: var(--pb-font-base);
  font-family: inherit;
  font-weight: 500;
  background: var(--pb-surface-hover);
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-lg);
  color: var(--pb-text);
  cursor: pointer;
  transition: background var(--pb-transition), border-color var(--pb-transition);
}

.pb-gp-action-btn:hover {
  background: var(--pb-surface-2);
  border-color: var(--pb-accent-subtle);
}

/* ── Image panel modernization (scoped) ── */

.pb-glass-panel--image .pb-glass-panel-header {
  padding: var(--pb-space-4) var(--pb-space-5) var(--pb-space-3);
  border-bottom: none;
}

.pb-glass-panel--image .pb-glass-panel-title {
  font-size: var(--pb-font-4xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
}

.pb-glass-panel--image .pb-glass-panel-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-lg);
  font-size: 20px;
  padding: 0;
}

.pb-glass-panel--image .pb-glass-panel-body {
  padding: 0 var(--pb-space-5) var(--pb-space-5);
}

.pb-glass-panel--image .pb-gp-media-thumb {
  position: relative;
  min-height: 120px;
  border-radius: var(--pb-radius-island);
  background: var(--pb-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--pb-space-4);
}

.pb-glass-panel--image #pb-gp-img-thumb {
  width: 100%;
  min-height: 120px;
  max-height: 180px;
  object-fit: cover;
  display: block;
}

.pb-glass-panel--image .pb-gp-media-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, var(--pb-bg) 0%, var(--pb-surface-hover) 45%, var(--pb-bg) 100%);
  background-size: 200% 100%;
  animation: pb-gp-skeleton 1.4s linear infinite;
  z-index: 1;
}

.pb-glass-panel--image .pb-gp-media-skeleton-hidden {
  display: none;
}

.pb-glass-panel--image .pb-gp-media-thumb-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--pb-space-3);
  padding: var(--pb-space-3);
  background: linear-gradient(to top, rgba(17, 24, 39, 0.6), rgba(17, 24, 39, 0));
  z-index: 2;
}

.pb-glass-panel--image .pb-gp-media-thumb-actions .pb-gp-action-btn {
  border: none;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.95);
  color: var(--pb-text-bright);
}

.pb-glass-panel--image .pb-gp-media-thumb-actions .pb-gp-action-btn:hover {
  background: #fff;
}

.pb-glass-panel--image .pb-gp-media-thumb-actions .pb-gp-action-btn-secondary {
  background: rgba(17, 24, 39, 0.82);
  color: #fff;
}

.pb-glass-panel--image .pb-gp-media-thumb-actions .pb-gp-action-btn-secondary:hover {
  background: rgba(17, 24, 39, 0.92);
}

.pb-glass-panel--image .pb-gp-field-flat {
  margin-bottom: var(--pb-space-6);
}

.pb-glass-panel--image .pb-gp-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--pb-font-md);
  color: var(--pb-text-bright);
  margin-bottom: var(--pb-space-3);
}

.pb-glass-panel--image .pb-gp-segmented {
  border-radius: var(--pb-radius-pill);
  background: var(--pb-bg);
  padding: 2px;
  gap: 0;
}

.pb-glass-panel--image .pb-gp-segmented button {
  border-radius: var(--pb-radius-pill);
  background: transparent;
  border: none;
  color: var(--pb-text);
}

.pb-glass-panel--image .pb-gp-segmented button.pb-gp-active {
  background: var(--pb-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 600;
  color: var(--pb-text-bright);
}

.pb-glass-panel--image .pb-gp-segmented button:hover:not(.pb-gp-active) {
  background: var(--pb-surface-hover);
}

.pb-glass-panel--image .pb-gp-input {
  border-radius: var(--pb-radius-lg);
  background: var(--pb-bg);
}

.pb-glass-panel--image .pb-gp-link-input {
  margin-top: var(--pb-space-3);
}

.pb-glass-panel--image .pb-gp-advanced-image {
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius-island);
  margin-top: 0;
  overflow: hidden;
}

.pb-glass-panel--image .pb-gp-advanced-image summary {
  padding: var(--pb-space-4);
}

.pb-glass-panel--image .pb-gp-advanced-image .pb-gp-advanced-body {
  padding: 0 var(--pb-space-4) var(--pb-space-4);
}

.pb-gp-icon-tint-note {
  font-size: var(--pb-font-xs);
  color: var(--pb-text-dim);
  background: var(--pb-accent-muted);
  padding: var(--pb-space-3) var(--pb-space-4);
  border-radius: var(--pb-radius-lg);
  margin-bottom: var(--pb-space-5);
  line-height: 1.4;
}

@keyframes pb-gp-skeleton {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ── Toggle (Yes/No) ── */

.pb-gp-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
  .pb-glass-panel,
  .pb-gp-segmented button,
  .pb-gp-swatch {
    transition: none;
  }

  .pb-glass-panel--image .pb-gp-media-skeleton {
    animation: none;
  }
}
