/* ==========================================================================
   SecurApp Design System — Device Mockups (devices.css)
   Pure CSS browser, MacBook, and iPhone frames
   Mobile-first: base = mobile, min-width: 640px = tablet, 1024px = desktop
   Visual quality target: shots.so Safari-style + Liquid Glass
   ========================================================================== */

/* ==========================================================================
   1. SHARED DEVICE STYLES
   ========================================================================== */
.device {
  position: relative;
  margin-inline: auto;
  overflow: hidden;
}

.device__screen {
  position: relative;
  overflow: hidden;
  background-color: var(--bg-secondary);
}

.device__screen img,
.device__screen video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* ==========================================================================
   2. BROWSER MOCKUP — shots.so Safari quality
   Base = compact mobile sizes
   ========================================================================== */
.device-browser {
  max-width: 960px;
  width: 100%;
  margin-inline: auto;
  border-radius: var(--radius-md);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-default);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 8px 16px rgba(0, 0, 0, 0.06),
    0 24px 48px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

/* --- Top bar ------------------------------------------------------------ */
.device-browser__bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

/* Traffic lights */
.device-browser__dots {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.device-browser__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.device-browser__dot--close {
  background-color: var(--device-dot-close);
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.12);
}

.device-browser__dot--minimize {
  background-color: var(--device-dot-minimize);
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.12);
}

.device-browser__dot--maximize {
  background-color: var(--device-dot-maximize);
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.12);
}

/* URL bar — pill shape, centered */
.device-browser__url {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1-5);
  padding: var(--space-1) var(--space-3);
  background-color: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 480px;
  margin-inline: auto;
}

/* Lock icon via FA in HTML — style it green */
.device-browser__url i {
  color: var(--color-success);
  font-size: var(--text-2xs);
  flex-shrink: 0;
}

/* --- Screen / content slot --------------------------------------------- */
.device-browser__screen {
  position: relative;
  overflow: hidden;
  background-color: var(--bg-primary);
  aspect-ratio: 16 / 10;
}

.device-browser__screen img:not(.device__brand-img),
.device-browser__screen video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* Tablet: scale up browser chrome */
@media (min-width: 640px) {
  .device-browser {
    border-radius: var(--radius-lg);
  }

  .device-browser__bar {
    padding: var(--space-3) var(--space-4);
  }

  .device-browser__dot {
    width: 12px;
    height: 12px;
  }

  .device-browser__url {
    font-size: var(--text-xs);
    padding: var(--space-1-5) var(--space-4);
  }

  .device-browser__url i {
    font-size: var(--text-2xs);
  }
}

/* Desktop: premium shadows and radius */
@media (min-width: 1024px) {
  .device-browser {
    border-radius: var(--radius-xl);
    box-shadow:
      0 2px 4px rgba(0, 0, 0, 0.03),
      0 8px 16px rgba(0, 0, 0, 0.05),
      0 24px 48px rgba(0, 0, 0, 0.07),
      0 48px 80px rgba(0, 0, 0, 0.04);
  }

  .device-browser__bar {
    padding: var(--space-3) var(--space-5);
  }
}

/* --- Dark mode: Liquid Glass treatment --------------------------------- */
[data-theme="dark"] .device-browser {
  background: linear-gradient(
    180deg,
    rgba(30, 30, 48, 0.7) 0%,
    rgba(20, 20, 32, 0.85) 100%
  );
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 8px 16px rgba(0, 0, 0, 0.25),
    0 24px 48px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .device-browser__bar {
  background-color: rgba(255, 255, 255, 0.04);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .device-browser__url {
  background-color: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .device-browser__dot--close {
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.2),
              0 0 4px rgba(255, 95, 87, 0.15);
}

[data-theme="dark"] .device-browser__dot--minimize {
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.2),
              0 0 4px rgba(254, 188, 46, 0.15);
}

[data-theme="dark"] .device-browser__dot--maximize {
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.2),
              0 0 4px rgba(40, 200, 64, 0.15);
}


