/**
 * Global site components — footer, back-to-top (all pages).
 */

/* Sticky header: keep nav readable over dark sections (footer, etc.) */
.apm-header.is-scrolled {
  background: rgba(255, 255, 255, 0.98) !important;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08), 0 8px 28px rgba(15, 23, 42, 0.06);
}

.apm-header.is-scrolled .apm-nav > li > a {
  color: #0f172a;
}

.apm-header.is-scrolled .apm-header__login {
  color: #334155;
}

.apm-header.is-scrolled .apm-nav .current-menu-item > a,
.apm-header.is-scrolled .apm-nav .current-menu-ancestor > a,
.apm-header.is-scrolled .apm-nav .current_page_parent > a {
  color: var(--apm-primary);
}

/* ─── Footer premium ─── */
.apm-footer--premium {
  background: var(--apm-footer-bg);
  color: rgba(255, 255, 255, 0.85);
  padding: 5rem 0 0;
  margin-top: 0;
}

.apm-footer--premium .apm-footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.apm-footer--premium h4 {
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 1.25rem;
}

.apm-footer--premium a {
  color: rgba(255, 255, 255, 0.75);
  transition: color 0.2s;
}

.apm-footer--premium a:hover {
  color: #fff;
}

.apm-footer--premium .apm-footer__brand p {
  font-size: 0.9375rem;
  line-height: 1.7;
  opacity: 0.8;
  margin: 0.75rem 0 1.5rem;
}

.apm-footer--premium .apm-footer__newsletter {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.apm-footer--premium .apm-footer__newsletter p {
  font-size: 0.875rem;
  opacity: 0.8;
  margin: 0 0 12px;
}

.apm-footer--premium .apm-footer__newsletter-form {
  display: flex;
  gap: 8px;
}

.apm-footer--premium .apm-footer__newsletter-form input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.875rem;
  font-family: inherit;
}

.apm-footer--premium .apm-footer__newsletter-form input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.apm-footer--premium .apm-footer__newsletter-form button {
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: var(--apm-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.8125rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, transform 0.2s;
}

.apm-footer--premium .apm-footer__newsletter-form button:hover {
  background: #3b82f6;
  transform: translateY(-1px);
}

.apm-footer--premium .apm-footer__social {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.apm-footer--premium .apm-footer__social a {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s, transform 0.25s, border-color 0.25s;
}

.apm-footer--premium .apm-footer__social a:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.apm-footer--premium .apm-footer__map {
  border-radius: 12px;
  overflow: hidden;
  margin-top: 0;
  height: 100%;
  min-height: 360px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.apm-footer--premium .apm-footer__map iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: 0;
  filter: grayscale(30%) contrast(1.05);
}

.apm-footer--premium .apm-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.5rem 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.875rem;
  opacity: 0.7;
}

.apm-footer--premium .apm-footer__bottom p {
  margin: 0;
}

.apm-footer--premium .apm-footer__legal {
  display: flex;
  gap: 1.5rem;
}

.apm-footer--premium .apm-footer__legal a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
}

/* Override basic footer from main.css when premium */
.apm-footer.apm-footer--premium {
  background: var(--apm-footer-bg);
}

/* ─── Floating contact (homepage) ─── */
.apm-floating-contact {
  position: fixed;
  right: 2rem;
  bottom: calc(2rem + 48px + 14px);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.apm-floating-contact .apm-fab {
  pointer-events: auto;
}

.apm-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  color: #fff;
}

.apm-fab:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
  color: #fff;
}

.apm-fab--phone {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
}

.apm-fab--zalo {
  background: #fff;
  color: #0068ff;
  border: 1px solid #e2e8f0;
  position: relative;
}

.apm-fab--zalo::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 8px solid #fff;
  filter: drop-shadow(-1px 0 0 #e2e8f0);
}

.apm-fab__zalo-text {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0068ff;
}

.apm-fab--facebook {
  background: #1877f2;
}

.apm-fab--map {
  background: #fff;
  border: 1px solid #e2e8f0;
}

/* ─── Academy floating CTAs ─── */
.apm-academy-cta {
  position: fixed;
  right: 1.25rem;
  bottom: calc(2rem + 48px + 20px);
  z-index: 1002;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: none;
}

.apm-academy-cta__btn {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e4ed8;
  color: #fff;
  box-shadow: 0 10px 28px rgba(30, 78, 216, 0.35);
  cursor: pointer;
  text-decoration: none;
  pointer-events: auto;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.apm-academy-cta__btn:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 14px 34px rgba(30, 78, 216, 0.42);
  background: #1639a8;
  color: #fff;
}

.apm-academy-cta__ring {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  pointer-events: none;
}

.apm-academy-cta__label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.apm-academy-consult-modal {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.apm-academy-consult-modal[hidden] {
  display: none;
}

.apm-academy-consult-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
}

.apm-academy-consult-modal__dialog {
  position: relative;
  width: min(440px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.apm-academy-consult-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.apm-academy-consult-modal__eyebrow {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--apm-primary, #1e4ed8);
}

.apm-academy-consult-modal__head h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.apm-academy-consult-modal__close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: #334155;
  cursor: pointer;
  flex-shrink: 0;
}

.apm-academy-consult-modal__desc {
  margin: 0 0 18px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #64748b;
}

.apm-academy-consult-modal__form .apm-form-group {
  margin-bottom: 12px;
}

.apm-academy-consult-modal__form label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
}

