/* ===========================================================================
   Aurora Trust Bank support dock.

   A branded launcher and panel replacing the stock chat bubble. Self-contained:
   depends only on the tokens in aurora.css, and falls back to literal colours
   if it is ever loaded on a page without them.
   ======================================================================== */

.atb-support {
  --atb-midnight: var(--primary-800, #00203F);
  --atb-navy:     var(--primary-600, #003366);
  --atb-boreal:   var(--accent, #00C897);
  --atb-boreal-3: var(--accent-300, #4FE0BB);
  --atb-surface:  var(--surface, #FFFFFF);
  --atb-ink:      var(--font-color, #333333);
  --atb-muted:    var(--font-secondary, #5A6B72);
  --atb-line:     var(--border, #DDE5E3);

  position: fixed;
  right: clamp(1rem, 3vw, 1.75rem);
  bottom: clamp(1rem, 3vw, 1.75rem);
  z-index: 1400;
  font-family: var(--font-sans, system-ui, sans-serif);
}

/* ------------------------------------------------------------- launcher */

.atb-support__launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--atb-navy), var(--atb-midnight));
  color: #fff;
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 32, 63, 0.32), 0 0 0 0 rgba(0, 200, 151, 0.5);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.atb-support__launcher:hover { transform: translateY(-3px) scale(1.04); }
.atb-support__launcher:active { transform: translateY(0) scale(0.98); }
.atb-support__launcher:focus-visible {
  outline: 3px solid var(--atb-boreal);
  outline-offset: 3px;
}

/* A slow aurora halo, drawing the eye without nagging. */
.atb-support__pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--atb-boreal), transparent 35%, var(--atb-boreal-3) 60%, transparent 85%, var(--atb-boreal));
  opacity: 0.55;
  z-index: -1;
  animation: atb-spin 6s linear infinite;
}
@keyframes atb-spin { to { transform: rotate(360deg); } }

.atb-support__icon-close { display: none; }
.atb-support.is-open .atb-support__icon-open { display: none; }
.atb-support.is-open .atb-support__icon-close { display: block; }
.atb-support.is-open .atb-support__launcher { background: var(--atb-midnight); }
.atb-support.is-open .atb-support__pulse { animation-play-state: paused; opacity: 0.25; }

/* A class-level `display` outranks the user-agent rule for [hidden], so the
   badge must opt out explicitly or it shows a permanent zero. */
.atb-support__badge[hidden] { display: none; }

.atb-support__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #C0392B;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border: 2px solid var(--atb-surface);
}

/* ---------------------------------------------------------------- panel */

.atb-support__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: min(370px, calc(100vw - 2rem));
  overflow: hidden;
  border-radius: 20px;
  background: var(--atb-surface);
  box-shadow: 0 28px 70px rgba(0, 32, 63, 0.28);
  transform-origin: bottom right;
  animation: atb-in 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
.atb-support__panel[hidden] { display: none; }

@keyframes atb-in {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to   { opacity: 1; transform: none; }
}

/* ----------------------------------------------------------------- head */

.atb-support__head {
  position: relative;
  overflow: hidden;
  padding: 1.4rem 1.35rem 1.2rem;
  background: linear-gradient(150deg, var(--atb-midnight), var(--atb-navy) 70%, #0A4A85);
  color: #fff;
}

/* The same drifting aurora used on the hero, in miniature. */
.atb-support__aurora {
  position: absolute;
  inset: -40% -20% auto -20%;
  height: 160%;
  background:
    radial-gradient(closest-side, rgba(0, 200, 151, 0.55), transparent 70%),
    radial-gradient(closest-side, rgba(79, 224, 187, 0.35), transparent 70%);
  background-position: 20% 30%, 75% 60%;
  background-size: 60% 60%, 55% 55%;
  background-repeat: no-repeat;
  filter: blur(24px);
  animation: atb-drift 14s ease-in-out infinite alternate;
}
@keyframes atb-drift {
  from { transform: translate3d(-6%, 0, 0) scale(1); }
  to   { transform: translate3d(8%, 6%, 0) scale(1.15); }
}

.atb-support__head-inner { position: relative; z-index: 1; }

.atb-support__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}

.atb-support__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9AA7AD;
  box-shadow: 0 0 0 0 rgba(0, 200, 151, 0.6);
}
.atb-support__dot.is-open {
  background: var(--atb-boreal);
  animation: atb-breathe 2.4s ease-in-out infinite;
}
.atb-support__dot.is-closed { background: #D68910; }
@keyframes atb-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 200, 151, 0.6); }
  50%      { box-shadow: 0 0 0 6px rgba(0, 200, 151, 0); }
}

.atb-support__head h2 {
  margin: 0 0 0.3rem;
  font-family: var(--font-display, inherit);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}
.atb-support__sub {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
}
.atb-support__sub strong { color: var(--atb-boreal-3); }

/* -------------------------------------------------------------- channels */

.atb-support__body { padding: 0.6rem; display: grid; gap: 0.25rem; }

.atb-channel {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.75rem 0.8rem;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--atb-ink);
  text-align: left;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  transition: background 200ms, transform 200ms;
}
.atb-channel:hover { background: var(--gray-50, #F7F9F9); transform: translateX(2px); }
.atb-channel:focus-visible { outline: 3px solid var(--atb-boreal); outline-offset: -2px; }

.atb-channel__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-pale, #E6FAF4);
  color: var(--accent-700, #007A7C);
  font-size: 1rem;
}
.atb-channel--urgent .atb-channel__icon { background: #FBEBE9; color: #C0392B; }

.atb-channel__text { display: grid; gap: 1px; min-width: 0; flex: 1; }
.atb-channel__text strong { font-size: 0.9rem; font-weight: 600; color: var(--primary, #003366); }
.atb-channel__meta  { font-size: 0.82rem; color: var(--atb-muted); overflow-wrap: anywhere; }
.atb-channel__hours { font-size: 0.72rem; color: var(--thin-font-color, #7C8B92); }

.atb-channel__go {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--gray-300, #C3D0CE);
  transition: transform 200ms, color 200ms;
}
.atb-channel:hover .atb-channel__go { transform: translateX(3px); color: var(--atb-boreal); }

/* A chat row that is offline stays clickable, but says so. */
.atb-channel.is-offline .atb-channel__icon { background: var(--gray-100, #EEF2F1); color: var(--gray-500, #7C8B92); }

/* ----------------------------------------------------------------- foot */

.atb-support__foot {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.85rem 1.2rem 1.1rem;
  border-top: 1px solid var(--atb-line);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--atb-muted);
}
.atb-support__foot i { margin-top: 2px; color: var(--accent-700, #007A7C); }

/* --------------------------------------------------------------- mobile */

@media (max-width: 480px) {
  .atb-support { right: 0.9rem; bottom: 0.9rem; }
  .atb-support__launcher { width: 54px; height: 54px; font-size: 1.2rem; }
  .atb-support__panel { width: calc(100vw - 1.8rem); }
}

/* The customer area has a fixed bottom navigation bar below 768px; lift the
   launcher clear of it so it never covers the Transfer button. */
@media (max-width: 768px) {
  body.app-body .atb-support { bottom: calc(72px + 0.9rem); }
}

/* Stock Tawk launcher stays hidden: this dock is the only entry point. */
.atb-support ~ iframe[src*="tawk.to"][title*="chat" i],
iframe.widget-visible[src*="tawk.to"] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .atb-support__pulse,
  .atb-support__aurora,
  .atb-support__dot.is-open { animation: none; }
  .atb-support__panel { animation: none; }
  .atb-support__launcher,
  .atb-channel { transition: none; }
}
