/**
 * Liquid Glass iOS 27 Design System
 * Hyper-tactile, luminous glassmorphism with fluid depth,
 * multi-layer specular highlights, and cosmic refraction.
 */

:root {
  --bg-space: #070913;
  --bg-deep: #0B0E1E;
  
  /* Liquid Glass Surfaces */
  --glass-surface: rgba(255, 255, 255, 0.06);
  --glass-surface-elevated: rgba(255, 255, 255, 0.10);
  --glass-surface-active: rgba(255, 255, 255, 0.16);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-border-bright: rgba(255, 255, 255, 0.32);
  --glass-specular: inset 0 1px 1.5px rgba(255, 255, 255, 0.4), inset 0 -1px 1px rgba(0, 0, 0, 0.25);
  --glass-blur: blur(42px) saturate(210%);
  
  /* Cosmic Radiance Palette */
  --aurora-purple: #A78BFA;
  --aurora-indigo: #818CF8;
  --aurora-cyan: #38BDF8;
  --aurora-rose: #F472B6;
  --aurora-emerald: #34D399;
  --aurora-amber: #FBBF24;
  --aurora-white: #F8FAFC;
  --text-muted: rgba(248, 250, 252, 0.65);
  --text-dim: rgba(248, 250, 252, 0.42);

  /* Elevation Shadows with Ambient Cosmic Glow */
  --shadow-glass-sm: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 15px rgba(167, 139, 250, 0.08);
  --shadow-glass-md: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 30px rgba(129, 140, 248, 0.14);
  --shadow-glass-lg: 0 24px 60px rgba(0, 0, 0, 0.60), 0 0 50px rgba(244, 114, 182, 0.16);
  --shadow-neon-glow: 0 0 25px rgba(167, 139, 250, 0.65);

  /* Radii & iOS Safe Areas */
  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 32px;
  --radius-pill: 9999px;
  --safe-top: env(safe-area-inset-top, 20px);
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

/* Base Viewport Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background-color: var(--bg-space);
  color: var(--aurora-white);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  position: relative;
}

/* Dynamic Cosmic Nebula Background */
.cosmic-nebula {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, #151034 0%, #070913 70%);
}

.cosmic-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: orbDrift 20s infinite alternate ease-in-out;
}

.cosmic-orb.orb-1 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, #8B5CF6 0%, transparent 70%);
  top: -80px;
  right: -60px;
}

.cosmic-orb.orb-2 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, #EC4899 0%, transparent 70%);
  bottom: 15%;
  left: -100px;
  animation-duration: 25s;
  animation-delay: -5s;
}

.cosmic-orb.orb-3 {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, #06B6D4 0%, transparent 70%);
  top: 40%;
  right: -50px;
  animation-duration: 22s;
  animation-delay: -10s;
}

@keyframes orbDrift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, 40px) scale(1.08); }
  100% { transform: translate(-25px, 20px) scale(0.95); }
}

/* Liquid Glass Cards */
.liquid-card {
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass-md), var(--glass-specular);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.liquid-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

.liquid-card-elevated {
  background: var(--glass-surface-elevated);
  border-color: var(--glass-border-bright);
  box-shadow: var(--shadow-glass-lg), var(--glass-specular);
}

.liquid-card:active {
  transform: scale(0.985);
}

/* Liquid Buttons */
.liquid-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--aurora-white);
  background: var(--glass-surface-elevated);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-bright);
  box-shadow: var(--shadow-glass-sm), var(--glass-specular);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.liquid-btn:hover {
  background: var(--glass-surface-active);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow-glass-md), 0 0 20px rgba(167, 139, 250, 0.3);
}

.liquid-btn:active {
  transform: scale(0.95);
}

.liquid-btn-primary {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.85) 0%, rgba(244, 114, 182, 0.85) 100%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #FFFFFF;
  box-shadow: 0 8px 24px rgba(167, 139, 250, 0.4), var(--glass-specular);
}

.liquid-btn-primary:hover {
  box-shadow: 0 12px 32px rgba(244, 114, 182, 0.55), var(--glass-specular);
}

.liquid-btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-pill);
}

/* Liquid Pills & Badges */
.liquid-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px);
  color: var(--aurora-white);
}

.liquid-pill.pill-purple {
  background: rgba(167, 139, 250, 0.15);
  border-color: rgba(167, 139, 250, 0.35);
  color: #DDD6FE;
}

.liquid-pill.pill-cyan {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.35);
  color: #BAE6FD;
}

.liquid-pill.pill-rose {
  background: rgba(244, 114, 182, 0.15);
  border-color: rgba(244, 114, 182, 0.35);
  color: #FBCFE8;
}

.liquid-pill.pill-emerald {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.35);
  color: #A7F3D0;
}

/* Liquid Glass iOS Tab Bar */
.liquid-tab-bar {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 440px;
  height: 64px;
  background: rgba(20, 24, 45, 0.72);
  backdrop-filter: blur(35px) saturate(220%);
  -webkit-backdrop-filter: blur(35px) saturate(220%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-pill);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), var(--glass-specular);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 4px 10px;
  z-index: 900;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.tab-item .tab-icon {
  font-size: 20px;
  transition: transform 0.25s ease;
}

.tab-item.active {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 15px rgba(167, 139, 250, 0.25);
}

.tab-item.active .tab-icon {
  transform: translateY(-2px) scale(1.1);
}

/* Modal / Sheet Overlay */
.liquid-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.liquid-sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.liquid-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  background: rgba(20, 24, 45, 0.94);
  backdrop-filter: blur(40px) saturate(210%);
  -webkit-backdrop-filter: blur(40px) saturate(210%);
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 36px 36px 0 0;
  box-shadow: 0 -15px 50px rgba(0, 0, 0, 0.7), var(--glass-specular);
  padding: 24px 20px calc(var(--safe-bottom) + 30px);
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.liquid-sheet-overlay.active .liquid-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 44px;
  height: 5px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  margin: 0 auto 18px;
}