/* ==========================================================================
   3. MACBOOK MOCKUP
   Base = 100% width, compact bezel
   ========================================================================== */
.device-macbook {
  position: relative;
  max-width: 100%;
  width: 100%;
  margin-inline: auto;
  padding-bottom: 24px;
}

/* --- Screen (lid) ------------------------------------------------------ */
.device-macbook__screen {
  position: relative;
  background-color: var(--device-bezel);
  border: 3px solid var(--device-bezel-border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 8px 8px 0;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.06),
    0 8px 16px rgba(0, 0, 0, 0.08),
    0 24px 48px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.device-macbook__display {
  position: relative;
  overflow: hidden;
  background-color: var(--bg-primary);
  border-radius: 4px 4px 0 0;
  aspect-ratio: 16 / 10;
}

.device-macbook__display img,
.device-macbook__display video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* --- Webcam notch ------------------------------------------------------ */
.device-macbook__screen::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: var(--device-bezel-cam);
  border: 1px solid var(--device-bezel-accent);
  z-index: 2;
}

/* --- Base (trapezoid body) --------------------------------------------- */
.device-macbook__base {
  position: relative;
  height: 10px;
  background: linear-gradient(180deg, var(--device-base-top) 0%, var(--device-base-bottom) 100%);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  margin-inline: -2%;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.1),
    0 4px 16px rgba(0, 0, 0, 0.06);
}

/* Hinge line */
.device-macbook__base::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(180deg, var(--device-bezel-accent) 0%, var(--device-bezel) 100%);
  border-radius: 0 0 1px 1px;
}

/* Indent / trackpad hint on base */
.device-macbook__base::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  border-radius: 0 0 4px 4px;
  background-color: var(--device-bezel-accent);
}

/* Shadow beneath the whole laptop */
.device-macbook::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 10%;
  right: 10%;
  height: 12px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.15) 0%, transparent 70%);
  border-radius: var(--radius-full);
  z-index: -1;
}

/* --- Dark mode: variables handle bezel colors automatically ------------- */
/* Colors switch via --device-* variables in variables.css                   */
[data-theme="dark"] .device-macbook__screen {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 8px 16px rgba(0, 0, 0, 0.25),
    0 24px 48px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .device-macbook__screen::before {
  border-color: var(--device-phone-border);
}

[data-theme="dark"] .device-macbook__base {
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 4px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .device-macbook::after {
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.25) 0%, transparent 70%);
}

/* Desktop: constrain width and scale up bezel details */
@media (min-width: 1024px) {
  .device-macbook {
    max-width: 800px;
  }

  .device-macbook__screen {
    padding: 12px 12px 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  .device-macbook__base {
    height: 14px;
  }
}


/* ==========================================================================
   4. iPHONE MOCKUP
   Base = 260px compact frame
   ========================================================================== */
.device-iphone {
  position: relative;
  max-width: 260px;
  width: 100%;
  margin-inline: auto;
}

.device-iphone__frame {
  position: relative;
  background-color: var(--device-phone-frame);
  border: 2px solid var(--device-phone-border);
  border-radius: 36px;
  padding: 10px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    0 8px 16px rgba(0, 0, 0, 0.12),
    0 24px 48px rgba(0, 0, 0, 0.15),
    inset 0 0 0 2px #0f0f0f;
}

/* --- Dynamic Island ---------------------------------------------------- */
.device-iphone__frame::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 22px;
  background-color: var(--device-phone-island);
  border-radius: 16px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
  z-index: 3;
}

/* --- Screen ------------------------------------------------------------ */
.device-iphone__screen {
  position: relative;
  overflow: hidden;
  background-color: var(--bg-primary);
  border-radius: 26px;
  aspect-ratio: 9 / 19.5;
}

