@import url('ios-tokens.css');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: transparent;
  font-family: var(--ios-font);
  color: #ffffff;
}

/* ---------------------------------------------------- */
/* BASE OVERLAY STAGE & FULLSCREEN CANVAS (1080x1920)   */
/* ---------------------------------------------------- */
#overlay-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  pointer-events: none;
}

#facetime-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

/* Ambient Screen Glare (Top Light Reflection) */
.screen-glare {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 30%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
  z-index: 5;
}

/* ---------------------------------------------------- */
/* DRAGGABLE ELEMENT BASE STYLING (OBS INTERACT MODE)   */
/* ---------------------------------------------------- */
[data-draggable] {
  pointer-events: auto !important;
  cursor: grab !important;
  touch-action: none;
  user-select: none;
}

[data-draggable].is-dragging {
  cursor: grabbing !important;
  box-shadow: 0 0 0 2.5px rgba(0, 122, 255, 0.85), 0 20px 50px rgba(0, 0, 0, 0.75) !important;
  transition: none !important;
  z-index: 200 !important;
}

/* Dragging Coordinate Tooltip Badge */
.drag-coord-badge {
  position: fixed;
  background: rgba(0, 122, 255, 0.92);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 10px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transform: translate(14px, 14px);
  transition: opacity 0.15s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.2px;
}

.drag-coord-badge.visible {
  opacity: 1;
}

/* ---------------------------------------------------- */
/* 1. TOP STATUS BAR (Draggable & Scalable)             */
/* ---------------------------------------------------- */
.ios-status-bar {
  --pos-x-status: 0px;
  --pos-y-status: 0px;
  --scale-status: 1;
  --width-status: 1080px;

  position: absolute;
  left: var(--pos-x-status);
  top: var(--pos-y-status);
  width: var(--width-status);
  height: 56px;
  padding: 0 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
  z-index: 50;
  transform: scale(var(--scale-status));
  transform-origin: left top;
  transition: transform 0.2s var(--ios-spring);
  border-radius: 12px;
}

.status-time {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.1px;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.carrier-tag {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-right: 2px;
  opacity: 0.9;
}

.signal-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.signal-bars span {
  width: 3.5px;
  background-color: #ffffff;
  border-radius: 1px;
}
.signal-bars span:nth-child(1) { height: 35%; }
.signal-bars span:nth-child(2) { height: 55%; }
.signal-bars span:nth-child(3) { height: 75%; }
.signal-bars span:nth-child(4) { height: 100%; }

.wifi-icon svg {
  width: 19px;
  height: 19px;
  fill: #ffffff;
}

.battery-pill {
  width: 28px;
  height: 14px;
  border: 1.8px solid #ffffff;
  border-radius: 4px;
  padding: 1.5px;
  display: flex;
  align-items: center;
  position: relative;
  margin-left: 2px;
}

.battery-pill::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 3px;
  width: 2.2px;
  height: 4.5px;
  background-color: #ffffff;
  border-top-right-radius: 1.5px;
  border-bottom-right-radius: 1.5px;
}

.battery-level {
  height: 100%;
  width: 88%;
  background-color: #ffffff;
  border-radius: 1.5px;
  transition: width 0.5s ease, background-color 0.3s ease;
}

.battery-level.low {
  background-color: var(--ios-system-red);
}

/* ---------------------------------------------------- */
/* 2. DYNAMIC ISLAND HUB (Draggable & Scalable)         */
/* ---------------------------------------------------- */
.dynamic-island-container {
  --pos-x-island: 540px;
  --pos-y-island: 14px;
  --scale-island: 1;

  position: absolute;
  left: var(--pos-x-island);
  top: var(--pos-y-island);
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  transform: translateX(-50%) scale(var(--scale-island));
  transform-origin: center top;
  transition: transform 0.2s var(--ios-spring);
  pointer-events: auto !important;
}

