/* ==========================================================================
   components.css — header, nav, buttons, cards, forms, footer
   ========================================================================== */

/* ----- Header & Nav ----- */
/* The partials loader injects <header> into #site-header. Making the WRAPPER
   sticky (rather than the <header> itself) is what makes it persist while
   scrolling — sticky only works relative to its parent's scroll range. */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  will-change: transform;
}

/* Auto-hide: slide up when scrolling down, slide back in when scrolling up.
   JS toggles the .nav-hidden class based on scroll direction. */
#site-header.nav-hidden {
  transform: translateY(-100%);
}

header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 20px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Offset in-page anchor targets so they aren't hidden behind the sticky header */
:target {
  scroll-margin-top: 90px;
}
section[id] {
  scroll-margin-top: 90px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.logo i {
  margin-right: 10px;
  font-size: 2rem;
  color: #fff;
}

nav ul {
  display: flex;
  list-style: none;
  margin: 0;
}

nav ul li {
  margin-left: 30px;
}

nav ul li a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.3s;
}

nav ul li a:hover,
nav ul li a[aria-current="page"] {
  opacity: 0.9;
  text-decoration: underline;
}

/* ----- Buttons ----- */
.cta-button {
  display: inline-block;
  background-color: white;
  color: var(--primary);
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 600;
  transition: all 0.3s;
  text-decoration: none;
}

.cta-button:hover {
  background-color: var(--accent);
  color: white;
  transform: translateY(-3px);
}

.btn-primary {
  display: inline-block;
  padding: 12px 22px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(26, 115, 232, 0.3);
}

