/* ============================================================
   RONAMI FIELD MANAGER — View Mode Switcher
   Desktop / Tablet / Mobile frame
   ============================================================ */

/* ── SELECTOR EN HEADER ──────────────────────────────────────── */
.view-mode-selector {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}

.vms-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  border: none; border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.15s ease;
  white-space: nowrap;
}
.vms-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.vms-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  font-weight: 600;
}
.vms-btn svg { flex-shrink: 0; }

.header-divider {
  width: 1px; height: 24px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ── OUTER SHELL — fondo oscuro en modo device ────────────────── */
body.view-tablet,
body.view-mobile {
  background: #0D1117;
  overflow: hidden;
}

/* ── CONTENEDOR DEL DEVICE ───────────────────────────────────── */
.device-shell {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #1A2744 0%, #0D1117 70%);
  overflow: hidden;
}
body.view-tablet .device-shell,
body.view-mobile .device-shell {
  display: flex;
}

/* Partículas de fondo decorativas */
.device-shell::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 15% 85%, rgba(26,86,219,.10) 0%, transparent 50%),
    radial-gradient(circle at 85% 15%, rgba(124,58,237,.07) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(26,86,219,.04) 0%, transparent 70%);
  pointer-events: none;
}

/* Grid de puntos decorativos */
.device-shell::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

/* ── DEVICE WRAPPER (centra y contiene todo) ─────────────────── */
.device-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  z-index: 1;
  animation: deviceAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes deviceAppear {
  from { opacity: 0; transform: scale(0.86) translateY(28px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── BARRA SUPERIOR DEL VISOR ────────────────────────────────── */
.device-topbar {
  display: flex; align-items: center; gap: 14px;
  color: #64748B; font-size: 12px; font-weight: 500;
  user-select: none;
  flex-wrap: wrap;
  justify-content: center;
}
.device-topbar .dtb-label {
  color: #94A3B8; font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.device-topbar .dtb-sep { color: #1E293B; }

.dtb-exit-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  color: #94A3B8; font-size: 11px; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.dtb-exit-btn:hover {
  background: rgba(255,255,255,.14);
  color: #fff;
  border-color: rgba(255,255,255,.2);
}

/* ── FRAME WRAP (recibe height calculado por JS) ─────────────── */
#device-frame-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  transition: height .2s ease;
}

/* ── PHONE FRAME ─────────────────────────────────────────────── */
.phone-frame {
  width: 390px;
  height: 844px;
  background: #1C1C1E;
  border-radius: 52px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.08),
    0 0 0 10px #1C1C1E,
    0 0 0 11px rgba(255,255,255,.05),
    0 30px 80px rgba(0,0,0,.75),
    0 0 120px rgba(26,86,219,.14),
    inset 0 1px 0 rgba(255,255,255,.06);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  /* transform-origin se aplica desde JS */
}

/* Dynamic Island */
.phone-notch {
  position: absolute; top: 13px; left: 50%;
  transform: translateX(-50%);
  width: 126px; height: 36px;
  background: #1C1C1E;
  border-radius: 20px;
  z-index: 10;
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
}
.phone-notch .notch-camera {
  width: 12px; height: 12px; border-radius: 50%;
  background: #2C2C2E;
  box-shadow: inset 0 0 0 3px #3A3A3C, 0 0 8px rgba(26,86,219,.3);
}
.phone-notch .notch-speaker {
  width: 58px; height: 6px; border-radius: 3px;
  background: #2C2C2E;
}

/* Botones laterales */
.phone-btn-vol {
  position: absolute; left: -3px; top: 140px;
  width: 3px; height: 36px;
  background: #2C2C2E; border-radius: 3px 0 0 3px;
  box-shadow: 0 42px 0 #2C2C2E, 0 84px 0 #2C2C2E;
}
.phone-btn-power {
  position: absolute; right: -3px; top: 200px;
  width: 3px; height: 72px;
  background: #2C2C2E; border-radius: 0 3px 3px 0;
}

/* Pantalla */
.phone-screen {
  position: absolute; inset: 0;
  border-radius: 52px;
  overflow: hidden;
  background: #fff;
}

/* Barra de estado */
.phone-status-bar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 54px;
  background: #0F172A;
  z-index: 9;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 28px 8px;
  flex-shrink: 0;
}
.psb-time {
  color: #fff; font-size: 15px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.psb-icons {
  display: flex; align-items: center; gap: 6px;
}

