/* ============================================================
   M3U-EDIT.COM v2 — Site Footer v2
   Location: assets/css/footer.css

   Loaded site-wide (after main.css + header.css in layouts/header.php).
   Adds the 4-column footer + newsletter form + trust bar without
   disturbing the existing .site-footer / .footer-grid / .footer-col
   selectors that other pages may still reference.

   Mobile pattern: each non-brand column collapses behind a <details>
   element so the page footprint stays small on small screens.
   Desktop forces all columns open via @media (min-width: 760px).
   ============================================================ */

/* ---------- BASE SHELL ---------- */
.site-footer.site-footer--v2 {
  position: relative;
  margin-top: 64px;
  background:
    linear-gradient(180deg, rgba(99, 102, 241, 0.03) 0%, transparent 30%),
    var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 56px 0 28px;
  color: var(--text-secondary);
}
[data-theme="dark"] .site-footer.site-footer--v2 {
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.05) 0%, transparent 30%),
    var(--bg-secondary);
}

.site-footer--v2 .container {
  max-width: 1280px;
}

/* ---------- 4-COLUMN GRID ---------- */
.site-footer--v2 .footer-grid--v2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px 32px;
  margin-bottom: 40px;
}

@media (max-width: 980px) {
  .site-footer--v2 .footer-grid--v2 {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
  .site-footer--v2 .footer-col-legal {
    grid-column: 2 / span 2;
    border-top: 1px solid var(--border);
    padding-top: 24px;
  }
}

@media (max-width: 760px) {
  .site-footer.site-footer--v2 { padding-top: 40px; }
  .site-footer--v2 .footer-grid--v2 {
    grid-template-columns: 1fr;
    gap: 4px;
    margin-bottom: 28px;
  }
  .site-footer--v2 .footer-col-legal {
    grid-column: auto;
    border-top: none;
    padding-top: 0;
  }
}

/* ---------- BRAND COLUMN ---------- */
.site-footer--v2 .footer-brand .logo {
  font-size: 22px;
  margin-bottom: 14px;
}

.site-footer--v2 .footer-tagline {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 20px;
  max-width: 380px;
}

/* ---------- NEWSLETTER FORM ---------- */
.newsletter-form {
  max-width: 380px;
}

.newsletter-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.newsletter-input-row input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.newsletter-input-row input[type="email"]::placeholder {
  color: var(--text-muted);
}
.newsletter-input-row input[type="email"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.newsletter-submit {
  flex-shrink: 0;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 200ms ease, transform 200ms ease, box-shadow 200ms ease;
  font-family: inherit;
}
.newsletter-submit:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(99, 102, 241, 0.45);
}

.newsletter-hint {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------- COLUMN HEADINGS (mobile-collapsible <details>) ---------- */
.site-footer--v2 .footer-col {
  min-width: 0;
}

.site-footer--v2 .footer-col h4,
.site-footer--v2 .footer-col-summary {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 14px;
  display: block;
  cursor: default;
}

/* <details> base — appears as a button on mobile */
.site-footer--v2 .footer-col-details {
  margin: 0;
  padding: 0;
  border: none;
}
.site-footer--v2 .footer-col-summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  transition: color 200ms ease;
  user-select: none;
}
.site-footer--v2 .footer-col-summary::-webkit-details-marker { display: none; }
.site-footer--v2 .footer-col-summary::marker { display: none; content: ''; }

.site-footer--v2 .footer-col-summary .footer-col-caret {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 240ms var(--ease-out-back, cubic-bezier(0.34, 1.56, 0.64, 1));
  flex-shrink: 0;
}
.site-footer--v2 .footer-col-details[open] .footer-col-summary .footer-col-caret {
  transform: rotate(180deg);
}
.site-footer--v2 .footer-col-details[open] .footer-col-summary {
  color: var(--primary);
}

/* ---------- LIST LINKS ---------- */
.site-footer--v2 .footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-footer--v2 .footer-col li a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  position: relative;
  transition: color 200ms ease, transform 200ms ease;
}
.site-footer--v2 .footer-col li a:hover {
  color: var(--primary);
  transform: translateX(3px);
  text-decoration: none;
}

