/* =========================================================
   HEADER & NAVBAR
========================================================== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: .3s ease;
}

.header.scrolled {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  box-shadow:
    0 1px 0 rgba(11, 31, 51, 0.08),
    0 10px 30px rgba(11, 31, 51, 0.05);
}

.navbar {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* BRAND LOGO DESIGN */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  min-width: max-content;
  transition: transform 0.25s ease;
}

.brand:hover {
  transform: translateY(-1px);
}

.brand-logo {
  width: 52px;
  height: 52px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-family: "Manrope", sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--navy);
  transition: color 0.3s ease;
}

.header:not(.scrolled) .brand-name {
  color: #ffffff;
}

.brand-sub {
  margin-top: 4px;
  color: var(--primary);
  font-family: "DM Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.1em;
  transition: color 0.3s ease;
}

.header:not(.scrolled) .brand-sub {
  color: #75c8b3;
}

/* NAV LINKS & ACTIVE HIGHLIGHT */
.nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-link {
  position: relative;
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  transition: color .25s ease;
  padding: 4px 0;
}

.header:not(.scrolled) .nav-link {
  color: rgba(255, 255, 255, 0.75);
}

.nav-link:hover {
  color: var(--primary);
}

.header:not(.scrolled) .nav-link:hover {
  color: #75c8b3;
}

.nav-link.active {
  color: var(--primary) !important;
  font-weight: 700;
}

.header:not(.scrolled) .nav-link.active {
  color: #75c8b3 !important;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.header:not(.scrolled) .nav-link::after {
  background: #75c8b3;
}

.nav-link.active::after {
  width: 100%;
}

/* =========================================================
   NAV DROPDOWN ★ เมนู "บริการ"
========================================================== */

.nav-item {
  position: relative;
}

.nav-item > .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-caret {
  width: 12px;
  height: 12px;
  transition: transform .25s ease;
  flex: 0 0 auto;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 16px);
  left: 50%;
  z-index: 1001;
  width: 350px;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow:
    0 30px 70px rgba(11, 31, 51, .16),
    0 10px 26px rgba(11, 31, 51, .07);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity .25s ease,
    transform .28s cubic-bezier(.2, .9, .35, 1.15),
    visibility .25s ease;
}

.nav-dropdown::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 0;
  right: 0;
  height: 18px;
}

.nav-dropdown::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 13px;
  height: 13px;
  background: #ffffff;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px 0 0 0;
}

@media (min-width: 761px) {
  .nav-item:hover .nav-dropdown,
  .nav-item:focus-within .nav-dropdown,
  .nav-item.open .nav-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
  }

  .nav-item:hover .nav-caret,
  .nav-item:focus-within .nav-caret,
  .nav-item.open .nav-caret {
    transform: rotate(180deg);
  }

  .nav-item:hover > .nav-link,
  .nav-item.open > .nav-link {
    color: var(--primary);
  }

  .header:not(.scrolled) .nav-item:hover > .nav-link,
  .header:not(.scrolled) .nav-item.open > .nav-link {
    color: #75c8b3;
  }
}

.nav-dropdown-label {
  display: block;
  padding: 8px 12px 10px;
  color: var(--gray-400);
  font-family: "DM Mono", monospace;
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.nav-dropdown-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 11px;
  transition: background .2s ease, transform .2s ease;
}

.nav-dropdown-link:hover {
  background: var(--primary-light);
  transform: translateX(3px);
}

.nd-icon {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  transition: background .22s ease, color .22s ease;
}

.nav-dropdown-link:hover .nd-icon {
  background: var(--primary);
  color: #ffffff;
}

.nd-icon svg {
  width: 19px;
  height: 19px;
}

.nd-text {
  display: block;
  min-width: 0;
}

.nd-title {
  display: block;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.nd-desc {
  display: block;
  margin-top: 1px;
  color: var(--gray-500);
  font-size: 11px;
  line-height: 1.5;
}

.nav-cta {
  padding: 12px 20px;
  background: var(--primary);
  color: white !important;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: .25s ease;
  cursor: pointer;
  border: none;
}

.nav-cta:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 7px;
  cursor: pointer;
  position: relative;
  transition: background .25s ease, border-color .25s ease;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 4px auto;
  background: var(--navy);
  border-radius: 2px;
  transition: transform .3s ease, opacity .2s ease;
}

