/* InSec+ — Gerätevorschau (Entwickler / ACP) */

html.insec-device-preview-parent-active {
  overflow: hidden;
}

html.insec-device-preview-parent-active body {
  overflow: hidden;
}

.insec-device-preview-shell {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  background: #0a0e14;
  color: #e8ecf2;
}

.insec-device-preview-shell.hidden {
  display: none !important;
}

.insec-device-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 18, 28, 0.96);
  flex-shrink: 0;
}

.insec-device-preview-toolbar__title {
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  margin: 0;
  white-space: nowrap;
}

.insec-device-preview-toolbar__meta {
  font-size: 0.75rem;
  color: #8b9cb3;
  margin: 0;
  white-space: nowrap;
}

.insec-device-preview-toolbar__group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.insec-device-preview-toolbar label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #a8b8cc;
}

.insec-device-preview-toolbar select,
.insec-device-preview-toolbar input[type="number"] {
  font-size: 0.78rem;
  padding: 0.28rem 0.45rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
}

.insec-device-preview-toolbar input[type="number"] {
  width: 4.5rem;
}

.insec-device-preview-zoom-btn {
  font-size: 0.74rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  cursor: pointer;
}

.insec-device-preview-zoom-btn.is-active {
  background: rgba(74, 158, 255, 0.22);
  border-color: rgba(74, 158, 255, 0.55);
}

.insec-device-preview-close-btn {
  margin-left: auto;
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 120, 120, 0.35);
  background: rgba(255, 80, 80, 0.12);
  color: #ffb4b4;
  cursor: pointer;
}

.insec-device-preview-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.25rem;
}

.insec-device-preview-scaler {
  transform: scale(var(--insec-device-preview-zoom, 1));
  transform-origin: top center;
  transition: transform 0.15s ease;
}

.insec-device-preview-frame {
  position: relative;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.insec-device-preview-frame.is-framed {
  padding: 14px 10px 18px;
  background: linear-gradient(145deg, #2a2a2e, #141416);
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.insec-device-preview-frame.is-framed::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.insec-device-preview-viewport {
  overflow: hidden;
  background: #0f141c;
  line-height: 0;
}

.insec-device-preview-viewport iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0f141c;
}

.acp-device-preview-grid {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.acp-device-preview-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.acp-device-preview-custom-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.acp-device-preview-custom-row label {
  flex: 0 0 auto;
}

.acp-device-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.acp-device-preview-hint {
  font-size: 0.82rem;
  color: var(--text-muted, #8b9cb3);
  margin: 0.35rem 0 0;
}

/* ACP-Karte: Zoom-Buttons im hellen Theme */
.acp-dev-card .insec-device-preview-zoom-btn {
  font-size: 0.78rem;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.12));
  background: var(--filter-btn-bg, rgba(255, 255, 255, 0.05));
  color: var(--text-main, inherit);
  cursor: pointer;
  min-height: 2.25rem;
}

.acp-dev-card .insec-device-preview-zoom-btn.is-active {
  background: color-mix(in srgb, var(--color-primary, #4a9eff) 22%, transparent);
  border-color: color-mix(in srgb, var(--color-primary, #4a9eff) 55%, transparent);
  color: var(--text-main, inherit);
}

.acp-dev-card .insec-device-preview-zoom-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.acp-device-preview-grid select,
.acp-device-preview-grid input[type="number"] {
  width: 100%;
  max-width: 100%;
  min-height: 2.5rem;
  font-size: 16px;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-secondary, rgba(255, 255, 255, 0.06));
  color: var(--text-main, inherit);
}

/* —— Iframe-Einbettung (Vorschau-Inhalt) —— */
html.insec-device-preview-embed,
html.insec-device-preview-embed body {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  margin: 0;
  max-width: 100%;
}

html.insec-device-preview-embed .insec-device-preview-shell,
html.insec-device-preview-embed #mobile-nav-backdrop {
  display: none !important;
}

html.insec-device-preview-embed .app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

html.insec-device-preview-embed .content {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

html.insec-device-preview-embed #login-screen {
  min-height: 100dvh;
}

/* Desktop-Layout im Embed: Sidebar bleibt, Grid normal */
html.insec-device-preview-embed:not(.insec-compact-shell) .app {
  display: grid;
  grid-template-columns: 240px 1fr;
}

html.insec-device-preview-embed:not(.insec-compact-shell) .sidebar {
  position: relative;
  transform: none;
  height: 100dvh;
}

html.insec-device-preview-embed:not(.insec-compact-shell) .mobile-bottom-nav {
  display: none !important;
}

/* Compact-Layout im Embed (Mobile/Tablet): Bottom-Nav + Drawer */
html.insec-device-preview-embed.insec-compact-shell .sidebar {
  position: fixed;
  transform: translate3d(-105%, 0, 0);
}

html.insec-device-preview-embed.insec-compact-shell .app.app-mobile-nav-open .sidebar {
  transform: translate3d(0, 0, 0);
}

/* Vorschau-Toolbar auf kleinen Parent-Fenstern */
@media (max-width: 720px) {
  .insec-device-preview-toolbar {
    padding: 0.45rem 0.65rem;
    gap: 0.45rem;
  }

  .insec-device-preview-toolbar__title {
    flex: 1 1 100%;
  }

  .insec-device-preview-close-btn {
    margin-left: 0;
    flex: 1 1 100%;
    text-align: center;
  }

  .insec-device-preview-stage {
    padding: 0.65rem;
    align-items: flex-start;
  }

  .insec-device-preview-scaler {
    max-width: calc(100vw - 1.5rem);
  }
}
