/* فكرة | Studio device preview 1.2 -- independent iframe viewports */
:root {
  color-scheme: light;
  font-family: 'Tajawal', Tahoma, Arial, sans-serif;
  --ink: #233d67;
  --muted: #778ba6;
  --accent: #457ddb;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 10% 25%, rgba(136,210,250,.19), transparent 46%),
    radial-gradient(ellipse at 92% 36%, rgba(218,162,248,.17), transparent 45%),
    linear-gradient(145deg, #f9fcff, #eef4fd);
}
.preview-app { max-width: 1640px; margin: 0 auto; padding: 14px 20px 32px; }
.preview-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 15px; }
.preview-heading { display: flex; align-items: center; gap: 11px; }
.preview-logo { width: 44px; height: 48px; object-fit: contain; }
.preview-heading h1 { font-size: 19px; margin: 0; font-weight: 900; }
.preview-heading p { font-size: 12px; color: var(--muted); margin: 3px 0 0; }
.direct-link { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: #365c9e; font-size: 13px; text-decoration: none; border: 1px solid #dae5f5; background: rgba(255,255,255,.82); border-radius: 13px; font-weight: 800; }
.direct-link:hover { border-color: #92b4ea; }
.direct-link svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.preview-controls { display: flex; width: max-content; max-width: 100%; margin: 0 auto; direction: rtl; gap: 5px; padding: 5px; border-radius: 19px; background: rgba(255,255,255,.93); border: 1px solid #dce8f7; box-shadow: 0 10px 29px rgba(50,94,162,.10); }
.preview-mode { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 110px; min-height: 45px; padding: 9px 17px; border: 0; border-radius: 14px; background: transparent; color: #667e9d; font: 800 15px 'Tajawal',Tahoma,Arial,sans-serif; cursor: pointer; transition: .2s ease; }
.preview-mode svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.preview-mode:hover { color: #2b64ac; background: #f1f6ff; }
.preview-mode[aria-pressed="true"] { background: linear-gradient(125deg,#4678d9,#74a6fb); color: #fff; box-shadow: 0 7px 17px rgba(67,117,211,.27); }
.preview-mode:focus-visible, .direct-link:focus-visible { outline: 3px solid #178eda; outline-offset: 3px; }
.preview-size { display: flex; direction: rtl; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-size: 13px; margin: 13px auto 9px; color: #617b9c; }
.preview-size b { color: #315d9e; font-family: 'Tajawal', sans-serif; font-weight: 800; }
#previewScaleHint { color: #8290a3; font-size: 11px; }
.preview-stage { min-height: 400px; padding: 7px 0 12px; width: 100%; }
.device-host {
  --device-width: 390px;
  --device-height: 844px;
  --device-bezel: 10px;
  --preview-scale: 1;
  width: calc((var(--device-width) + 2 * var(--device-bezel)) * var(--preview-scale));
  height: calc((var(--device-height) + 2 * var(--device-bezel)) * var(--preview-scale));
  position: relative;
  margin-inline: auto;
}
.device-shell {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--device-width) + 2 * var(--device-bezel));
  height: calc(var(--device-height) + 2 * var(--device-bezel));
  padding: var(--device-bezel);
  border-radius: 39px;
  background: linear-gradient(125deg,#334055,#161f31 56%,#48536a);
  box-shadow: 0 26px 65px rgba(31,57,100,.20), 0 3px 6px rgba(17,42,82,.12), inset 0 1px rgba(255,255,255,.33);
  transform-origin: top left;
  transform: scale(var(--preview-scale));
}
.device-view { width: 100%; height: 100%; overflow: hidden; border-radius: 29px; background: #fff; }
.device-view iframe { border: none; display: block; width: var(--device-width); height: var(--device-height); background: #fff; }
body[data-mode="tablet"] .device-shell { border-radius: 31px; }
body[data-mode="tablet"] .device-view { border-radius: 21px; }
body[data-mode="desktop"] .device-shell { border-radius: 17px; background: linear-gradient(145deg, #7788a2, #344257 50%, #8397b3); }
body[data-mode="desktop"] .device-view { border-radius: 10px; }
.preview-note { margin: 15px 0 0; text-align: center; line-height: 1.7; color: #8192ab; font-size: 12px; }
@media (max-width: 600px) {
  .preview-app { padding: 13px 10px 24px; }
  .preview-header { align-items: center; }
  .preview-heading h1 { font-size: 16px; }
  .preview-heading p { font-size: 11px; max-width: 24ch; }
  .preview-logo { width: 34px; height: 39px; }
  .direct-link { font-size: 11px; padding: 8px 9px; }
  .direct-link span { display: none; }
  .preview-mode { min-width: 0; padding: 10px 15px; font-size: 13px; min-height: 42px; }
  .preview-mode svg { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .preview-mode { transition: none; }
}
