/**
 * HMi Custom Plugin — Frontend CSS
 * Styles for Contact Hub (FAB) and Mobile Bottom Bar.
 * Uses CSS custom properties from the HMi child theme where possible.
 * All selectors are scoped to .hmi-* to avoid Impreza collisions.
 */

/* ============================================================================
   Design Tokens (fallback — child theme overrides these)
   ============================================================================ */
:root {
  --hmi-teal-50:  #eefbfb;
  --hmi-teal-100: #d5f4f5;
  --hmi-teal-400: #3abcc6;
  --hmi-teal-500: #007078;
  --hmi-teal-600: #005a60;
  --hmi-violet-500: #4c3e80;
  --hmi-ink:       #1b2029;
  --hmi-ink-light: #4a5568;
}


/* ============================================================================
   CONTACT HUB — FAB + Panel (Desktop only)
   ============================================================================ */

.hmi-contact-hub {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  z-index: 9990;
}

@media (min-width: 1024px) {
  .hmi-contact-hub {
    display: block;
  }
}

.hmi-contact-hub--right { right: 1.5rem; }
.hmi-contact-hub--left  { left: 1.5rem; }

/* ── Panel ──────────────────────────────────────────────────────── */
.hmi-contact-hub__panel {
  position: absolute;
  bottom: 100%;
  margin-bottom: 0.75rem;
  width: 20rem;
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(0, 112, 120, 0.08);
  border-top: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 40px rgba(0,112,120,0.12), 0 2px 8px rgba(0,0,0,0.06);

  /* Hidden by default */
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hmi-contact-hub--right .hmi-contact-hub__panel { right: 0; }
.hmi-contact-hub--left  .hmi-contact-hub__panel { left: 0; }

.hmi-contact-hub__panel.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Decorative dot pattern */
.hmi-contact-hub__dots {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 33%;
  background-image: radial-gradient(circle, rgba(0,112,120,0.12) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.3;
  mask-image: radial-gradient(ellipse at top right, black 15%, transparent 65%);
  -webkit-mask-image: radial-gradient(ellipse at top right, black 15%, transparent 65%);
  pointer-events: none;
}

/* Top stripe */
.hmi-contact-hub__stripe {
  height: 4px;
  background: linear-gradient(to right, var(--hmi-teal-400), var(--hmi-teal-500), var(--hmi-teal-600));
}

/* Header */
.hmi-contact-hub__header {
  position: relative;
  padding: 1rem 1.25rem;
}

.hmi-contact-hub__title {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--hmi-ink);
  margin: 0;
}

.hmi-contact-hub__subtitle {
  font-size: 0.75rem;
  color: var(--hmi-ink-light);
  margin: 0.125rem 0 0;
}

/* Contact options */
.hmi-contact-hub__options {
  position: relative;
  padding: 0 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hmi-contact-hub__option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.75rem;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.hmi-contact-hub__option:hover {
  background: rgba(255, 255, 255, 0.7);
}

/* Icon containers */
.hmi-contact-hub__icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.hmi-contact-hub__option:hover .hmi-contact-hub__icon {
  transform: scale(1.1);
}

.hmi-contact-hub__icon--teal {
  background: linear-gradient(135deg, rgba(0,112,120,0.08), rgba(76,62,128,0.06));
  color: var(--hmi-teal-600);
}

.hmi-contact-hub__icon--teal-light {
  background: linear-gradient(135deg, rgba(0,112,120,0.08), rgba(76,62,128,0.06));
  color: var(--hmi-teal-500);
}

.hmi-contact-hub__icon--green {
  background: linear-gradient(135deg, rgba(37,211,102,0.10), rgba(37,211,102,0.06));
  color: #16a34a;
}

.hmi-contact-hub__icon--violet {
  background: linear-gradient(135deg, rgba(76,62,128,0.10), rgba(0,112,120,0.06));
  color: var(--hmi-violet-500);
}

/* Option text */
.hmi-contact-hub__option-label {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  color: var(--hmi-ink);
  transition: color 0.15s ease;
}

.hmi-contact-hub__option:hover .hmi-contact-hub__option-label {
  color: var(--hmi-teal-500);
}

.hmi-contact-hub__option-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--hmi-ink-light);
}