.apm-academy-consult-modal__form input,
.apm-academy-consult-modal__form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font: inherit;
  color: #0f172a;
  background: #fff;
}

.apm-academy-consult-modal__form input:focus,
.apm-academy-consult-modal__form textarea:focus {
  outline: none;
  border-color: var(--apm-primary, #1e4ed8);
  box-shadow: 0 0 0 3px rgba(30, 78, 216, 0.15);
}

/* ─── Back to top ─── */
.apm-back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  left: auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--apm-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 40px rgba(11, 94, 215, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s, background 0.2s;
  z-index: 999;
  margin: 0;
  padding: 0;
}

.apm-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.apm-back-to-top:hover {
  background: var(--apm-primary-dark);
}

@media (max-width: 1024px) {
  .apm-footer--premium .apm-footer__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  .apm-footer--premium {
    padding-top: 3.5rem;
  }

  .apm-footer--premium .apm-footer__grid {
    grid-template-columns: 1fr;
  }

  .apm-footer--premium .apm-footer__bottom {
    flex-direction: column;
    text-align: center;
  }

  .apm-footer--premium .apm-footer__legal {
    justify-content: center;
  }

  .apm-footer--premium .apm-footer__newsletter-form {
    flex-direction: column;
  }

  .apm-back-to-top {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
  }

  .apm-floating-contact {
    right: 1.25rem;
    bottom: calc(1.25rem + 44px + 12px);
    gap: 8px;
  }

  .apm-fab {
    width: 48px;
    height: 48px;
  }

  .apm-fab--zalo::before {
    display: none;
  }

  .apm-academy-cta {
    right: 0.85rem;
    bottom: calc(1.25rem + 44px + 16px);
    gap: 10px;
  }

  .apm-academy-cta__btn {
    width: 64px;
    height: 64px;
  }

  .apm-academy-cta__label {
    font-size: 0.62rem;
  }
}

.apm-footer__top {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: clamp(32px, 5vw, 64px);
  padding-bottom: clamp(32px, 4vw, 48px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.apm-footer__categories {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  flex: 1;
  min-width: 0;
}

.apm-footer__contact {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 420px);
  gap: clamp(28px, 4vw, 48px);
  align-items: stretch;
  padding: clamp(32px, 4vw, 48px) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.apm-footer__contact--with-profile {
  grid-template-columns: minmax(0, 1.05fr) minmax(240px, 300px) minmax(260px, 400px);
}

.apm-footer__profile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 20px;
  border-radius: 16px;
  background:
    linear-gradient(160deg, rgba(30, 78, 216, 0.28) 0%, rgba(15, 23, 42, 0.35) 48%, rgba(8, 47, 73, 0.4) 100%);
  border: 1px solid rgba(147, 197, 253, 0.28);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  overflow: hidden;
  align-self: stretch;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.apm-footer__profile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(145deg, rgba(147, 197, 253, 0.55), rgba(255, 255, 255, 0.08) 40%, rgba(56, 189, 248, 0.35));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.apm-footer__profile-glow {
  position: absolute;
  top: -40%;
  right: -20%;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.35) 0%, transparent 70%);
  pointer-events: none;
}

.apm-footer__profile:hover {
  transform: translateY(-3px);
  border-color: rgba(147, 197, 253, 0.45);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(147, 197, 253, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.apm-footer__profile-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.apm-footer__profile-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.apm-footer__profile-logo img {
  display: block;
  width: auto;
  max-width: 128px;
  height: 32px;
  object-fit: contain;
}

.apm-footer__profile-chip {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #0f172a;
  background: linear-gradient(135deg, #93c5fd 0%, #e0f2fe 100%);
  box-shadow: 0 2px 8px rgba(147, 197, 253, 0.35);
}

.apm-footer__profile-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin-top: auto;
}

.apm-footer__profile-eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #93c5fd;
}

.apm-footer__profile-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
}

.apm-footer__profile-file {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.45;
}

.apm-footer__profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 11px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff 0%, #e2e8f0 100%);
  color: #0f172a !important;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.apm-footer__profile-btn:hover {
  background: #fff;
  color: #0f172a !important;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.apm-footer__contact h4 {
  margin: 0 0 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.apm-footer__company {
  margin: 0 0 20px;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
  color: #fff;
}

.apm-footer__contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.apm-footer__contact-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.92rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.82);
}

.apm-footer__contact-item svg {
  flex-shrink: 0;
  margin-top: 3px;
  opacity: 0.75;
}

.apm-footer__contact-item a {
  color: #93c5fd;
  text-decoration: none;
}

.apm-footer__contact-item a:hover {
  color: #fff;
  text-decoration: underline;
}

.apm-footer__contact-item strong {
  color: #fff;
  font-weight: 600;
}

.apm-footer__category-col h4 {
  margin: 0 0 14px;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
}

.apm-footer__category-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.apm-footer__category-col a {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  line-height: 1.45;
  text-decoration: none;
}

.apm-footer__category-col a:hover {
  color: #fff;
}

@media (max-width: 1024px) {
  .apm-footer__top {
    grid-template-columns: 1fr;
  }

  .apm-footer__contact,
  .apm-footer__contact--with-profile {
    grid-template-columns: 1fr;
  }

  .apm-footer__categories {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .apm-footer__categories {
    grid-template-columns: 1fr;
  }
}