.menu-toggle.open span:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.menu-toggle.open span:nth-child(3) {
  transform: translateY(-10px) rotate(-45deg);
}

/* =========================================================
   MOBILE MENU HEADER + BACKDROP
========================================================== */

.nav-mobile-header {
  display: none;
  align-items: center;
  justify-content: flex-start;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
}

.nav-mobile-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.nav-mobile-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #75c8b3;
  box-shadow: 0 0 0 4px rgba(117, 200, 179, .25);
}

.nav-mobile-title {
  font-family: "DM Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .18em;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(7, 21, 34, .5);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}

.menu-backdrop.open {
  opacity: 1;
  visibility: visible;
}

body.menu-open {
  overflow: hidden;
}

/* RESPONSIVE NAVBAR */
@media (max-width: 760px) {
  .navbar {
    height: 76px;
  }

  .nav {
    position: fixed;
    top: 84px;
    left: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(11, 31, 51, .18), 0 8px 24px rgba(11, 31, 51, .08);
    max-height: calc(100vh - 108px);
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-18px) scale(.97);
    transform-origin: top center;
    pointer-events: none;
    transition: opacity .28s ease, transform .28s cubic-bezier(.2, .9, .35, 1.2);
    z-index: 999;
  }

  .nav.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  .nav-mobile-header {
    display: flex;
    justify-content: flex-start;
    border-radius: 15px 15px 0 0;
  }

  .nav-link {
    padding: 15px 20px;
    color: var(--navy) !important;
    font-size: 15px;
    font-weight: 600;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    transition: background .2s ease, padding-left .25s ease, color .2s ease;
  }

  .nav-link::after {
    display: none;
  }

  .nav-link:hover,
  .nav-link.active {
    background: var(--primary-light);
    color: var(--primary) !important;
    padding-left: 26px;
  }

  .nav-link.active {
    border-left: 4px solid var(--primary);
  }

  .nav-item {
    width: 100%;
  }

  .nav-item > .nav-link {
    width: 100%;
    justify-content: space-between;
  }

  .nav-dropdown {
    position: static;
    width: 100%;
    transform: none !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: #f4f8f7;
    max-height: 0;
    overflow: hidden;
    transition: max-height .38s cubic-bezier(.3, .9, .4, 1);
  }

  .nav-dropdown::before,
  .nav-dropdown::after { display: none; }

  .nav-item.open .nav-dropdown { max-height: 560px; }
  .nav-item.open .nav-caret { transform: rotate(180deg); }
  .nav-item.open > .nav-link {
    background: var(--primary-light);
    color: var(--primary) !important;
  }

  .nav-dropdown-label { display: none; }

  .nav-dropdown-link {
    padding: 13px 20px 13px 30px;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    gap: 10px;
  }

  .nav-dropdown-link:hover {
    background: #e8f1ef;
    transform: none;
  }

  .nd-icon {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .nd-icon svg { width: 16px; height: 16px; }
  .nd-title { font-size: 13px; }
  .nd-desc { font-size: 10.5px; }

  .nav-cta {
    margin: 16px;
    padding: 14px 20px;
    text-align: center;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(26, 85, 85, .28);
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: #ffffff;
    border-color: var(--line);
  }

  .menu-toggle.open {
    background: var(--primary-light);
    border-color: var(--primary);
  }

  .menu-toggle.open span {
    background: var(--primary);
  }
}

@media (max-width: 480px) {
  .brand-logo {
    width: 44px;
    height: 44px;
  }

  .brand-name {
    font-size: 14px;
  }

  .brand-sub {
    font-size: 7px;
  }
}

/* =========================================================
   CONTAINER FOR NAVBAR : ให้ขนาดเท่าของเดิม
========================================================== */
.header .container {
  width: min(calc(100% - 48px), 1200px);
  margin-inline: auto;
}

/* =========================================================
   RESPONSIVE NAV GAP : เดิมอยู่ใน style.css
========================================================== */
@media (max-width: 1000px) {
  .nav {
    gap: 18px;
  }
}

/* =========================================================
   MOBILE CONTAINER : เดิมอยู่ใน style.css
========================================================== */
@media (max-width: 760px) {
  .header .container {
    width: calc(100% - 32px);
  }
}