/* Home indicator */
.phone-home-indicator {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: 3px;
  background: rgba(0,0,0,.28);
  z-index: 10;
}

/* Área de app */
.phone-app-area {
  position: absolute;
  top: 54px; left: 0; right: 0; bottom: 20px;
  overflow: hidden;
}

/* Reflejo en el frame */
.phone-frame::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 52px;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,.05) 0%,
    transparent 35%,
    transparent 65%,
    rgba(255,255,255,.02) 100%
  );
  pointer-events: none; z-index: 20;
}

/* ── TABLET FRAME ────────────────────────────────────────────── */
.tablet-frame {
  width: 820px;
  height: 620px;
  background: #1C1C1E;
  border-radius: 22px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.07),
    0 0 0 10px #1C1C1E,
    0 0 0 11px rgba(255,255,255,.04),
    0 40px 100px rgba(0,0,0,.75),
    0 0 100px rgba(26,86,219,.12),
    inset 0 1px 0 rgba(255,255,255,.05);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.tablet-camera {
  position: absolute; top: 50%; right: 14px; transform: translateY(-50%);
  width: 8px; height: 8px; border-radius: 50%;
  background: #2C2C2E;
  box-shadow: inset 0 0 0 2px #3A3A3C;
  z-index: 10;
}

.tablet-screen {
  position: absolute;
  inset: 10px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.tablet-home-indicator {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 60px; border-radius: 2px;
  background: rgba(255,255,255,.12);
  z-index: 10;
}

.tablet-frame::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,.04) 0%, transparent 45%);
  pointer-events: none; z-index: 20;
}

/* ── IFRAME DENTRO DEL DEVICE ────────────────────────────────── */
.device-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #fff;
}

/* ── INFO BAR INFERIOR ───────────────────────────────────────── */
.device-infobar {
  display: flex; align-items: center; gap: 16px;
  color: #475569; font-size: 11px;
}
.device-infobar .dib-dim {
  color: #64748B; font-variant-numeric: tabular-nums;
}
.device-infobar .dib-dot { color: #1E293B; }

/* Controles del device */
.device-controls {
  display: flex; align-items: center; gap: 8px;
}
.device-ctrl-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  color: #64748B;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
.device-ctrl-btn:hover {
  background: rgba(255,255,255,.12);
  color: #CBD5E1;
  border-color: rgba(255,255,255,.2);
}

/* ── SCALE SLIDER ────────────────────────────────────────────── */
.device-scale-wrap {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: #475569;
}
.device-scale-wrap input[type=range] {
  -webkit-appearance: none;
  width: 88px; height: 4px;
  background: rgba(255,255,255,.1);
  border-radius: 2px; outline: none; cursor: pointer;
}
.device-scale-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.3);
  cursor: grab;
}
.device-scale-wrap input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--primary); border: none; cursor: grab;
}

/* ── ANIMACIÓN DE ENTRADA/SALIDA ─────────────────────────────── */
.device-wrapper.leaving {
  animation: deviceLeave 0.22s ease forwards;
}
@keyframes deviceLeave {
  to { opacity: 0; transform: scale(0.90) translateY(20px); }
}

/* ── MODO ESCRITORIO ─────────────────────────────────────────── */
body.view-desktop .device-shell { display: none; }
body.view-desktop .app-wrapper  { display: flex; }
body.view-tablet  .app-wrapper,
body.view-mobile  .app-wrapper  { visibility: hidden; pointer-events: none; }

/* ── CLOCK ANIMATION ─────────────────────────────────────────── */
@keyframes clockPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .8; }
}
.psb-time { animation: clockPulse 2s ease infinite; }
