/* gPhone Supervisor - Luxury Modern Styling */
:root {
  --bg-primary: #08090E;
  --bg-secondary: #0F121C;
  --bg-card: rgba(18, 22, 34, 0.75);
  --bg-card-hover: rgba(26, 32, 50, 0.85);
  --border-card: rgba(212, 175, 55, 0.22);
  --border-subtle: rgba(255, 255, 255, 0.08);

  --gold-primary: #D4AF37;
  --gold-gradient: linear-gradient(135deg, #FFF1B0 0%, #D4AF37 50%, #996515 100%);
  --gold-glow: rgba(212, 175, 55, 0.35);

  --text-primary: #FFFFFF;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --accent-blue: #38BDF8;
  --accent-green: #10B981;
  --accent-amber: #F59E0B;
  --accent-rose: #F43F5E;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--safe-bottom) + 76px);
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(212, 175, 55, 0.07) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(56, 189, 248, 0.05) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: rgba(8, 9, 14, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.device-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  font-weight: 500;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.online {
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}

/* Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.5), transparent);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-title-icon {
  color: var(--gold-primary);
  margin-right: 8px;
}

/* Device Overview Metric Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-value.gold {
  color: var(--gold-primary);
}

/* Action Button Grid */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 600px) {
  .actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.action-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

.action-btn:active {
  transform: scale(0.96);
  background: rgba(212, 175, 55, 0.12);
}

.action-btn.gold {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2) 0%, rgba(153, 101, 21, 0.1) 100%);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.15);
}

.action-btn.danger {
  border-color: rgba(244, 63, 94, 0.35);
  color: var(--accent-rose);
}

.action-btn.danger:active {
  background: rgba(244, 63, 94, 0.15);
}

/* Map Container */
#map-container {
  height: 380px;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  position: relative;
  z-index: 10;
}

/* Dark mode for Leaflet tiles */
.leaflet-tile-pane {
  filter: brightness(0.65) invert(1) contrast(3.5) hue-rotate(200deg) saturate(0.35) brightness(0.75);
}

/* Custom Pulsing Leaflet Marker */
.radar-marker {
  position: relative;
}

.radar-marker .core {
  width: 16px;
  height: 16px;
  background: var(--gold-primary);
  border: 3px solid #FFF;
  border-radius: 50%;
  box-shadow: 0 0 12px var(--gold-primary);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.radar-marker .pulse {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.4);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: radar-wave 2s infinite ease-out;
}

@keyframes radar-wave {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

/* Airplane Mode Card */
.airplane-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--accent-amber);
  color: var(--accent-amber);
}

.duration-selector {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  flex-wrap: wrap;
}

.dur-btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.dur-btn.active, .dur-btn:hover {
  background: var(--gold-primary);
  color: #000;
  font-weight: 700;
  border-color: var(--gold-primary);
}

/* Screen Designer Visual Editor */
.designer-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 820px) {
  .designer-layout {
    grid-template-columns: 1fr;
  }
}

/* Samsung Galaxy A16 Phone Mockup Frame */
.phone-mockup-frame {
  width: 320px;
  height: 640px;
  margin: 0 auto;
  background: #000;
  border-radius: 46px;
  padding: 12px;
  box-shadow: 
    0 0 0 3px #242938,
    0 0 0 6px #121520,
    0 25px 60px rgba(0, 0, 0, 0.85);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Camera cutout (Infinity-U teardrop notch) */
.camera-notch {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 18px;
  background: #000;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
}

.camera-lens {
  width: 9px;
  height: 9px;
  background: #0a0f1d;
  border-radius: 50%;
  border: 1px solid #1a233a;
}

.phone-screen {
  flex: 1;
  border-radius: 36px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 24px 14px 14px 14px;
  transition: all 0.3s ease;
}

.phone-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85);
  padding: 0 4px 10px 4px;
}

.phone-widget {
  text-align: center;
  padding: 16px 0;
}

.phone-clock {
  font-size: 2.5rem;
  font-weight: 300;
  letter-spacing: -0.03em;
  color: #FFF;
}

.phone-date {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.75);
}

.phone-apps-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 10px 4px;
  align-content: start;
}

.mock-app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.mock-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  font-size: 1.35rem;
  transition: all 0.2s;
}

.mock-icon.squircle {
  border-radius: 16px;
}
.mock-icon.circle {
  border-radius: 50%;
}
.mock-icon.rounded {
  border-radius: 10px;
}

.mock-label {
  font-size: 0.65rem;
  color: #FFF;
  text-align: center;
  max-width: 65px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Phone bottom action buttons (SOS + WiFi) */
.phone-bottom-bar {
  display: flex;
  gap: 8px;
  padding-top: 10px;
}

.phone-bar-btn {
  flex: 1;
  padding: 8px 6px;
  border-radius: 12px;
  border: none;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.phone-sos-btn {
  background: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%);
  color: #FFF;
}

.phone-wifi-btn {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  color: #FFF;
}

/* Designer Form Controls */
.designer-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.theme-pill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.theme-btn {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-btn.active, .theme-btn:hover {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.1);
  color: var(--gold-primary);
}

.theme-color-chip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--gold-primary);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Primary Luxury Gold Button */
.btn-gold-luxury {
  background: var(--gold-gradient);
  color: #000;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 24px;
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-gold-luxury:active {
  transform: scale(0.98);
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.2);
}

/* WebRTC Active Stream Modal Overlay */
.webrtc-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(14px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-in-out;
}

.webrtc-card {
  width: 100%;
  max-width: 480px;
  background: #0f131f;
  border: 1px solid var(--gold-primary);
  border-radius: var(--radius-xl);
  padding: 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

.webrtc-video-feed {
  width: 100%;
  height: 260px;
  background: #000;
  border-radius: var(--radius-md);
  margin: 16px 0;
  object-fit: cover;
}

.audio-visualizer-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 60px;
  margin: 18px 0;
}

.wave-bar {
  width: 6px;
  height: 12px;
  background: var(--gold-primary);
  border-radius: 4px;
  animation: wave-anim 1.2s infinite ease-in-out;
}

.wave-bar:nth-child(2) { animation-delay: 0.15s; }
.wave-bar:nth-child(3) { animation-delay: 0.3s; }
.wave-bar:nth-child(4) { animation-delay: 0.45s; }
.wave-bar:nth-child(5) { animation-delay: 0.6s; }

@keyframes wave-anim {
  0%, 100% { height: 12px; }
  50% { height: 48px; background: #FFF; }
}

/* Bottom Navigation Bar for iPhone/PWA */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 12px calc(var(--safe-bottom) + 8px) 12px;
  background: rgba(10, 12, 19, 0.92);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-top: 1px solid var(--border-subtle);
}

.nav-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 12px;
  transition: all 0.2s;
}

.nav-tab-btn.active {
  color: var(--gold-primary);
}

.nav-tab-btn.active svg {
  filter: drop-shadow(0 0 6px var(--gold-glow));
}

/* Language Bar */
.lang-selector {
  display: flex;
  gap: 8px;
}

.lang-btn {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: #FFF;
  font-size: 0.8rem;
  cursor: pointer;
}

.lang-btn.active {
  background: var(--gold-primary);
  color: #000;
  font-weight: 700;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
