/* ============================================================================
 * BayCast Auth UI — matches existing dark nautical theme
 * Drop this into styles.css (or load as a separate <link>) and the modal HTML
 * below will render with zero extra work.
 * ============================================================================ */

/* Shared modal scrim */
.bc-auth-scrim {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 22, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10200;   /* above v25 first-run (10080) and v27 More sheet (10050) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: bc-auth-fade 180ms ease-out;
}

@keyframes bc-auth-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.bc-auth-modal {
  background: #1b2330;            /* matches ts-label */
  color: #d6dde8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 420px;
  padding: 24px;
  position: relative;
  font-family: inherit;           /* inherit from BayCast's body stack */
  animation: bc-auth-pop 220ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes bc-auth-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bc-auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  color: #9fb3cc;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
}
.bc-auth-close:hover { background: rgba(255,255,255,0.06); color: #fff; }

.bc-auth-title {
  color: #ffa82b;                 /* matches v46-picker title */
  font-weight: 700;
  font-size: 20px;
  margin: 0 0 4px 0;
  letter-spacing: 0.2px;
}

.bc-auth-sub {
  color: #9fb3cc;
  font-size: 13px;
  margin: 0 0 20px 0;
  line-height: 1.45;
}

/* OAuth buttons */
.bc-auth-oauth {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.bc-auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 80ms ease, background 140ms ease;
  min-height: 44px;               /* 44px touch target */
}
.bc-auth-btn:active { transform: scale(0.985); }

.bc-auth-btn--google {
  background: #fff;
  color: #1a1a1a;
}
.bc-auth-btn--google:hover { background: #f2f4f7; }

.bc-auth-btn--apple {
  background: #000;
  color: #fff;
}
.bc-auth-btn--apple:hover { background: #111; }

.bc-auth-btn--email {
  background: #2b6cb0;
  color: #fff;
}
.bc-auth-btn--email:hover { background: #245e9c; }

.bc-auth-btn--primary {
  background: #ffa82b;
  color: #1b2330;
}
.bc-auth-btn--primary:hover { background: #ffb94a; }

.bc-auth-btn--ghost {
  background: transparent;
  color: #d6dde8;
  border: 1px solid rgba(255,255,255,0.15);
}
.bc-auth-btn--ghost:hover { background: rgba(255,255,255,0.05); }

.bc-auth-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.bc-auth-btn-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

/* Divider */
.bc-auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 16px;
  color: #6b7b8e;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.bc-auth-divider::before,
.bc-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.08);
}

/* Email form */
.bc-auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bc-auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bc-auth-label {
  font-size: 12px;
  font-weight: 600;
  color: #9fb3cc;
}
.bc-auth-input {
  padding: 11px 12px;
  background: #0f1620;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  font-size: 15px;                /* 16px+ avoids iOS input-zoom */
  font-family: inherit;
  min-height: 44px;
}
.bc-auth-input:focus {
  outline: none;
  border-color: #ffa82b;
  box-shadow: 0 0 0 3px rgba(255,168,43,0.18);
}
.bc-auth-input::placeholder { color: #5a6b80; }

/* Status / feedback */
.bc-auth-status {
  min-height: 18px;
  font-size: 13px;
  margin-top: 4px;
  color: #9fb3cc;
}
.bc-auth-status--error { color: #ff6b6b; }
.bc-auth-status--ok    { color: #4cc9a1; }

/* Footer link row */
.bc-auth-foot {
  margin-top: 14px;
  font-size: 12px;
  color: #6b7b8e;
  text-align: center;
  line-height: 1.5;
}
.bc-auth-foot a {
  color: #9fb3cc;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.25);
  cursor: pointer;
}
.bc-auth-foot a:hover { color: #ffa82b; }

/* -----------------------------------------------------------------------
 * Login wall — shown when a guest tries to save a mark
 * ----------------------------------------------------------------------- */
.bc-auth-wall .bc-auth-title { color: #ffa82b; }
.bc-auth-wall .bc-auth-wall-hero {
  margin: 4px 0 16px;
  padding: 14px;
  background: rgba(255,168,43,0.08);
  border: 1px solid rgba(255,168,43,0.2);
  border-radius: 12px;
  font-size: 13px;
  color: #e8d8b8;
  line-height: 1.5;
}
.bc-auth-wall-hero strong { color: #ffa82b; }

/* -----------------------------------------------------------------------
 * Sync indicator — small pill shown near the brand bar
 * ----------------------------------------------------------------------- */
.bc-sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(27, 35, 48, 0.92);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  font-size: 11px;
  color: #9fb3cc;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.bc-sync-indicator[data-state="syncing"] { color: #4cc9f0; }
.bc-sync-indicator[data-state="ok"]      { color: #4cc9a1; }
.bc-sync-indicator[data-state="error"]   { color: #ff8a8a; }
.bc-sync-indicator[data-state="guest"]   { color: #9fb3cc; }

.bc-sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.bc-sync-indicator[data-state="syncing"] .bc-sync-dot {
  animation: bc-sync-pulse 1s infinite ease-in-out;
}
@keyframes bc-sync-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.15); }
}

/* -----------------------------------------------------------------------
 * Tier badge (for header, once signed in)
 * ----------------------------------------------------------------------- */
.bc-tier-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.bc-tier-badge[data-tier="free"]  { background: rgba(255,255,255,0.08); color: #9fb3cc; }
.bc-tier-badge[data-tier="elite"] { background: #ffa82b;              color: #1b2330; }
.bc-tier-badge[data-tier="lifetime"] { background: #4cc9a1;           color: #0f1620; }

/* -----------------------------------------------------------------------
 * Mobile polish
 * ----------------------------------------------------------------------- */
@media (max-width: 480px) {
  .bc-auth-modal { padding: 20px; border-radius: 14px; }
  .bc-auth-title { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .bc-auth-scrim, .bc-auth-modal { animation: none; }
  .bc-sync-indicator[data-state="syncing"] .bc-sync-dot { animation: none; }
}

/* ============================================================================
 * v49 — Header Sign in button + user chip (lives inside .top-actions)
 * ============================================================================ */
.bc-auth-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.bc-signin-btn {
  /* Inherits .ghost base style, just needs a little brand accent on hover */
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 168, 43, 0.45);
  background: rgba(255, 168, 43, 0.08);
  color: #ffc876;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.bc-signin-btn:hover {
  background: rgba(255, 168, 43, 0.18);
  border-color: #ffa82b;
  color: #ffd59a;
}

.bc-user-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  color: #e3ecf6;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background .15s, border-color .15s;
}
.bc-user-chip:hover { background: rgba(255, 255, 255, 0.10); border-color: rgba(255, 255, 255, 0.18); }
.bc-user-chip[data-menu-open="true"] { background: rgba(255, 168, 43, 0.14); border-color: rgba(255, 168, 43, 0.45); }
.bc-user-avatar {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: #ffa82b;
  color: #1b2330;
  font-size: 14px;
  font-weight: 700;
}
.bc-user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bc-user-menu-btn {
  border: none;
  background: transparent;
  color: #9fb3cc;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 12px;
  line-height: 1;
}
.bc-user-menu-btn:hover { color: #fff; }

/* FIX 2026-04-30 v2: position is set inline by wire.js (position:fixed)
   so the menu escapes the topbar overflow clip. We keep visual styles
   here as a fallback, but DO NOT set position here. */
.bc-user-menu {
  min-width: 160px;
  background: #1b2330;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  padding: 6px;
  z-index: 99999;
}
.bc-user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: transparent;
  border: none;
  color: #e3ecf6;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}
.bc-user-menu-item:hover { background: rgba(255, 255, 255, 0.08); }

/* Mobile: tighten header slot so we don't overflow the row */
#app[data-device="mobile"] .bc-signin-btn {
  padding: 6px 10px;
  font-size: 13px;
}
#app[data-device="mobile"] .bc-user-name { max-width: 80px; font-size: 12px; }
#app[data-device="mobile"] .bc-user-chip { padding: 4px 8px; gap: 6px; }
#app[data-device="mobile"] .bc-user-avatar { width: 18px; height: 18px; font-size: 11px; }

/* Sync indicator sits beside the chip/button, subtle */
.bc-sync-indicator {
  font-size: 12px;
  color: #9fb3cc;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================================
 * v49 — Mobile: desktop topbar is hidden on mobile (body.v27-mobile).
 * We lift the auth slot out of the topbar and float it in the top-right corner
 * so Sign in / user chip remain accessible from every mobile screen.
 * ============================================================================ */
/* Ensure [hidden] wins over component display rules */
.bc-auth-slot [hidden],
#bcAuthSlot [hidden],
.bc-user-chip[hidden],
.bc-sync-indicator[hidden],
.bc-signin-btn[hidden] { display: none !important; }

@media (max-width: 720px) {
  /* On mobile we hide the topbar slot entirely — wire.js inserts a dedicated
     Account row into the v27 "More" sheet instead, which is the idiomatic
     place for secondary actions on BayCast's mobile UI. */
  #bcAuthSlot { display: none !important; }

  /* Styling for the in-sheet account row */
  .bc-sheet-account {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin: 10px 16px;
    background: rgba(27, 35, 48, 0.04);
    border: 1px solid rgba(27, 35, 48, 0.08);
    border-radius: 12px;
    cursor: pointer;
    width: calc(100% - 32px);
    text-align: left;
    color: inherit;
    font: inherit;
  }
  .bc-sheet-account:hover { background: rgba(255, 168, 43, 0.06); border-color: rgba(255, 168, 43, 0.3); }
  .bc-sheet-account-icon {
    width: 36px; height: 36px; border-radius: 50%;
    background: #ffa82b; color: #1b2330;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; flex-shrink: 0;
  }
  .bc-sheet-account-text { flex: 1; min-width: 0; }
  .bc-sheet-account-title { font-weight: 600; font-size: 15px; color: #1b2330; }
  .bc-sheet-account-sub { font-size: 12px; color: #5a6b7d; margin-top: 2px; }
  .bc-sheet-account-chev { color: #9fb3cc; font-size: 18px; }
}

/* v63.9.18 — instant-feedback spinner on sign in / sign up buttons */
.bc-auth-btn--busy { opacity: 0.85; cursor: wait; }
.bc-auth-btn--busy .bc-auth-spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  border-radius: 50%; margin-right: 8px; vertical-align: -2px;
  animation: bc-auth-spin 0.7s linear infinite;
}
.bc-auth-btn--google.bc-auth-btn--busy .bc-auth-spin,
.bc-auth-btn--apple.bc-auth-btn--busy .bc-auth-spin {
  border-color: rgba(27,35,48,0.25); border-top-color: #1b2330;
}
@keyframes bc-auth-spin { to { transform: rotate(360deg); } }
