/* ═══════════════════════════════════════════════════════════════
   FOOTER v3 — Ecosystem Knowledge Hub
   Resonance Threads — Patch #19
   
   This file OVERRIDES all previous footer styles from:
   - rt-core.css (section 4)
   - theme.css (footer section)
   Uses !important where needed to beat theme.css overrides.
═══════════════════════════════════════════════════════════════ */

/* ── BASE ── */
.site-footer {
  background: rgba(0, 0, 0, 0.92) !important;
  color: rgba(255, 255, 255, 0.7) !important;
  border-top: 1px solid rgba(255, 78, 205, 0.15) !important;
  margin: 0;
  padding: 0;
  width: 100%;
}

[data-theme="light"] .site-footer {
  background: rgba(0, 0, 0, 0.92) !important;
  color: rgba(255, 255, 255, 0.7) !important;
}

/* Override theme.css link colors */
.site-footer a {
  color: rgba(255, 255, 255, 0.45) !important;
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--rt-pink) !important;
}

/* ── FOOTER TOP — Main Grid ── */
.site-footer .footer-top {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  padding: 80px 60px 40px;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ── BRAND COLUMN ── */
.site-footer .footer-brand-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-footer .footer-logo-mark {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 3px;
  background: var(--rt-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  line-height: 1;
}

.site-footer .footer-logo-sub {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  margin-top: -4px;
}

.site-footer .footer-tagline {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4) !important;
  font-style: italic;
  line-height: 1.5;
  margin-top: 4px;
}

.site-footer .footer-social {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.site-footer .footer-social-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.4) !important;
  text-decoration: none;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.site-footer .footer-social-btn:hover {
  border-color: var(--rt-pink);
  color: var(--rt-pink) !important;
  background: rgba(255, 78, 205, 0.08);
}

.site-footer .footer-contact-mini {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35) !important;
}

.site-footer .footer-contact-mini span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.35) !important;
}

.site-footer .footer-theme-row {
  margin-top: 12px;
}

/* Combined actions row — theme toggle + install inline */
.site-footer .footer-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.site-footer .footer-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6) !important;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.2;
  height: 32px;
}

.site-footer .footer-theme-btn:hover {
  border-color: rgba(255, 78, 205, 0.4);
  color: var(--rt-pink) !important;
  background: rgba(255, 78, 205, 0.06);
}

/* ── INSTALL APP BUTTON ── */
.site-footer .footer-install-row {
  margin-top: 8px;
}

.site-footer .footer-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6) !important;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.2;
  height: 32px;
}

.site-footer .footer-install-btn svg {
  flex-shrink: 0;
  color: var(--rt-cyan);
}

.site-footer .footer-install-btn:hover {
  border-color: var(--rt-cyan);
  background: rgba(79, 220, 255, 0.08);
  color: var(--rt-cyan) !important;
  transform: translateY(-1px);
}

.site-footer .footer-install-btn:active {
  transform: translateY(0);
}

/* ── LINKS GRID ── */
.site-footer .footer-links-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
}

.site-footer .footer-col {
  display: flex;
  flex-direction: column;
}

.site-footer .footer-col-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85) !important;
  margin-bottom: 14px;
  cursor: default;
}

/* Links wrapper — always visible on desktop */
.site-footer .footer-col-links {
  display: block;
}

.site-footer .footer-col-links a {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45) !important;
  text-decoration: none;
  margin-bottom: 8px;
  transition: color 0.15s;
  line-height: 1.4;
}

.site-footer .footer-col-links a:hover {
  color: var(--rt-pink) !important;
}

.site-footer .footer-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  background: rgba(255, 78, 205, 0.15);
  color: var(--rt-pink) !important;
  margin-left: 4px;
  vertical-align: middle;
}

.site-footer .footer-badge.new {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80 !important;
}

/* ── REFER & EARN CTA ── */
.site-footer .footer-refer-cta {
  text-align: center;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(255,78,205,.05), rgba(79,220,255,.03));
  border-bottom: 1px solid rgba(255,78,205,.08);
}

.site-footer .footer-refer-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 30px;
  background: linear-gradient(135deg, #ff4ecd, #4fdcff);
  color: #000 !important;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: .4px;
  transition: all .2s;
}

.site-footer .footer-refer-btn:hover {
  color: #000 !important;
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255,78,205,0.3);
}

/* ── TRUST BADGES ── */
.site-footer .footer-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 24px 60px;
  max-width: 1400px;
  margin: 0 auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.site-footer .footer-trust-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5) !important;
}

.site-footer .footer-trust-badge svg {
  width: 18px;
  height: 18px;
  color: rgba(255, 78, 205, 0.7);
  flex-shrink: 0;
}

/* ── NEWSLETTER ── */
.site-footer .footer-newsletter {
  padding: 40px 60px;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent !important;
  border-top: none !important;
  border-bottom: none !important;
}

.site-footer .footer-newsletter-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px 32px;
}

.site-footer .footer-newsletter-text {
  flex: 1;
  min-width: 0;
}

.site-footer .footer-newsletter-title {
  font-size: 16px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9) !important;
  margin-bottom: 4px;
}

