/* ================================================================
   navbar.css  —  TMIC Shared Navigation Styles
   แก้ไข CSS ของ navbar ที่ไฟล์นี้ไฟล์เดียว จะมีผลกับทุกหน้า
   ================================================================ */

nav {
  position: sticky; top: 0; z-index: 9999;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 40px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.nav-logo { display:flex; align-items:center; gap:10px; text-decoration:none; cursor:pointer; }
.nav-logo img { height:42px; object-fit:contain; }

.nav-logo-text { font-family:'Kanit',sans-serif; font-weight:700; font-size:13px; color:var(--navy); line-height:1.3; }


.nav-links { display:flex; gap:2px; align-items:center; list-style:none; margin:0; padding:0; }
.nav-item { position:relative; }

.nav-item > a {
  display:flex; align-items:center; gap:4px;
  font-size:13.5px; font-weight:600; color:#334155;
  text-decoration:none; white-space:nowrap;
  padding:22px 12px; /* tall padding keeps hover zone continuous with dropdown */
  border-radius:6px; cursor:pointer;
  transition:color .18s;
}

.nav-item > a:hover,
.nav-item:hover > a { color:#0d9488; }

.nav-item > a.active { color:#0d9488; }


.nav-caret { font-size:8px; opacity:.55; transition:transform .25s; line-height:1; display:inline-block; }
.nav-item:hover > a .nav-caret { transform:rotate(180deg); }

.dropdown {
  visibility:hidden; opacity:0; pointer-events:none;
  position:absolute;
  top:100%;        /* flush — no gap */
  left:0;
  min-width:268px;
  background:#fff;
  border-radius:0 0 10px 10px;
  border:1px solid #e2e8f0; border-top:none;
  padding:6px 0 8px;
  box-shadow:0 12px 36px rgba(0,0,0,.12);
  /* NO transition delay on visibility so it stays open while mouse travels */
  transition:opacity .18s ease, transform .18s ease;
  transform:translateY(0);
  z-index:9999;
}

.dropdown::before {
  content:'';
  position:absolute;
  top:-8px; left:0; right:0; height:8px;
}

.nav-item:hover > .dropdown {
  visibility:visible; opacity:1; pointer-events:auto;
}

.dropdown li { list-style:none; }
.dropdown a {
  display:block; padding:9px 20px;
  font-size:13.5px; font-weight:500; color:#334155;
  text-decoration:none; white-space:nowrap;
  transition:background .13s, color .13s;
}

.dropdown a:hover { background:#f0fdf4; color:#0d9488; }


.dd-group-label {
  padding:10px 20px 3px;
  font-size:10.5px; font-weight:800;
  letter-spacing:1.2px; text-transform:uppercase; color:#94a3b8;
}

.dd-divider { height:1px; margin:5px 12px; background:#e2e8f0; }


.has-sub { position:relative; }
.has-sub > a { display:flex; justify-content:space-between; align-items:center; }

.has-sub > a::after { content:'›'; font-size:16px; opacity:.45; margin-left:8px; flex-shrink:0; }


.sub-dropdown {
  visibility:hidden; opacity:0; pointer-events:none;
  position:absolute;
  top:0; left:100%;
  min-width:230px;
  background:#fff;
  border-radius:10px;
  border:1px solid #e2e8f0;
  padding:6px 0 8px;
  box-shadow:0 12px 36px rgba(0,0,0,.12);
  transition:opacity .18s ease;
  z-index:9999;
}

.sub-dropdown::before {
  content:'';
  position:absolute;
  top:0; left:-10px; width:10px; height:100%;
}

.has-sub:hover > .sub-dropdown {
  visibility:visible; opacity:1; pointer-events:auto;
}

.sub-dropdown li { list-style:none; }
.sub-dropdown a { padding:8px 18px; font-size:13px; color:#334155; display:block; text-decoration:none; white-space:nowrap; }

.sub-dropdown a:hover { background:#f0fdf4; color:#0d9488; }


.star-badge {
  display:inline-block; background:#f59e0b; color:#fff;
  font-size:10px; font-weight:700; padding:1px 5px;
  border-radius:3px; margin-left:5px; vertical-align:middle;
}

.btn-consult {
  background:var(--green); color:#fff;
  border:none; padding:10px 20px; border-radius:6px;
  font-size:14px; font-weight:600; font-family:'Sarabun',sans-serif;
  cursor:pointer; white-space:nowrap;
  display:flex; align-items:center; gap:6px;
  transition:background .2s, transform .15s; flex-shrink:0;
}

.btn-consult:hover { background:#16a34a; transform:translateY(-1px); }


.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: none; border: none;
  cursor: pointer; padding: 6px;
  border-radius: 6px;
  transition: background .2s;
  flex-shrink: 0;
}

.nav-hamburger:hover { background: #f0f4f8; }
.nav-hamburger span {
  display: block; height: 2px; width: 100%;
  background: #0a1628; border-radius: 2px;
  transition: transform .3s, opacity .3s, width .3s;
  transform-origin: center;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; width: 0; }

.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


.mobile-nav {
  display: none;
  position: fixed;
  top: 64px; left: 0; right: 0;
  background: #fff;
  border-top: 2px solid #e2e8f0;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  z-index: 9998;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 8px 0 24px;
}

.mobile-nav.open { display: block; }
.mobile-nav-item { border-bottom: 1px solid #f1f5f9; }

.mobile-nav-item > a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px;
  font-size: 15px; font-weight: 600; color: #1e293b;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.mobile-nav-item > a:hover { background: #f8fafc; color: #0d9488; }
.mobile-nav-item > a.active { color: #0d9488; }

.mobile-nav-item.open > a .mob-caret { transform: rotate(180deg); }
.mobile-sub {
  display: none;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.mobile-nav-item.open > .mobile-sub { display: block; }
.mobile-sub a {
  display: block; padding: 11px 36px;
  font-size: 14px; color: #475569; text-decoration: none;
  transition: background .15s, color .15s;
  border-bottom: 1px solid #f1f5f9;
}

.mobile-nav-consult { margin: 16px 24px 0; }
.mobile-nav-consult button {
  width: 100%; background: #1db954; color: #fff;
  border: none; padding: 13px; border-radius: 8px;
  font-size: 15px; font-weight: 700;
  font-family: 'Sarabun', sans-serif; cursor: pointer;
}

.mobile-nav-consult button:hover { background: #16a34a; }




/* ── Responsive: hide desktop nav on mobile ──────────────────── */
@media (max-width:1100px) {
  .nav-links    { display: none !important; }
  .btn-consult  { display: none !important; }
  .nav-hamburger{ display: flex !important; }
  nav           { padding: 0 16px; }
}
