/* ── Apple Intelligence & iOS 18 Design System ────────────────────────────── */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=SF+Pro+Display:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  --apple-bg: #070709;
  --apple-canvas: #0d0e12;
  --apple-card: rgba(22, 24, 30, 0.72);
  --apple-card-hover: rgba(30, 33, 42, 0.85);
  --apple-border: rgba(255, 255, 255, 0.12);
  --apple-border-focus: rgba(255, 255, 255, 0.28);
  --apple-text-primary: #f5f5f7;
  --apple-text-secondary: #a1a1a6;
  --apple-text-tertiary: #6e6e73;
  --apple-blue: #0071e3;
  --apple-blue-hover: #0077ed;
  --apple-purple: #af52de;
  --apple-pink: #ff2d55;
  --apple-cyan: #5ac8fa;
  --apple-blur: blur(32px) saturate(190%);
  --apple-radius-sm: 12px;
  --apple-radius-md: 20px;
  --apple-radius-lg: 28px;
  --apple-radius-full: 9999px;
  --apple-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --apple-shadow-glass: 0 12px 40px -8px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  --apple-shadow-glow: 0 0 35px -5px rgba(175, 82, 222, 0.35);
}

/* ── Apple Intelligence Glowing Aura ────────────────────────────────────── */
.apple-aura-box {
  position: relative;
  border-radius: var(--apple-radius-md);
  padding: 2px;
  background: transparent;
  transition: all 0.5s var(--apple-spring);
}

.apple-aura-box::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--apple-radius-md) + 2px);
  background: linear-gradient(
    135deg,
    #00f2fe,
    #4facfe 25%,
    #af52de 50%,
    #ff2d55 75%,
    #ffb199
  );
  background-size: 300% 300%;
  animation: appleAuraFlow 6s ease infinite;
  opacity: 0.45;
  filter: blur(8px);
  z-index: 0;
  transition: opacity 0.5s var(--apple-spring), filter 0.5s var(--apple-spring);
}

.apple-aura-box:hover::before,
.apple-aura-box.active::before {
  opacity: 0.9;
  filter: blur(14px);
}

.apple-aura-box.speaking::before {
  opacity: 1;
  animation: appleAuraFlow 2.5s ease infinite, appleAuraPulse 1.8s ease-in-out infinite;
  filter: blur(16px);
}

@keyframes appleAuraFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes appleAuraPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.015); }
}

/* ── Apple Glass Card & Glassmorphism ───────────────────────────────────── */
.apple-glass {
  background: var(--apple-card);
  backdrop-filter: var(--apple-blur);
  -webkit-backdrop-filter: var(--apple-blur);
  border: 1px solid var(--apple-border);
  box-shadow: var(--apple-shadow-glass);
}

/* ── Siri Dynamic Soundwave & Orb ────────────────────────────────────────── */
.siri-orb-container {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
}

.siri-wave-bar {
  width: 3px;
  height: 6px;
  border-radius: var(--apple-radius-full);
  background: linear-gradient(180deg, #5ac8fa, #af52de);
  transition: height 0.1s ease;
}

.siri-orb-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--apple-radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: radial-gradient(circle at 30% 30%, #5ac8fa, #af52de 60%, #ff2d55);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(175, 82, 222, 0.4);
  transition: transform 0.3s var(--apple-spring), box-shadow 0.3s var(--apple-spring);
  color: #fff;
  flex-shrink: 0;
}

.siri-orb-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 22px rgba(175, 82, 222, 0.6);
}

.siri-orb-btn:active {
  transform: scale(0.94);
}

.siri-orb-btn.recording {
  animation: siriPulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 25px rgba(255, 45, 85, 0.8);
}

@keyframes siriPulse {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.12);
    filter: brightness(1.3);
  }
}

/* ── Apple Floating Control Dock ────────────────────────────────────────── */
.apple-dock {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--apple-radius-full);
  background: rgba(28, 30, 38, 0.75);
  backdrop-filter: var(--apple-blur);
  border: 1px solid var(--apple-border);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.apple-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--apple-radius-full);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: var(--apple-text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s var(--apple-spring);
}

.apple-pill-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.apple-pill-btn.active {
  background: var(--apple-blue);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.4);
}

/* ── Apple Modal Drawer ─────────────────────────────────────────────────── */
.apple-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--apple-spring);
}

.apple-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.apple-modal-content {
  width: min(720px, calc(100vw - 32px));
  max-height: 85vh;
  background: rgba(24, 26, 32, 0.88);
  backdrop-filter: var(--apple-blur);
  border: 1px solid var(--apple-border);
  border-radius: var(--apple-radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.4s var(--apple-spring);
}

.apple-modal-overlay.open .apple-modal-content {
  transform: scale(1) translateY(0);
}

/* ── Segmented Control (iOS style) ──────────────────────────────────────── */
.apple-segmented {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--apple-radius-sm);
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  gap: 2px;
}

.apple-segment-tab {
  flex: 1;
  text-align: center;
  padding: 6px 12px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--apple-text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--apple-spring);
}

.apple-segment-tab.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ── Item Grid for Avatar/Voice/Scene Selection ─────────────────────────── */
.apple-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  max-height: 52vh;
}

.apple-grid-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--apple-radius-md);
  cursor: pointer;
  text-align: center;
  transition: all 0.25s var(--apple-spring);
}

.apple-grid-card:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.apple-grid-card.selected {
  background: rgba(0, 113, 227, 0.2);
  border-color: var(--apple-blue);
  box-shadow: 0 0 16px rgba(0, 113, 227, 0.4);
}

.apple-grid-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 1.4rem;
  border: 1px solid rgba(255,255,255,0.1);
}

.apple-grid-card-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--apple-text-primary);
  line-height: 1.3;
  margin-top: 2px;
  word-break: break-word;
}

.apple-grid-card-desc {
  font-size: 0.68rem;
  color: var(--apple-text-secondary);
  margin-top: 2px;
}