.dynamic-island {
  position: relative;
  background-color: #000000;
  color: #ffffff;
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 1px rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 170px;
  height: 44px;
  padding: 0 16px;
  transition: width 0.45s var(--ios-spring), height 0.45s var(--ios-spring), border-radius 0.45s var(--ios-spring), box-shadow 0.3s ease;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Compact State */
.island-compact-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.island-camera-cutout {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #0d0d12;
  box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.25);
}

#island-compact-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  opacity: 0.9;
}

.island-call-wave {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 15px;
}

.island-call-wave span {
  width: 3px;
  height: 8px;
  background-color: var(--ios-system-green);
  border-radius: 2px;
  animation: callWave 1.2s ease-in-out infinite alternate;
}

.island-call-wave span:nth-child(2) { animation-delay: 0.2s; height: 14px; }
.island-call-wave span:nth-child(3) { animation-delay: 0.4s; height: 10px; }

@keyframes callWave {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1.2); }
}

/* Expanded Dynamic Island States */
.dynamic-island.expanded-queue {
  width: 420px;
  height: 82px;
  border-radius: 41px;
  padding: 0 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 20px rgba(0, 122, 255, 0.4);
}

.dynamic-island.expanded-gift {
  width: 460px;
  height: 90px;
  border-radius: 45px;
  padding: 0 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9), 0 0 25px rgba(255, 149, 0, 0.5);
  border: 1px solid rgba(255, 204, 0, 0.45);
}

.dynamic-island.expanded-alert {
  width: 400px;
  height: 78px;
  border-radius: 39px;
  padding: 0 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 20px rgba(255, 59, 48, 0.4);
}

.island-expanded-view {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.25s ease 0.1s;
}

.dynamic-island[class*="expanded-"] .island-compact-content {
  display: none;
}

.dynamic-island[class*="expanded-"] .island-expanded-view {
  display: flex;
  opacity: 1;
}

.island-lead {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
}

.island-avatar-badge {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #111;
  flex-shrink: 0;
}

.island-text-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.island-title {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.island-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.island-tail {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.island-gift-badge {
  background: linear-gradient(135deg, #ff9500 0%, #ff5e3a 100%);
  color: #fff;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 3px 10px rgba(255, 94, 58, 0.45);
}

/* ---------------------------------------------------- */
/* 3. INCOMING CALL BANNER (Draggable & Scalable)       */
/* ---------------------------------------------------- */
.incoming-call-banner {
  --pos-x-banner: 540px;
  --pos-y-banner: 18px;
  --scale-banner: 1;
  --width-banner: 1000px;

  position: absolute;
  left: var(--pos-x-banner);
  top: var(--pos-y-banner);
  width: var(--width-banner);
  z-index: 70;
  background: rgba(25, 25, 30, 0.92);
  backdrop-filter: var(--ios-glass-blur);
  -webkit-backdrop-filter: var(--ios-glass-blur);
  border: 1.5px solid var(--ios-glass-border);
  border-radius: 34px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 1px 2px rgba(255, 255, 255, 0.15);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transform: translate(-50%, -130%) scale(calc(var(--scale-banner) * 0.95));
  transform-origin: center top;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s var(--ios-spring), opacity 0.3s ease;
}

.incoming-call-banner.active {
  transform: translate(-50%, 0) scale(var(--scale-banner));
  opacity: 1;
  pointer-events: auto;
}

.banner-caller-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.banner-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.banner-details {
  display: flex;
  flex-direction: column;
}

.banner-caller-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #ffffff;
}

.banner-call-type {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.banner-call-type svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-call-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-call-circle:hover {
  transform: scale(1.08);
}

.btn-call-circle:active {
  transform: scale(0.92);
}

.btn-decline {
  background-color: var(--ios-system-red);
}

.btn-accept {
  background-color: var(--ios-system-green);
  animation: pulseGreen 1.8s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7); }
  70% { box-shadow: 0 0 0 12px rgba(52, 199, 89, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}

.btn-call-circle svg {
  width: 26px;
  height: 26px;
  fill: #ffffff;
}

/* ---------------------------------------------------- */
/* 4. CALLER NAME TAG (Draggable & Scalable)            */
/* ---------------------------------------------------- */
.caller-name-tag {
  --pos-x-tag: 40px;
  --pos-y-tag: 140px;
  --scale-tag: 1;

  position: absolute;
  left: var(--pos-x-tag);
  top: var(--pos-y-tag);
  z-index: 55;
  background: rgba(18, 18, 22, 0.82);
  backdrop-filter: var(--ios-glass-blur-sm);
  -webkit-backdrop-filter: var(--ios-glass-blur-sm);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transform: scale(var(--scale-tag));
  transform-origin: left top;
  transition: transform 0.2s var(--ios-spring);
}

.caller-live-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--ios-system-green);
  box-shadow: 0 0 8px rgba(52, 199, 89, 0.85);
}

.caller-tag-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.1px;
  color: #ffffff;
}

