/* ===============================================
   HRAB — Header enhancements (no layout overrides)
   These rules ADD to styles.css without conflicting.
   =============================================== */

/* -----------------------------------------------
   Active nav link — underline indicator
----------------------------------------------- */
.nav__link {
  position: relative;
}

.nav__item.current-nav > .nav__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 0;
}

.nav__item.current-nav > .nav__link {
  background: rgba(255, 255, 255, 0.15);
}

/* -----------------------------------------------
   Search overlay
----------------------------------------------- */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 31, 77, 0.97);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-overlay.active {
  opacity: 1;
  visibility: visible;
}

.search-overlay__inner {
  width: 100%;
  max-width: 640px;
  padding: 40px 32px;
  position: relative;
}

.search-overlay.active .search-overlay__inner {
  animation: searchSlideUp 0.3s ease forwards;
}

@keyframes searchSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.search-overlay__label {
  display: block;
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.search-overlay__inner form {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.25);
  padding-bottom: 12px;
  transition: border-color 0.2s;
}

.search-overlay__inner form:focus-within {
  border-bottom-color: rgba(255, 255, 255, 0.8);
}

.search-overlay__inner input[type="search"] {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 28px;
  font-family: var(--font-primary);
  padding: 8px 0;
}

.search-overlay__inner input[type="search"]::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.search-overlay__inner button[type="submit"] {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  padding: 8px;
  display: flex;
  transition: color 0.2s;
}

.search-overlay__inner button[type="submit"]:hover {
  color: #fff;
}

.search-overlay__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.search-overlay__close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.search-overlay__hint {
  margin-top: 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.5px;
}

.search-overlay__results {
  margin-top: 24px;
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.search-overlay__results::-webkit-scrollbar {
  width: 4px;
}
.search-overlay__results::-webkit-scrollbar-track {
  background: transparent;
}
.search-overlay__results::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
}

.search-results-loading {
  color: rgba(255,255,255,0.45);
  font-size: 13px;
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-results-loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: rgba(255,255,255,0.7);
  border-radius: 50%;
  animation: searchSpin 0.6s linear infinite;
  flex-shrink: 0;
}

@keyframes searchSpin {
  to { transform: rotate(360deg); }
}

.search-results-empty {
  color: rgba(255,255,255,0.35);
  font-size: 14px;
  padding: 16px 0;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.15s;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.search-result-item__thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.08);
}

.search-result-item__thumb-placeholder {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.3);
}

.search-result-item__thumb-placeholder svg {
  width: 20px;
  height: 20px;
}

.search-result-item__body {
  flex: 1;
  min-width: 0;
}

.search-result-item__title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.search-result-item__excerpt {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-item__type {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  flex-shrink: 0;
}

.search-results-all-link {
  display: block;
  margin-top: 14px;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  transition: all 0.2s;
}

.search-results-all-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}

/* -----------------------------------------------
   Back to top button
----------------------------------------------- */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 42px;
  height: 42px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.2s ease, box-shadow 0.2s ease;
  z-index: 998;
  box-shadow: 0 4px 16px rgba(26, 61, 151, 0.4);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26, 61, 151, 0.55);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 575px) {
  .back-to-top {
    bottom: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
  }
}
