/* =========================================================
   BOND OS — CANONICAL STYLESHEET (LOCKED & SAFE)
   Purpose: App-like UX, no scroll bleed, no blank screen
========================================================= */

/* ===============================
   GLOBAL ROOT & SAFETY NET
================================ */

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  position: relative;
  z-index: 0;

  /* App-like behavior */
  overflow: hidden;

  /* Mobile stability */
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;

  font-family: system-ui, -apple-system, BlinkMacSystemFont,
    "SF Pro Text", ui-sans-serif, "Segoe UI", sans-serif;
}
@keyframes pulseSlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.animate-pulseSlow {
  animation: pulseSlow 2.6s ease-in-out infinite;
}
.coach-msg-thinking {
  font-style: italic;
  opacity: 0.75;
  animation: coachPulse 1.2s ease-in-out infinite;
}

@keyframes coachPulse {
  0% { opacity: 0.4; }
  50% { opacity: 0.9; }
  100% { opacity: 0.4; }
}

/* ===============================
   REACT ROOT (CRITICAL)
================================ */

#root {
  width: 100%;

  /* 🔒 SAFETY NET — prevents invisible UI */
  min-height: 100vh;
  height: calc(var(--vh, 1vh) * 100);

  position: relative;
  z-index: 1;

  overflow: hidden;

  /* Kill accidental stacking contexts */
  backdrop-filter: none !important;
  filter: none !important;
  transform: none !important;
  isolation: auto !important;
}

/* ===============================
   APP SHELL & SCROLL MODEL
================================ */

.bond-app-shell {
  position: fixed;
  inset: 0;
  margin: 0 auto;

  width: 100%;
  max-width: 28rem; /* mobile-first */

  display: flex;
  flex-direction: column;

  z-index: 1;
}

.bond-main {
  flex: 1 1 auto;
  min-height: 0;

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bond-bottom-shell {
  flex: 0 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ===============================
   BRAND COLORS & UTILITIES
================================ */

.bg-bondBg {
  background: radial-gradient(
    circle at top,
    #020617 0%,
    #020617 40%,
    #020617 100%
  );
}

.bg-bondSurface {
  background: rgba(15, 23, 42, 0.98);
}

.bg-bondSurfaceSoft {
  background: rgba(15, 23, 42, 0.9);
}

.text-bondText { color: #e5e7eb; }
.text-bondMuted { color: #9ca3af; }
.text-bondAccent { color: #fb7185; }
.text-bondMint { color: #7bf0c9; }
.text-bondDanger { color: #f97373; }

.border-bondBorder {
  border-color: rgba(148, 163, 184, 0.4);
}

/* ===============================
   AI ORB (FLOATING LAUNCH)
================================ */

.bond-ai-orb {
  position: fixed;
  right: 1.5rem;
  bottom: 4.5rem;

  width: 3rem;
  height: 3rem;
  border-radius: 999px;

  background: radial-gradient(
    circle at 30% 0%,
    #f97316,
    #fb7185,
    #22d3ee
  );

  box-shadow: 0 0 25px rgba(251, 113, 133, 0.7);
  border: 1px solid rgba(248, 250, 252, 0.25);

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  z-index: 1000;

  transition:
    bottom 0.25s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.bond-ai-orb--raised {
  bottom: 9.5rem;
  opacity: 0.85;
}

.bond-ai-orb:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 0 32px rgba(251, 113, 133, 0.9);
}

/* ===============================
   AI COACH (DOMINANT OVERLAY)
================================ */

#bondCoach {
  position: fixed !important;

  bottom: 24px;
  right: 24px;

  z-index: 2147483647 !important;

  isolation: isolate;
  contain: none !important;
  transform: none !important;
  filter: none !important;

  pointer-events: auto;
}

#bondCoach.coach-maximized {
  top: 16px !important;
  left: 16px !important;
  right: 16px !important;
  bottom: 16px !important;
}

/* Panel */
.bond-coach-panel {
  width: 360px;
  max-height: 420px;

  background: #020617;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);

  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.bond-coach-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 8px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);

  background: radial-gradient(
    circle at top left,
    rgba(251, 113, 133, 0.25),
    transparent
  );
}

.bond-coach-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #e5e7eb;
}

.bond-coach-actions button {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 14px;
}

/* Messages */
.bond-coach-messages {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
  font-size: 12px;
}

.coach-msg {
  margin-bottom: 6px;
  max-width: 85%;
  padding: 6px 8px;
  border-radius: 12px;
  line-height: 1.35;
}

.coach-msg-user {
  margin-left: auto;
  background: linear-gradient(to right, #fb7185, #facc15);
  color: #020617;
  border-bottom-right-radius: 4px;
}

.coach-msg-bot {
  margin-right: auto;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: #e5e7eb;
  border-bottom-left-radius: 4px;
}

/* Input */
.bond-coach-input-row {
  display: flex;
  border-top: 1px solid rgba(148, 163, 184, 0.4);
  padding-bottom: env(safe-area-inset-bottom);
}

.bond-coach-input {
  flex: 1;
  padding: 8px 10px;
  border: none;
  background: #020617;
  color: #e5e7eb;
  resize: none;
  font-size: 12px;
  outline: none;
}

.bond-coach-send {
  border: none;
  padding: 0 14px;
  margin: 6px;
  border-radius: 999px;

  font-size: 11px;
  font-weight: 600;
  cursor: pointer;

  background: linear-gradient(to right, #fb7185, #facc15);
  color: #020617;
}

/* ===============================
   BACKDROP WHEN COACH MAXIMIZED
================================ */

body.coach-dim::before {
  content: "";
  position: fixed;
  inset: 0;

  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);

  z-index: 2147483646;
}

/* ===============================
   STATIC HERO (LANDING / MARKETING)
================================ */

#static-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;

  padding: 2rem;
  background: #171810;
  color: #ffffff;

  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
