/**
 * Template page-sidebar-toc.php / template-visa.php / template-du-lich.php
 * Layout: elevated content card on the left; right sidebar with Visa calculator / CTA card
 * above and sticky Table of Contents below.
 */

/* ---------- Page canvas & two-column layout ---------- */
.vmt-toc-page {
  background: #f6f9f7;
  padding: 32px 0 64px;
}

.vmt-toc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: stretch;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Main content card ---------- */
.vmt-toc-main {
  min-width: 0;
  background: #ffffff;
  border-radius: 22px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow:
    0 12px 36px rgba(15, 23, 42, 0.05),
    0 2px 6px rgba(15, 23, 42, 0.03);
  color: var(--vmt-ink, #1e293b);
}

.vmt-toc-layout .page-title-inner,
.vmt-toc-layout .page-title-inner .title-breadcrumbs {
  padding: 0;
}

.vmt-toc-main>.section-title-container,
.vmt-toc-main .container.section-title-container {
  max-width: 100%;
  padding-left: 0;
  padding-right: 0;
  margin-bottom: 24px;
}

/* Anchor offset for sticky site header */
.vmt-toc-main :is(h2, h3, h4)[id] {
  scroll-margin-top: 110px;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---------- Typography & Lexend heading hierarchy ---------- */
.vmt-toc-main h1,
.vmt-toc-main h2,
.vmt-toc-main h3,
.vmt-toc-main h4 {
  font-family: "Lexend", var(--vmt-font-heading, sans-serif);
  letter-spacing: -0.015em;
}

.vmt-toc-main h1,
.vmt-toc-main .section-title {
  margin: 0 0 22px;
  font-size: clamp(26px, 2.8vw, 34px);
  font-weight: 700;
  line-height: 1.25;
  color: #0f172a;
}

.vmt-toc-main .section-title {
  gap: 14px;
  border-bottom: 0;
}

.vmt-toc-main .section-title b {
  height: 2px;
  opacity: 1;
  background: linear-gradient(90deg, transparent, rgba(0, 144, 48, 0.28), transparent);
}

.vmt-toc-main h1 .section-title-main,
.vmt-toc-main h1 span {
  color: #0f172a !important;
  font-family: "Lexend", var(--vmt-font-heading, sans-serif);
  font-weight: 700;
  padding-bottom: 0;
  border-bottom: 0;
}

.vmt-toc-main h1::after {
  content: "";
  display: block;
  width: 68px;
  height: 4px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--vmt-grad, linear-gradient(45deg, #009030 0%, #1fb954 50%, #009030 100%));
}

.vmt-toc-main h2:not(.section-title) {
  margin: 34px 0 14px;
  padding-left: 14px;
  border-left: 4px solid var(--vmt-accent, #009030);
  font-size: clamp(21px, 2.1vw, 26px);
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
  text-align: left !important;
}

.vmt-toc-main h2.section-title {
  margin: 36px 0 18px;
  padding-left: 0;
  border-left: 0;
}

.vmt-toc-main h2 :is(span, b, strong) {
  color: #0f172a !important;
  font-weight: inherit;
}

.vmt-toc-main h3:not(.vmt-x-title):not(.name) {
  margin: 24px 0 10px;
  font-size: clamp(18px, 1.6vw, 20px);
  font-weight: 600;
  line-height: 1.35;
  color: var(--vmt-accent-strong, #007f2a);
  text-align: left !important;
}

.vmt-toc-main h3:not(.vmt-x-title):not(.name) :is(span, b, strong) {
  color: var(--vmt-accent-strong, #007f2a) !important;
  font-weight: inherit;
}

.vmt-toc-main h4 {
  margin: 18px 0 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: #1e293b;
}

.vmt-toc-main p {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.75;
  color: #334155;
}

.vmt-toc-main ul,
.vmt-toc-main ol {
  margin: 0 0 18px;
  padding-left: 20px;
}

.vmt-toc-main ul li,
.vmt-toc-main ol li {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.7;
  color: #334155;
}

.vmt-toc-main ul li::marker,
.vmt-toc-main ol li::marker {
  color: var(--vmt-accent, #009030);
}

/* Avoid awkward list marker when legacy content wraps an H3 inside an LI */
.vmt-toc-main ul li:has(> h3) {
  list-style: none;
  margin-left: -20px;
}

.vmt-toc-main a:not(.button):not(.vmt-x-btn):not(.vmt-mini-cta) {
  /* color: var(--vmt-accent-strong, #007f2a); */
  text-decoration: underline;
  text-decoration-color: rgba(0, 144, 48, 0.35);
  text-underline-offset: 3px;
  transition: color 0.16s ease, text-decoration-color 0.16s ease;
}

.vmt-toc-main a:not(.button):not(.vmt-x-btn):not(.vmt-mini-cta):hover {
  color: var(--vmt-accent, #009030);
  text-decoration-color: var(--vmt-accent, #009030);
}

/* Prevent sticky TOC bottom from colliding with floating live-chat launcher */
.vmt-toc__nav {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

/* ---------- Rounded images & figures ---------- */
.vmt-toc-main .img {
  margin: 0 0 24px;
}

.vmt-toc-main .img-inner {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.vmt-toc-main img {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  display: block;
}

.vmt-toc-main .wp-caption {
  max-width: 100% !important;
  width: auto !important;
  margin: 24px auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.vmt-toc-main .wp-caption img {
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.vmt-toc-main .wp-caption-text,
.vmt-toc-main figcaption {
  margin: 0;
  padding: 10px 8px 0;
  background: transparent;
  color: #64748b;
  font-size: 13.5px;
  line-height: 1.5;
  font-style: normal;
  text-align: center;
}

/* ---------- Clean responsive tables ---------- */
.vmt-toc-main table {
  width: 100% !important;
  height: auto !important;
  margin: 22px 0 26px;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.vmt-toc-main table tr,
.vmt-toc-main table td,
.vmt-toc-main table th {
  height: auto !important;
}

.vmt-toc-main table th,
.vmt-toc-main table td {
  padding: 13px 16px;
  border: 0;
  border-bottom: 1px solid #e8eef3;
  border-right: 1px solid #eef2f6;
  font-size: 14.5px;
  line-height: 1.6;
  color: #334155;
  vertical-align: top;
}

.vmt-toc-main table th:last-child,
.vmt-toc-main table td:last-child {
  border-right: 0;
}

.vmt-toc-main table tbody tr:last-child td {
  border-bottom: 0;
}

.vmt-toc-main table thead th,
.vmt-toc-main table thead td,
.vmt-toc-main table:not(:has(thead)) tbody tr:first-child td {
  background: #0f291e;
  color: #ffffff;
  font-family: "Lexend", var(--vmt-font-heading, sans-serif);
  font-weight: 600;
  font-size: 14.5px;
  border-bottom-color: rgba(255, 255, 255, 0.14);
  border-right-color: rgba(255, 255, 255, 0.12);
}

.vmt-toc-main table thead *,
.vmt-toc-main table:not(:has(thead)) tbody tr:first-child td * {
  color: #ffffff !important;
}

.vmt-toc-main table tbody tr:nth-child(even) td {
  background: #f8fbf9;
}

.vmt-toc-main table tbody tr:not(:first-child):hover td {
  background: #f1f8f4;
}

.vmt-toc-main table td p,
.vmt-toc-main table td ul,
.vmt-toc-main table td h4 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: inherit;
  line-height: inherit;
}

.vmt-toc-main table td p:last-child,
.vmt-toc-main table td ul:last-child,
.vmt-toc-main table td h4:last-child {
  margin-bottom: 0;
}

/* ---------- Right sidebar & sticky TOC ---------- */
.vmt-toc {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.vmt-toc__sticky {
  position: sticky;
  top: 100px;
}

/* ---------- Table of Contents card ---------- */
.vmt-toc__box {
  padding: 20px 12px 16px 18px;
  border: 1px solid color-mix(in srgb, var(--vmt-accent, #009030) 14%, #e2e8f0);
  border-radius: 20px;
  background: #ffffff;
  box-shadow:
    0 12px 32px rgba(15, 23, 42, 0.06),
    0 2px 6px rgba(15, 23, 42, 0.03);
}

.vmt-toc__box[hidden] {
  display: none;
}

.vmt-toc__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 12px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  color: #0f172a;
  font-family: "Lexend", var(--vmt-font-heading, sans-serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  list-style: none;
  cursor: default;
}

.vmt-toc__title::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #009030 0%, #1fb954 100%);
  flex-shrink: 0;
}

.vmt-toc__title::-webkit-details-marker {
  display: none;
}

.vmt-toc__nav {
  padding-right: 6px;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 144, 48, 0.25) transparent;
}

#wrapper .vmt-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

#wrapper .vmt-toc__list--sub {
  margin: 3px 0 6px 12px;
  padding-left: 8px;
  border-left: 1px solid rgba(0, 144, 48, 0.16);
}

/* Sub-items (H3, H4) expand only under the active parent section */
.vmt-toc__item:not(.is-open)>.vmt-toc__list--sub {
  display: none;
}

/* Parent item indicator chevron */
.vmt-toc__item:has(> .vmt-toc__list--sub)>a {
  position: relative;
  padding-right: 26px;
}

.vmt-toc__item:has(> .vmt-toc__list--sub)>a::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 10px;
  width: 6px;
  height: 6px;
  margin-top: -4px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.55;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.vmt-toc__item.is-open>a::after {
  margin-top: -5px;
  transform: rotate(45deg);
  opacity: 0.85;
}

#wrapper .vmt-toc__item {
  margin: 0 0 2px;
  list-style: none;
}

.vmt-toc__item a {
  display: block;
  padding: 7px 11px;
  border-radius: 10px;
  color: var(--vmt-ink-2, #475569);
  font-size: 14px;
  line-height: 1.45;
  text-decoration: none;
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    padding-left 0.18s ease;
}

.vmt-toc__item--h2>a {
  color: #1e293b;
  font-weight: 600;
}

.vmt-toc__item--h4>a {
  font-size: 13px;
}

.vmt-toc__item a:hover {
  color: var(--vmt-accent-strong, #007f2a);
  background: color-mix(in srgb, var(--vmt-accent, #009030) 7%, #ffffff);
}

.vmt-toc__item a.is-active {
  color: var(--vmt-accent-strong, #007f2a);
  font-weight: 600;
  background: color-mix(in srgb, var(--vmt-accent, #009030) 11%, #ffffff);
  box-shadow: inset 3px 0 0 var(--vmt-accent, #009030);
}

.vmt-toc__item.is-open>a:not(.is-active) {
  color: #0f172a;
  font-weight: 600;
}

.vmt-toc__item a:focus-visible {
  outline: 2px solid var(--vmt-accent, #009030);
  outline-offset: 2px;
}

/* ---------- Sidebar CTA card ---------- */
.vmt-toc__cta {
  padding: 24px 22px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
  border: 1px solid color-mix(in srgb, var(--vmt-accent, #009030) 16%, #e2e8f0);
  box-shadow:
    0 12px 32px rgba(15, 23, 42, 0.06),
    0 2px 6px rgba(15, 23, 42, 0.03);
}

.vmt-toc__cta-title {
  margin: 0 0 8px;
  color: #0f172a;
  font-family: "Lexend", var(--vmt-font-heading, sans-serif);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.vmt-toc__cta-text {
  margin: 0 0 16px;
  color: #475569;
  font-size: 14px;
  line-height: 1.55;
}

#wrapper .vmt-toc__btn.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0 22px;
  min-height: 48px;
  line-height: 1.2;
  border: 0;
  border-radius: 999px;
  background: var(--vmt-grad,
      linear-gradient(135deg, #00852c 0%, #009a35 50%, #1fb954 100%));
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-transform: none;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 24px rgba(0, 144, 48, 0.3);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

#wrapper .vmt-toc__btn.button:hover {
  opacity: 0.97;
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0, 144, 48, 0.36);
}

.vmt-toc__phone {
  display: block;
  margin-top: 12px;
  color: #475569;
  font-size: 14px;
  text-align: center;
  text-decoration: none;
}

.vmt-toc__phone strong {
  color: var(--vmt-accent-strong, #007f2a);
  font-weight: 700;
}

/* ---------- Primary buttons inside main content ---------- */
#wrapper .vmt-toc-main :is(.button.primary,
  .button.secondary,
  .button.success,
  .wpcf7-submit,
  input[type="submit"]):not(.is-outline):not(.is-link):not(.is-underline) {
  border: 0;
  border-radius: 999px;
  padding-left: 24px;
  padding-right: 24px;
  background: var(--vmt-grad,
      linear-gradient(135deg, #00852c 0%, #009a35 50%, #1fb954 100%)) !important;
  color: #ffffff;
  font-weight: 600;
  text-transform: none;
  box-shadow: 0 8px 20px rgba(0, 144, 48, 0.28);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

#wrapper .vmt-toc-main :is(.button.primary,
  .button.secondary,
  .button.success,
  .wpcf7-submit,
  input[type="submit"]):not(.is-outline):not(.is-link):not(.is-underline):hover {
  opacity: 0.96;
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 144, 48, 0.35);
}

/* ---------- Tablet & Mobile ---------- */
@media (max-width: 1099px) {
  .vmt-toc-page {
    padding: 20px 0 44px;
  }

  .vmt-toc-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0 14px;
  }

  .vmt-toc-main {
    border-radius: 18px;
  }

  /* Split sidebar: TOC moves to top (hidden on mobile), sidebar widget moves below content */
  .vmt-toc {
    display: contents;
  }

  .vmt-toc__sticky {
    position: static;
    grid-row: 1;
    margin: 0 0 16px;
  }

  .vmt-toc__cta {
    display: none;
  }

  .vmt-toc__box {
    padding: 0;
  }

  .vmt-toc__title {
    position: relative;
    margin: 0;
    padding: 14px 48px 14px 18px;
    border-bottom: 0;
    cursor: pointer;
  }

  .vmt-toc__title::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 20px;
    width: 9px;
    height: 9px;
    margin-top: -7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
  }

  .vmt-toc__box[open] .vmt-toc__title::after {
    margin-top: -2px;
    transform: rotate(-135deg);
  }

  .vmt-toc__nav {
    max-height: none;
    padding: 0 10px 12px 12px;
  }
}

@media (max-width: 849px) {
  .vmt-toc__sticky {
    display: none;
  }
}

@media (max-width: 767px) {
  .vmt-toc-main {
    border-radius: 16px;
  }

  .vmt-toc-main p {
    text-align: left !important;
  }

  .vmt-toc-main table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .vmt-toc-main table th,
  .vmt-toc-main table td {
    padding: 10px 12px;
    font-size: 13.5px;
  }
}