.device-iphone__screen img:not(.device__brand-img),
.device-iphone__screen video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* --- Power button (right side via ::after) ------------------------------ */
.device-iphone__frame::after {
  content: '';
  position: absolute;
  top: 100px;
  right: -5px;
  width: 3px;
  height: 44px;
  background-color: var(--device-phone-border);
  border-radius: 0 2px 2px 0;
}

/* --- Volume buttons on left (HTML elements, outside __frame) ----------- */
.device-iphone__volume-up,
.device-iphone__volume-down {
  position: absolute;
  left: -5px;
  width: 3px;
  background-color: var(--device-phone-border);
  border-radius: 2px 0 0 2px;
  z-index: 1;
}

.device-iphone__volume-up {
  top: 95px;
  height: 28px;
}

.device-iphone__volume-down {
  top: 132px;
  height: 28px;
}

/* --- Silent toggle ----------------------------------------------------- */
.device-iphone__silent {
  position: absolute;
  left: -5px;
  top: 70px;
  width: 3px;
  height: 16px;
  background-color: var(--device-phone-border);
  border-radius: 2px 0 0 2px;
  z-index: 1;
}

/* --- Home indicator ---------------------------------------------------- */
.device-iphone__home-indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-full);
  z-index: 3;
}

/* Shadow beneath the phone */
.device-iphone::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 15%;
  right: 15%;
  height: 16px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.18) 0%, transparent 70%);
  border-radius: var(--radius-full);
  z-index: -1;
}

/* --- Light mode: lighter iPhone frame ---------------------------------- */
:root .device-iphone__frame,
[data-theme="light"] .device-iphone__frame {
  background-color: var(--device-phone-frame-lt);
  border-color: var(--device-phone-border-lt);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.06),
    0 8px 16px rgba(0, 0, 0, 0.08),
    0 24px 48px rgba(0, 0, 0, 0.1),
    inset 0 0 0 2px #dcdce0;
}

:root .device-iphone__frame::before,
[data-theme="light"] .device-iphone__frame::before {
  background-color: var(--device-phone-island);
}

:root .device-iphone__frame::after,
[data-theme="light"] .device-iphone__frame::after {
  background-color: var(--device-phone-button);
}

:root .device-iphone__volume-up,
:root .device-iphone__volume-down,
:root .device-iphone__silent,
[data-theme="light"] .device-iphone__volume-up,
[data-theme="light"] .device-iphone__volume-down,
[data-theme="light"] .device-iphone__silent {
  background-color: var(--device-phone-button);
}

:root .device-iphone__home-indicator,
[data-theme="light"] .device-iphone__home-indicator {
  background-color: rgba(0, 0, 0, 0.2);
}

/* --- Dark mode: dark frame with glow ----------------------------------- */
[data-theme="dark"] .device-iphone__frame {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 8px 16px rgba(0, 0, 0, 0.25),
    0 24px 48px rgba(0, 0, 0, 0.3),
    inset 0 0 0 2px #0f0f0f;
}

[data-theme="dark"] .device-iphone__frame::after {
  background-color: var(--device-phone-border);
}

[data-theme="dark"] .device-iphone__volume-up,
[data-theme="dark"] .device-iphone__volume-down,
[data-theme="dark"] .device-iphone__silent {
  background-color: var(--device-phone-border);
}

[data-theme="dark"] .device-iphone__home-indicator {
  background-color: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .device-iphone::after {
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.3) 0%, transparent 70%);
}

/* Desktop: scale up iPhone frame details */
@media (min-width: 1024px) {
  .device-iphone {
    max-width: 320px;
  }

  .device-iphone__frame {
    border-radius: 44px;
    padding: 14px;
    border-width: 3px;
  }

  .device-iphone__frame::before {
    width: 90px;
    height: 28px;
    top: 14px;
    border-radius: 20px;
  }

  .device-iphone__screen {
    border-radius: 32px;
  }
}


/* ==========================================================================
   DEVICE PLACEHOLDER — Brand image inside empty devices
   ========================================================================== */