.site-footer .footer-newsletter-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4) !important;
  line-height: 1.4;
}

.site-footer .footer-newsletter-form {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.site-footer .footer-newsletter-input {
  width: 240px;
  height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  color: #fff !important;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.site-footer .footer-newsletter-input:focus {
  border-color: var(--rt-pink) !important;
}

.site-footer .footer-newsletter-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.site-footer .footer-newsletter-btn {
  height: 40px;
  padding: 0 20px;
  border-radius: 20px;
  border: none;
  background: var(--rt-grad);
  color: #000 !important;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s, transform 0.1s;
  white-space: nowrap;
}

.site-footer .footer-newsletter-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  color: #000 !important;
}

.site-footer .footer-newsletter-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.site-footer .footer-newsletter-msg {
  font-size: 12px;
  margin-top: 8px;
  padding: 0 60px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  min-height: 18px;
}

.site-footer .footer-newsletter-msg.success {
  color: #4ade80 !important;
}

.site-footer .footer-newsletter-msg.error {
  color: #f87171 !important;
}

/* ── BOTTOM BAR ── */
.site-footer .footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 60px;
  max-width: 1400px;
  margin: 0 auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  box-sizing: border-box;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer .footer-bottom-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer .footer-copyright {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35) !important;
}

.site-footer .footer-location {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3) !important;
}

.site-footer .footer-bottom-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer .footer-bottom-links a {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35) !important;
  text-decoration: none;
  transition: color 0.15s;
}

.site-footer .footer-bottom-links a:hover {
  color: var(--rt-pink) !important;
}

/* ── TABLET (769px – 1024px) ── */
@media (max-width: 1024px) {
  .site-footer .footer-top {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 60px 32px 32px;
  }

  .site-footer .footer-links-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .site-footer .footer-trust {
    padding: 20px 32px;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .site-footer .footer-newsletter {
    padding: 32px;
  }

  .site-footer .footer-newsletter-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 24px;
  }

  .site-footer .footer-newsletter-form {
    width: 100%;
  }

  .site-footer .footer-newsletter-input {
    flex: 1;
    width: auto;
  }

  .site-footer .footer-bottom {
    padding: 16px 32px;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* ── MOBILE (≤768px) ── */
@media (max-width: 768px) {
  .site-footer .footer-top {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 40px 20px 24px;
  }

  .site-footer .footer-brand-col {
    align-items: center;
    text-align: center;
  }

  .site-footer .footer-social {
    justify-content: center;
  }

  .site-footer .footer-contact-mini {
    align-items: center;
  }

  .site-footer .footer-theme-row {
    display: flex;
    justify-content: center;
  }

  /* Actions row — compact inline on mobile */
  .site-footer .footer-actions-row {
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
  }

  .site-footer .footer-actions-row .footer-theme-btn,
  .site-footer .footer-actions-row .footer-install-btn {
    padding: 5px 10px;
    font-size: 11px;
    height: 28px;
    gap: 5px;
  }

  /* Refer CTA — smaller on mobile */
  .site-footer .footer-refer-cta {
    padding: 12px 16px;
  }

  .site-footer .footer-refer-btn {
    padding: 8px 18px;
    font-size: 12px;
    gap: 6px;
  }

  /* Accordion behavior */
  .site-footer .footer-links-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .site-footer .footer-col {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .site-footer .footer-col:last-child {
    border-bottom: none;
  }

  .site-footer .footer-col-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    margin-bottom: 0;
    cursor: pointer;
    min-height: 44px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .site-footer .footer-col-title::after {
    content: '+';
    font-size: 16px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4) !important;
    transition: transform 0.3s ease;
  }

  .site-footer .footer-col-title[aria-expanded="true"]::after {
    content: '\2212';
  }

  .site-footer .footer-col-links {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .site-footer .footer-col-links.open {
    max-height: 500px;
  }

  .site-footer .footer-col-links a {
    padding: 6px 0;
  }

  /* Trust badges — 2x2 grid */
  .site-footer .footer-trust {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 20px;
  }

  .site-footer .footer-trust-badge {
    font-size: 11px;
    gap: 6px;
  }

  /* Newsletter */
  .site-footer .footer-newsletter {
    padding: 24px 20px;
  }

  .site-footer .footer-newsletter-inner {
    padding: 20px;
  }

  .site-footer .footer-newsletter-form {
    flex-direction: column;
  }

  .site-footer .footer-newsletter-input {
    width: 100% !important;
  }

  .site-footer .footer-newsletter-btn {
    width: 100%;
  }

  .site-footer .footer-newsletter-msg {
    padding: 0 20px;
  }

  /* Bottom */
  .site-footer .footer-bottom {
    padding: 16px 20px;
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .site-footer .footer-bottom-left {
    flex-direction: column;
    gap: 4px;
  }

  .site-footer .footer-bottom-links {
    justify-content: center;
    gap: 12px;
  }
}

/* ── Ensure footer sticks to bottom on short pages ── */
.page-wrapper {
  min-height: calc(100vh - 60px);
}

.site-footer {
  margin-top: auto;
}