/* ---------- DESKTOP: FORCE OPEN ----------
   On large screens we want all columns expanded. Restore the
   non-clickable <h4>-like appearance for the summary, hide the
   caret, and unforce the [open] state's underline. */
@media (min-width: 760px) {
  .site-footer--v2 .footer-col-summary {
    cursor: default;
    border-bottom: none;
    padding: 0;
    margin: 0 0 14px;
    color: var(--text);
  }
  .site-footer--v2 .footer-col-summary .footer-col-caret { display: none; }
  .site-footer--v2 .footer-col-details:not([open]) > ul { display: flex !important; }
  .site-footer--v2 .footer-col-details[open] .footer-col-summary { color: var(--text); }
}

/* Mobile-only: animate the list expand smoothly */
@media (max-width: 759px) {
  .site-footer--v2 .footer-col-details > ul {
    padding: 14px 0 18px 0;
    animation: footerColExpand 280ms var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
  }
  @keyframes footerColExpand {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* ---------- BOTTOM BAR ---------- */
.site-footer--v2 .footer-bottom--v2 {
  border-top: 1px solid var(--border);
  padding-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.site-footer--v2 .footer-copy { font-weight: 500; }

.site-footer--v2 .footer-center {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.site-footer--v2 .footer-trust {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.site-footer--v2 .footer-trust-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full, 999px);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: border-color 200ms ease, color 200ms ease;
}
.site-footer--v2 .footer-trust-item:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.site-footer--v2 .footer-trust-item svg {
  width: 14px;
  height: 14px;
}
.site-footer--v2 .footer-trust-link {
  color: var(--text-muted);
  text-decoration: none;
}
.site-footer--v2 .footer-heart {
  width: 14px;
  height: 14px;
  color: #ef4444;
}

/* ---------- SOCIAL ICONS (slot — only renders when real accounts exist) ---------- */
.site-footer--v2 .footer-social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.site-footer--v2 .footer-social a {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: border-color 200ms ease, color 200ms ease, transform 200ms ease;
}
.site-footer--v2 .footer-social a:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  text-decoration: none;
}
.site-footer--v2 .footer-social svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 760px) {
  .site-footer--v2 .footer-bottom--v2 {
    flex-direction: column;
    text-align: center;
    gap: 14px;
  }
  .site-footer--v2 .footer-trust {
    justify-content: center;
  }
}

/* ---------- POPULAR SEARCHES (Phase 7 SEO) ---------- */
.site-footer--v2 .footer-popular-searches {
  margin: 0 0 28px;
  padding: 14px 0 18px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.site-footer--v2 .footer-popular-searches__label {
  display: block;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #94a3b8);
}

.site-footer--v2 .footer-popular-searches__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer--v2 .footer-popular-searches__list a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary, #94a3b8);
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

/* Leading magnifier glyph → reads as a "search pill" (masked, inherits colour) */
.site-footer--v2 .footer-popular-searches__list a::before {
  content: '';
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  background-color: currentColor;
  opacity: 0.7;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") center / contain no-repeat;
}

.site-footer--v2 .footer-popular-searches__list a:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-secondary);
  text-decoration: none;
}

@media (max-width: 760px) {
  .site-footer--v2 .footer-popular-searches {
    margin-bottom: 20px;
    padding-bottom: 14px;
  }

  .site-footer--v2 .footer-popular-searches__list {
    gap: 8px 12px;
  }
}

.site-footer--v2 .footer-languages {
  margin: 0 0 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.site-footer--v2 .footer-languages__label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #94a3b8);
}

.site-footer--v2 .footer-languages__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer--v2 .footer-languages__list a {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  text-decoration: none;
}

.site-footer--v2 .footer-languages__list a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Screen-reader only utility */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced-motion guard */
@media (prefers-reduced-motion: reduce) {
  .site-footer--v2 .footer-col-summary .footer-col-caret,
  .site-footer--v2 .newsletter-submit,
  .site-footer--v2 .footer-col li a,
  .site-footer--v2 .footer-trust-item,
  .site-footer--v2 .footer-social a {
    transition: none !important;
    animation: none !important;
  }
}