/* Footer */
.hmi-contact-hub__footer {
  position: relative;
  padding: 0.625rem 1.25rem;
  border-top: 1px solid rgba(0, 112, 120, 0.1);
  text-align: center;
  font-size: 0.625rem;
  color: var(--hmi-ink-light);
}

/* ── FAB pill group ─────────────────────────────────────────────── */
.hmi-contact-hub__fab-group {
  position: relative;
}

/* Progress bar */
.hmi-contact-hub__progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3.5rem;
  height: 2px;
  overflow: hidden;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.hmi-contact-hub__progress-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
}

.hmi-contact-hub__progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.65);
  transition: width 0.15s ease-out;
}

/* Pill buttons */
.hmi-contact-hub__pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 9999px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.08);
}

/* Scroll-to-top */
.hmi-contact-hub__scroll-top {
  width: 3.5rem;
  max-height: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  border: none;
  background: rgba(0, 112, 120, 0.9);
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: max-height 0.25s ease, height 0.25s ease, opacity 0.2s ease,
              background-color 0.15s ease, color 0.15s ease;
}

.hmi-contact-hub__scroll-top.is-visible {
  max-height: 3rem;
  height: 3rem;
  opacity: 1;
  pointer-events: auto;
}

.hmi-contact-hub__scroll-top:hover {
  background: var(--hmi-teal-500);
  color: #fff;
}

/* FAB button */
.hmi-contact-hub__fab-btn {
  width: 3.5rem;
  height: 3.5rem;
  border: none;
  background: var(--hmi-teal-500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.hmi-contact-hub__fab-btn:hover {
  background: rgba(0, 112, 120, 0.9);
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 112, 120, 0.3);
}

/* Icon swap */
.hmi-contact-hub__icon-close {
  display: none;
}

/* ── Backdrop ───────────────────────────────────────────────────── */
.hmi-contact-hub__backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(0px);
  background: rgba(0, 0, 0, 0);
  transition: opacity 0.3s ease, backdrop-filter 0.3s ease, background 0.3s ease;
}

.hmi-contact-hub__backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.2);
}


/* ============================================================================
   MOBILE BOTTOM BAR (Mobile only)
   ============================================================================ */

.hmi-mobile-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9990;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s ease;
}

@media (min-width: 1024px) {
  .hmi-mobile-bar {
    display: none;
  }
}

.hmi-mobile-bar__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.hmi-mobile-bar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 0;
  text-decoration: none;
  color: var(--hmi-ink-light);
  transition: color 0.15s ease;
}

.hmi-mobile-bar__item:hover {
  color: var(--hmi-teal-500);
}

/* Middle item border */
.hmi-mobile-bar__item:nth-child(2) {
  border-left: 1px solid #f3f4f6;
  border-right: 1px solid #f3f4f6;
}

.hmi-mobile-bar__icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  transition: background-color 0.15s ease;
}

.hmi-mobile-bar__item:hover .hmi-mobile-bar__icon {
  background: var(--hmi-teal-50);
}

.hmi-mobile-bar__label {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.125rem;
}

/* Hidden state (scroll-down auto-hide) */
.hmi-mobile-bar--hidden {
  transform: translateY(100%);
}


/* ============================================================================
   Reduced Motion
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
  .hmi-contact-hub__panel,
  .hmi-contact-hub__backdrop,
  .hmi-contact-hub__scroll-top,
  .hmi-contact-hub__fab-btn,
  .hmi-contact-hub__icon,
  .hmi-contact-hub__option,
  .hmi-contact-hub__progress-track,
  .hmi-mobile-bar {
    transition: none;
  }
}
