/* ============================================================================
 * WORKSPACE.CSS — TOP BAR, IFRAME STAGE ISOLATO & BOTTOM DOCK 4 AZIONI
 * Progettato per 320px -> 440px+, 60/120 FPS, ZERO ellipsis, SafeArea totale
 * ============================================================================ */

.workspace-screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.top-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 54px;
  padding: calc(max(8px, var(--safe-top))) 10px 8px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 200;
}

.top-bar-left,
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.top-bar-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}

.page-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  font: 700 0.84rem/1.2 inherit;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.icon-pill-btn {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-pill-btn[aria-pressed="false"] {
  border-color: var(--accent-gold);
  background: rgba(229, 169, 60, 0.16);
}

.publish-pill-btn {
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.16);
  color: #6EE7B7;
  font: 800 0.82rem/1.2 inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.publish-pill-btn.has-pending {
  border-color: var(--accent-gold);
  background: var(--accent-gold);
  color: #080D14;
}

.page-dropdown {
  position: fixed;
  top: calc(max(8px, var(--safe-top)) + 52px);
  left: 10px;
  z-index: 500;
  min-width: 210px;
  max-width: calc(100vw - 20px);
  padding: 6px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-drop-item {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font: 600 0.9rem/1.25 inherit;
  text-align: left;
  cursor: pointer;
}

.page-drop-item.is-active {
  background: rgba(229, 169, 60, 0.18);
  color: var(--accent-gold-light);
}

.mode-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(229, 169, 60, 0.14);
  border-bottom: 1px solid var(--border-accent);
  font-size: 0.82rem;
  color: var(--accent-gold-light);
}

.mode-banner-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent-gold);
  background: var(--accent-gold);
  color: #080D14;
  font: 700 0.82rem/1.2 inherit;
  cursor: pointer;
}

/* ---- STAGE IFRAME NATIVO (100% WIDTH/HEIGHT, ZERO TRANSFORM SCALE) ---- */
.preview-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  background: #0B1319;
}

.preview-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0B1319;
}

.preview-loader {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg-deep);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent-gold);
  animation: lss-spin 0.75s linear infinite;
}

@keyframes lss-spin {
  to { transform: rotate(360deg); }
}

/* ---- BOTTOM DOCK 4 AZIONI (SAFE AREA BARRA HOME + ZERO ELLIPSIS A 320px) ---- */
.bottom-dock {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 6px 8px calc(max(12px, var(--safe-bottom)));
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  z-index: 200;
}

.dock-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  height: auto;
  padding: 6px 2px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  cursor: pointer;
}

.dock-btn:active {
  background: var(--bg-elevated);
}

.dock-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.dock-label {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--text-muted);
}

.dock-dot {
  position: absolute;
  top: 6px;
  right: calc(50% - 16px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-red);
  border: 2px solid var(--bg-surface);
}

@media (max-width: 360px) {
  .top-bar { padding-left: 6px; padding-right: 6px; gap: 4px; }
  .top-bar-logo { width: 22px; height: 22px; }
  .top-bar-left, .top-bar-right { gap: 4px; }
  .page-pill-btn { padding: 6px 8px; font-size: 0.78rem; }
  .publish-pill-btn { padding: 6px 9px; font-size: 0.76rem; }
  .dock-label { font-size: 0.72rem; }
}
