/* ===========================
   BASE.CSS – Design Tokens, Layout, Animations
   Emora Mental Wellness App
   =========================== */

/* ── Google Font ── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700;800;900&display=swap');

/* ── CSS Variables ── */
:root {
  --clr-bg: #070B1A;
  --clr-surface: rgba(255, 255, 255, 0.055);
  --clr-surface-2: rgba(255, 255, 255, 0.09);
  --clr-border: rgba(255, 255, 255, 0.1);
  --clr-primary: #6C3CE1;
  --clr-primary-light: #8B5CF6;
  --clr-secondary: #00C2FF;
  --clr-accent: #00E5FF;
  --clr-gradient: linear-gradient(135deg, #6C3CE1, #00C2FF);
  --clr-gradient-2: linear-gradient(135deg, #8B5CF6, #06B6D4);
  --clr-text: #FFFFFF;
  --clr-text-secondary: rgba(255, 255, 255, 0.6);
  --clr-text-muted: rgba(255, 255, 255, 0.35);
  --clr-success: #00E676;
  --clr-warning: #FFB300;
  --clr-danger: #FF4C6A;
  --clr-crisis: #FF1744;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  --shadow-glow: 0 0 24px rgba(108, 60, 225, 0.35);
  --shadow-glow-cyan: 0 0 24px rgba(0, 194, 255, 0.3);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);

  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  --font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --iphone-w: 393px;
  --iphone-h: 852px;
  --ipad-w: 744px;
  --ipad-h: 900px;
}

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  background: var(--clr-bg);
  color: var(--clr-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 60px;
}

/* ── Page Background ── */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse at 20% 20%, rgba(108, 60, 225, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(0, 194, 255, 0.12) 0%, transparent 55%),
    var(--clr-bg);
  overflow: hidden;
}

.page-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  pointer-events: none;
}

.g1 {
  width: 500px;
  height: 500px;
  background: #6C3CE1;
  top: -200px;
  left: -100px;
  animation: floatGlow 12s ease-in-out infinite;
}

.g2 {
  width: 400px;
  height: 400px;
  background: #00C2FF;
  bottom: -150px;
  right: -100px;
  animation: floatGlow 15s ease-in-out infinite reverse;
}

.g3 {
  width: 300px;
  height: 300px;
  background: #8B5CF6;
  top: 40%;
  right: 10%;
  animation: floatGlow 10s ease-in-out infinite 3s;
}

.stars-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.4;
}

@keyframes floatGlow {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -20px) scale(1.05);
  }

  66% {
    transform: translate(-20px, 30px) scale(0.95);
  }
}

/* ── Top Bar ── */
.top-bar {
  position: relative;
  z-index: 100;
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px 12px;
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}

.top-brand-name {
  font-size: 1.2rem;
  font-weight: 800;
  background: var(--clr-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.device-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  color: var(--clr-text);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(12px);
}

.device-toggle-btn:hover {
  background: var(--clr-surface);
  border-color: var(--clr-primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.toggle-icon-svg {
  width: 16px;
  height: 16px;
  stroke: var(--clr-secondary);
}

/* ── Device Wrapper ── */
.device-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 16px;
}

/* ── Device Frame ── */
.device-frame {
  position: relative;
  background: #0D1120;
  border-radius: 48px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 40px 80px rgba(0, 0, 0, 0.6),
    0 0 0 8px #0a0e1a,
    0 0 0 10px rgba(255, 255, 255, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.device-frame.iphone {
  width: var(--iphone-w);
  height: var(--iphone-h);
}

.device-frame.ipad {
  width: var(--ipad-w);
  height: var(--ipad-h);
  border-radius: 36px;
}

/* ── Dynamic Island ── */
.dynamic-island {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 126px;
  height: 37px;
  background: #000;
  border-radius: 20px;
  z-index: 10;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.device-frame.ipad .dynamic-island {
  display: none;
}

/* ── Status Bar ── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px 4px;
  min-height: 54px;
  flex-shrink: 0;
}

.device-frame.ipad .status-bar {
  padding: 12px 24px 4px;
  min-height: 40px;
}

.device-frame.ipad .status-bar .status-time {
  margin-left: 0;
}

.status-time {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: white;
  margin-left: 8px;
}

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

/* ── Screen Container ── */
.screen-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ── Home Indicator ── */
.home-indicator-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0 12px;
  flex-shrink: 0;
}

.home-indicator {
  width: 134px;
  height: 5px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 3px;
}

.device-frame.ipad .home-indicator-bar {
  display: none;
}

/* ── Utility Classes ── */
.glass-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.glass-card-dark {
  background: rgba(7, 11, 26, 0.7);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.gradient-text {
  background: var(--clr-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-btn {
  background: var(--clr-gradient);
  border: none;
  color: white;
  padding: 15px 28px;
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 20px rgba(108, 60, 225, 0.45);
  transition: all var(--transition-fast);
  letter-spacing: 0.02em;
}

.gradient-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(108, 60, 225, 0.6);
}

.gradient-btn:active {
  transform: translateY(0);
}

.gradient-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.outline-btn {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all var(--transition-fast);
}

.outline-btn:hover {
  border-color: var(--clr-primary);
  background: rgba(108, 60, 225, 0.1);
}

.text-btn {
  background: none;
  border: none;
  color: var(--clr-text-secondary);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.text-btn:hover {
  color: var(--clr-text);
}

/* Screen slide transitions */
.screen {
  animation: screenSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.slide-out {
  animation: screenSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.screen.fade-in {
  animation: screenFadeIn 0.4s ease;
}

@keyframes screenSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes screenSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(-60%);
    opacity: 0;
  }
}

@keyframes screenFadeIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.5);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% center;
  }

  100% {
    background-position: 200% center;
  }
}

@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }

  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

@keyframes progressFill {
  from {
    width: 0;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(108, 60, 225, 0.4);
  border-radius: 2px;
}

/* ══════════════════════════════════════
   MOBILE MODE — real device, no frame
   Applied via JS: body.is-mobile
   Shows on phones/tablets; desktop keeps device frame demo
══════════════════════════════════════ */
body.is-mobile {
  padding-bottom: 0;
  align-items: stretch;
  height: 100dvh;
  overflow: hidden;
}

body.is-mobile .top-bar {
  display: none !important;
}

body.is-mobile .page-bg {
  display: none !important;
}

body.is-mobile .device-wrapper {
  padding: 0;
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

body.is-mobile .device-frame {
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  background: var(--clr-bg) !important;
}

body.is-mobile .dynamic-island {
  display: none !important;
}

body.is-mobile .status-bar {
  display: none !important;
}

body.is-mobile .home-indicator-bar {
  display: none !important;
}

body.is-mobile .screen-container {
  height: 100%;
}

/* Floating music FAB (only in mobile mode) */
body.is-mobile .mobile-music-fab {
  display: flex !important;
}

.mobile-music-fab {
  display: none;
  position: fixed;
  top: max(env(safe-area-inset-top, 0px) + 10px, 14px);
  right: 14px;
  z-index: 999;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(7, 11, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: all 0.2s;
}

.mobile-music-fab:hover {
  transform: scale(1.1);
}