.device-browser__placeholder,
.device-macbook__placeholder,
.device-iphone__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 200px;
  background-color: var(--bg-secondary);
}

.device__brand-img {
  max-width: 120px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0.8;
}

/* Light/dark brand logo swap */
.device__brand-img--dark {
  display: none;
}

[data-theme="dark"] .device__brand-img--light {
  display: none;
}

[data-theme="dark"] .device__brand-img--dark {
  display: block;
}


/* ==========================================================================
   5. SVG FRAME MOCKUPS — Real device frames from Apple resources
   Content goes behind the SVG frame (notch, Dynamic Island stay on top)
   ========================================================================== */

/* ── Shared mockup container ── */
.device-mockup {
  position: relative;
  margin-inline: auto;
  width: 100%;
}

/* Frame SVG — sits on top of content */
.device-mockup__frame {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  z-index: 2;
  pointer-events: none;
  user-select: none;
}

/* Content — positioned behind the frame */
.device-mockup__content {
  position: absolute;
  z-index: 1;
  overflow: hidden;
}

.device-mockup__content img,
.device-mockup__content video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Placeholder (no content yet) */
.device-mockup__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: var(--bg-secondary);
}

.device-mockup__placeholder .device__brand-img {
  width: 60%;
  max-width: 200px;
  opacity: 0.12;
}

/* ── MacBook Pro 16" — viewBox: 2048 × 1237 ── */
.device-mockup--macbook {
  max-width: 100%;
}

.device-mockup--macbook .device-mockup__content {
  top: 2.2%;
  left: 10%;
  width: 80%;
  height: 85.8%;
  border-radius: 1px;
  background-color: #000;
}

/* ── iPhone 17 Pro Max — viewBox: 1520 × 3068 ── */
.device-mockup--iphone {
  max-width: 260px;
}

.device-mockup--iphone .device-mockup__content {
  top: 3.26%;
  left: 6.58%;
  width: 86.84%;
  height: 93.48%;
  border-radius: 10% / 5%;
  background-color: #000;
}

/* ── iPad Pro 13" — viewBox: 2952 × 2264 ── */
.device-mockup--ipad {
  max-width: 100%;
}

/* viewBox: 1468 × 1128 — screen area: ~53,54 to ~1419,1078 */
.device-mockup--ipad .device-mockup__content {
  top: 4.2%;
  left: 3.2%;
  width: 93.6%;
  height: 92%;
  border-radius: 1.4% / 1.8%;
  background-color: #000;
}

/* ── Tablet (640px) ── */
@media (min-width: 640px) {
  .device-mockup--iphone {
    max-width: 280px;
  }
}

/* ── Desktop (1024px) ── */
@media (min-width: 1024px) {
  .device-mockup--macbook {
    max-width: 800px;
  }

  .device-mockup--iphone {
    max-width: 320px;
  }

  .device-mockup--ipad {
    max-width: 700px;
  }
}


/* ==========================================================================
   6. DEVICE COMPOSITIONS — Layout helpers for showcasing devices together
   Base = column stack, desktop = side-by-side / grid
   ========================================================================== */

/* Hero device group — base: column stack */
.device-group {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  padding-top: var(--space-8);
}

/* Overlap layout — phone overlays browser */
.device-group--overlap {
  position: relative;
}

.device-group--overlap .device-browser {
  width: 100%;
}

.device-group--overlap .device-iphone {
  position: relative;
  right: auto;
  bottom: auto;
  max-width: 220px;
  z-index: 2;
}

/* Desktop: horizontal layout and overlap positioning */
@media (min-width: 1024px) {
  .device-group {
    flex-direction: row;
    align-items: flex-end;
    gap: var(--space-8);
  }

  .device-group--overlap .device-iphone {
    position: absolute;
    right: -5%;
    bottom: -10%;
    max-width: 200px;
  }
}