/* ----- Forms ----- */
.form-container {
  background: white;
  max-width: 820px;
  margin: 40px auto;
  padding: 30px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.form-container h2 {
  color: var(--secondary);
  border-bottom: 2px solid var(--secondary);
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.form-container h3 {
  color: var(--secondary);
  margin-top: 25px;
  font-size: 1.1em;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 15px;
}

.field.full-width {
  grid-column: span 2;
}

.field label {
  margin-bottom: 5px;
  font-weight: 600;
  font-size: 0.9em;
  color: var(--dark);
}

.field input,
.field select,
.field textarea {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--secondary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.15);
}

.radio-group {
  display: flex;
  gap: 20px;
  padding: 10px 0;
}

.radio-group label {
  font-weight: 400;
  cursor: pointer;
}

.form-message {
  margin-top: 15px;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  min-height: 1.2em;
}

.form-message.error {
  background: #fdecea;
  color: #a00;
  border: 1px solid #f5c2c0;
}

.form-message.success {
  background: #e6f4ea;
  color: #1e7e34;
  border: 1px solid #c3e6cb;
}

.form-message.info {
  background: #e7f1fb;
  color: #0d47a1;
  border: 1px solid #b6d4fe;
}

.form-message a {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}

/* ----- Auth tabs (login.html) ----- */
.auth-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.auth-tab:hover { color: #301D3D; }

.auth-tab.is-active {
  color: #301D3D;
  border-bottom-color: #301D3D;
}

/* ----- Customer portal (portal/index.html) ----- */
.portal-shell { padding: 30px 0 60px; }

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}

.portal-header h1 { margin: 0; }

.portal-subtitle {
  margin: 4px 0 0;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  opacity: 0.92;
}

.btn-secondary {
  background: #fff;
  color: #301D3D;
  border: 2px solid #301D3D;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-secondary:hover {
  background: #301D3D;
  color: #fff;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.portal-card {
  background: #fff;
  border: 1px solid #e6e6ec;
  border-radius: 12px;
  padding: 22px 22px 18px;
  box-shadow: 0 2px 6px rgba(48, 29, 61, 0.05);
}

.portal-card h2 {
  margin: 0 0 14px;
  font-size: 1.1rem;
  display: flex;
  gap: 10px;
  align-items: center;
  color: #301D3D;
}

.kv {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  font-size: 0.95rem;
}
.kv dt {
  color: #666;
  font-weight: 500;
}
.kv dd {
  margin: 0;
  color: #1a1a1a;
  word-break: break-word;
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #eee;
  color: #333;
}
.status-pill[data-status="paid"]            { background: #e6f4ea; color: #1e7e34; }
.status-pill[data-status="pending_payment"] { background: #fff3cd; color: #8a6d00; }
.status-pill[data-status="overdue"]         { background: #fdecea; color: #b3261e; }
.status-pill[data-status="suspended"]       { background: #f5c2c0; color: #6a0d0a; }
.status-pill[data-status="waitlist"]        { background: #e7f1fb; color: #0d47a1; }

.portal-note {
  margin: 14px 0 0;
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
}

.portal-coming-soon {
  margin-top: 28px;
  padding: 14px 18px;
  background: #f7f5fa;
  border: 1px dashed #cfc4dd;
  border-radius: 10px;
  color: #555;
  font-size: 0.92rem;
}

/* ----- Floating WhatsApp button (Phase 5) ----- */
.wa-float {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 0 16px;
  height: 56px;
  background: #25D366;
  color: #fff;
  border-radius: 28px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.wa-float i {
  font-size: 1.6rem;
  line-height: 1;
}

.wa-float:hover,
.wa-float:focus-visible {
  background: #1ebe5b;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(37, 211, 102, 0.55);
  color: #fff;
  outline: none;
}

.wa-float:focus-visible {
  outline: 3px solid rgba(37, 211, 102, 0.4);
  outline-offset: 3px;
}

/* Pulse halo to draw the eye on first paint */
.wa-float::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.55);
  animation: wa-pulse 2.4s ease-out infinite;
  pointer-events: none;
}

@keyframes wa-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
  70%  { box-shadow: 0 0 0 18px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

@media (max-width: 640px) {
  .wa-float {
    right: 14px;
    bottom: 14px;
    padding: 0;
    width: 56px;
    justify-content: center;
  }
  .wa-float-label {
    display: none;
  }
}

@media print {
  .wa-float { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wa-float::before { animation: none; }
}

/* ----- Coverage checker (order.html Step 1) ----- */
.coverage-container {
  margin-top: 30px;
}

.coverage-search {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-top: 18px;
}

.coverage-input-wrap {
  position: relative;
  flex: 1;
}

.coverage-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  pointer-events: none;
}

#coverage-input {
  width: 100%;
  padding: 14px 14px 14px 40px;
  border: 1px solid #ccc;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}

#coverage-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.15);
}

.coverage-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
}

.coverage-suggestions li {
  padding: 10px 14px;
  font-size: 0.95rem;
  color: var(--dark);
  cursor: pointer;
  transition: background 0.15s;
}

.coverage-suggestions li:hover,
.coverage-suggestions li:focus {
  background: var(--light);
}

.coverage-btn {
  white-space: nowrap;
  padding: 0 22px;
}

.coverage-btn i {
  margin-right: 6px;
}

.coverage-result {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  line-height: 1.5;
  border-left: 4px solid;
}

.coverage-result i {
  margin-right: 6px;
}

.coverage-result.success {
  background: #e6f4ea;
  color: #1e7e34;
  border-color: #1e7e34;
}

.coverage-result.warning {
  background: #fff8cc;
  color: #856404;
  border-color: var(--warning);
}

.coverage-result.error {
  background: #fdecea;
  color: #a00;
  border-color: #a00;
}

@media (max-width: 640px) {
  .coverage-search {
    flex-direction: column;
  }
  .coverage-btn {
    width: 100%;
    padding: 12px;
  }
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field.full-width {
    grid-column: span 1;
  }
}

/* ----- Footer ----- */
footer {
  background-color: var(--dark);
  color: white;
  padding: 60px 0 30px;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: 40px;
}

.footer-column {
  flex: 1;
  min-width: 250px;
  margin-bottom: 30px;
}

.footer-column h3 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--accent);
}

.footer-column ul {
  list-style: none;
}

.footer-column ul li {
  margin-bottom: 10px;
}

.footer-column ul li a {
  color: #ddd;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-column ul li a:hover {
  color: var(--accent);
}

.contact-info li {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.contact-info li i {
  margin-right: 10px;
  color: var(--accent);
  width: 20px;
}

.copyright {
  text-align: center;
  padding-top: 30px;
  border-top: 1px solid #444;
  color: #aaa;
  font-size: 0.9rem;
}

.copyright a {
  color: #aaa;
}

/* ----- Mobile hamburger ----- */
.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.55rem;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.18s ease;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

/* Responsive nav */
@media (max-width: 992px) {
  header { position: relative; }

  .header-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }

  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }

  .logo { font-size: 1.25rem; }
  .logo i { font-size: 1.45rem; margin-right: 8px; }

  header nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  }

  header nav.is-open { max-height: 70vh; }

  header nav ul {
    flex-direction: column;
    align-items: stretch;
    margin: 0;
    padding: 8px 0 14px;
  }

  header nav ul li { margin: 0; }

  header nav ul li a {
    display: block;
    padding: 14px 24px;
    width: 100%;
  }

  /* Keep Sign Up as a compact white pill, left-aligned under Login */
  header nav ul li a.cta-button {
    display: inline-block;
    width: auto;
    padding: 7px 22px;
    margin: 6px 24px 8px;
    font-size: 0.92rem;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .footer-column {
    min-width: 100%;
  }

  /* Tighten container side padding on small screens */
  .container { padding: 0 16px; }

  /* Forms */
  .field input,
  .field select,
  .field textarea { font-size: 0.95rem; padding: 10px 12px; }
  .field label { font-size: 0.92rem; }

  /* Footer typography */
  .footer-column h3 { font-size: 1rem; }
  .footer-column a,
  .footer-column li,
  .footer-column p { font-size: 0.9rem; }
  .copyright { font-size: 0.82rem; }
}