.caller-tag-pill {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.14);
  padding: 2.5px 8px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.3px;
}

.caller-name-tag .guest-muted-badge {
  background: rgba(255, 59, 48, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 3px 9px;
  display: none;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
}

.caller-name-tag .guest-muted-badge.active {
  display: flex;
}

.caller-name-tag .guest-muted-badge svg {
  width: 13px;
  height: 13px;
  fill: #ffffff;
}

/* ---------------------------------------------------- */
/* 5. BOTTOM CONTROL PILL (Draggable & Scalable)        */
/* ---------------------------------------------------- */
.ios-bottom-controls {
  --pos-x-controls: 540px;
  --pos-y-controls: 1774px;
  --scale-controls: 1;

  position: absolute;
  left: var(--pos-x-controls);
  top: var(--pos-y-controls);
  z-index: 50;
  display: flex;
  justify-content: center;
  transform: translateX(-50%) scale(var(--scale-controls));
  transform-origin: center bottom;
  transition: transform 0.2s var(--ios-spring);
}

.action-pill {
  background: rgba(28, 28, 35, 0.85);
  backdrop-filter: var(--ios-glass-blur);
  -webkit-backdrop-filter: var(--ios-glass-blur);
  border: 1.5px solid var(--ios-glass-border);
  border-radius: 50px;
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.65);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.pill-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.06);
}

.pill-btn:active {
  transform: scale(0.92);
}

.pill-btn svg {
  width: 25px;
  height: 25px;
  fill: #ffffff;
}

.pill-btn.muted {
  background: #ffffff;
}

.pill-btn.muted svg {
  fill: #000000;
}

.pill-btn.btn-hangup {
  background: var(--ios-system-red);
  border: none;
}

.pill-btn.btn-hangup:hover {
  background: #e03228;
}

/* ---------------------------------------------------- */
/* APPLE IOS HOME INDICATOR BAR                         */
/* ---------------------------------------------------- */
.ios-home-indicator {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 5.5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
  z-index: 45;
  pointer-events: none;
}

/* ---------------------------------------------------- */
/* AR EFFECTS & CONFETTI CANVAS (Full 1080x1920)        */
/* ---------------------------------------------------- */
#effects-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

/* ---------------------------------------------------- */
/* FULLSCREEN CALL ENDED CURTAIN                        */
/* ---------------------------------------------------- */
.call-ended-curtain {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.call-ended-curtain.active {
  opacity: 1;
  pointer-events: auto;
}

.call-ended-card {
  background: rgba(25, 25, 30, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 36px;
  padding: 36px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.call-ended-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--ios-system-red);
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-ended-icon svg {
  width: 32px;
  height: 32px;
  fill: #fff;
}

.call-ended-text {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.call-ended-duration {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
}

/* ---------------------------------------------------- */
/* FLOATING CHAT COMMAND TOAST                          */
/* ---------------------------------------------------- */
.command-toast {
  position: absolute;
  bottom: 150px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 15, 20, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s var(--ios-spring);
  z-index: 65;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.command-toast.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
