/**
 * SHB iThanks - Header (chung mọi trang)
 * Theo Figma node 330-2410: navy bg (#0d1733), SHBiThank logo (i có accent cam), nav trắng, active link cam
 * Trang chủ (ithanks-page-home): header transparent, đè lên hero – override trong ithanks-home.css
 */

.ithanks-header {
  background: var(--ithanks-blue-900, #0d1733);
  min-height: 112px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 100;
}

.ithanks-wrapper:not(.ithanks-page-home) .ithanks-header {
  background-color: transparent;
  background-image: none;
}

/* Ngoài trang chủ: link chưa active SE 100, active PR 100 (Figma 250-543, 44-26) */
.ithanks-wrapper:not(.ithanks-page-home) .ithanks-header .nav-link {
  color: var(--ithanks-se-100, #162b75) !important;
}

.ithanks-wrapper:not(.ithanks-page-home) .ithanks-header .nav-link:hover {
  color: var(--ithanks-se-70, #5c6b9e) !important;
}

.ithanks-wrapper:not(.ithanks-page-home)
  .ithanks-header
  .nav-item.active
  .nav-link {
  font-weight: 600;
  color: var(--ithanks-pr-100, #f47920) !important;
}

/* Ngoài trang chủ: "Nhận thẻ đổi quà" là button cam (Figma 250-543, 44-26) */
.ithanks-wrapper:not(.ithanks-page-home)
  .ithanks-header
  .nav-item--cta
  .nav-link {
  background: var(--ithanks-pr-100, #f47920);
  color: var(--ithanks-white, #fff) !important;
  padding: 0.5rem 1.25rem;
  border-radius: 64px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ithanks-wrapper:not(.ithanks-page-home)
  .ithanks-header
  .nav-item--cta
  .nav-link:hover {
  background: #e56b0f;
  color: var(--ithanks-white, #fff) !important;
}

.ithanks-wrapper:not(.ithanks-page-home)
  .ithanks-header
  .nav-item--cta.active
  .nav-link {
  background: var(--ithanks-pr-100, #f47920);
  color: var(--ithanks-white, #fff) !important;
}

.ithanks-header .navbar {
  padding: 0;
  min-height: 112px;
  align-items: center;
}

.ithanks-header .navbar-nav {
  gap: 1rem;
}

/* Logo: SVG image */
.ithanks-header .navbar-brand {
  display: inline-flex;
  align-items: center;
  padding: 0;
}

.ithanks-header .ithanks-logo-img {
  height: 40px;
  width: auto;
  display: block;
}

/* Nav: trang chủ dùng nav trắng (trên hero), active #f06016; ngoài trang chủ override ở trên */
.ithanks-header .nav-link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ithanks-white, #fff) !important;
  padding: 0.5rem 1rem;
}

.ithanks-header .nav-link:hover {
  color: rgba(255, 255, 255, 0.9) !important;
}

.ithanks-header .nav-item.active .nav-link {
  font-weight: 600;
  color: var(--ithanks-pr-100, #f06016) !important;
}

.ithanks-header .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.4);
  padding: 0.35rem 0.6rem;
}

.ithanks-header .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 0.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Responsive: mobile & tablet – smaller header, logo, collapse menu styling */
@media (max-width: 991.98px) {
  .ithanks-header,
  .ithanks-header .navbar {
    min-height: 72px;
  }
  .ithanks-header .ithanks-logo-img {
    height: 32px;
  }
  /* Trang chủ: collapse luôn absolute để không làm header tăng chiều cao */
  .ithanks-page-home .ithanks-header .navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    background: var(--ithanks-blue-900, #0d1733);
    padding: 1rem 0;
    border-radius: 8px;
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
    opacity: 0;
    transform: translateY(-10px);
    visibility: hidden;
    display: block !important; /* Override Bootstrap display: none để transition hoạt động */
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  }
  /* Trạng thái mở: hiển thị với hiệu ứng trượt xuống */
  .ithanks-page-home .ithanks-header .navbar-collapse.show,
  .ithanks-page-home .ithanks-header .navbar-collapse.collapsing {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    height: auto !important;
  }
  /* Disable Bootstrap height transition, chỉ dùng opacity/transform */
  .ithanks-page-home .ithanks-header .navbar-collapse.collapsing {
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease !important;
  }
  .ithanks-page-home .ithanks-header .container {
    position: relative;
  }
  .ithanks-page-home .ithanks-header .navbar-nav .nav-link {
    color: var(--ithanks-white, #fff) !important;
  }
  /* Ngoài trang chủ: collapse luôn absolute để tránh layout shift */
  .ithanks-wrapper:not(.ithanks-page-home) .ithanks-header .navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    background: var(--ithanks-white);
    padding: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
    opacity: 0;
    transform: translateY(-10px);
    visibility: hidden;
    display: block !important; /* Override Bootstrap display: none để transition hoạt động */
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  }
  /* Trạng thái mở: hiển thị với hiệu ứng trượt xuống */
  .ithanks-wrapper:not(.ithanks-page-home)
    .ithanks-header
    .navbar-collapse.show,
  .ithanks-wrapper:not(.ithanks-page-home)
    .ithanks-header
    .navbar-collapse.collapsing {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    height: auto !important;
  }
  /* Disable Bootstrap height transition, chỉ dùng opacity/transform */
  .ithanks-wrapper:not(.ithanks-page-home)
    .ithanks-header
    .navbar-collapse.collapsing {
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease !important;
  }
  .ithanks-wrapper:not(.ithanks-page-home) .ithanks-header .container {
    position: relative;
  }
  .ithanks-wrapper:not(.ithanks-page-home)
    .ithanks-header
    .navbar-collapse
    .nav-link {
    color: var(--ithanks-se-100, #162b75) !important;
  }
  .ithanks-header .navbar-nav {
    gap: 0.5rem;
  }
  /* Ngoài trang chủ: toggler màu tối để thấy trên nền sáng */
  .ithanks-wrapper:not(.ithanks-page-home)
    .ithanks-header
    .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='%23162b75' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  }
}

/* ── Login / Profile button (match main header: h-12 px-5 py-3 rounded-[100px]) ── */
.ithanks-header .nav-item--login {
  display: flex;
  align-items: center;
}

.ithanks-header .btn-login-ithank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0.75rem 1.25rem;
  background: var(--ithanks-pr-100, #f47920) !important;
  color: var(--ithanks-white, #fff) !important;
  border-radius: 100px;
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  line-height: 1;
  transition: background 0.3s ease;
}

.ithanks-header .btn-login-ithank:hover {
  background: #e56b0f !important;
  color: var(--ithanks-white, #fff) !important;
}

.ithanks-header .btn-login-ithank.logged-in {
  max-width: 220px;
}

.ithanks-header .btn-login-ithank.logged-in span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ithanks-header .btn-login-ithank.logged-in:hover {
  background: var(--ithanks-se-100, #162b75) !important;
}

.ithanks-header .btn-login-ithank svg {
  flex-shrink: 0;
}

/* Ngoài trang chủ: giữ button cam không bị override bởi nav-link color */
.ithanks-wrapper:not(.ithanks-page-home) .ithanks-header .btn-login-ithank {
  background: var(--ithanks-pr-100, #f47920) !important;
  color: var(--ithanks-white, #fff) !important;
}

.ithanks-wrapper:not(.ithanks-page-home) .ithanks-header .btn-login-ithank:hover {
  background: #e56b0f !important;
  color: var(--ithanks-white, #fff) !important;
}

.ithanks-wrapper:not(.ithanks-page-home) .ithanks-header .btn-login-ithank.logged-in:hover {
  background: var(--ithanks-se-100, #162b75) !important;
}

@media (max-width: 991.98px) {
  .ithanks-header .btn-login-ithank {
    height: auto;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
  }
}
