/*
 * Component: Navbar — News Website Style
 * Depends on: tokens.css
 */

/* ── Navbar local tokens ───────────────────────────────────────── */
:root {
  --nb-bg:       #072f61;
  --nb-red:      #cb131c;
  --nb-red-dark: #a51016;
  --nb-h:        52px;
  --nb-mh:       50px;
}

/* ── Site Header ───────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--nb-bg);
}

/* ── Desktop Wrapper ───────────────────────────────────────────── */
.navbar-wrap { background: var(--nb-bg); }

.navbar-inner {
  display: flex;
  align-items: center;
  height: var(--nb-h);
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Logo ──────────────────────────────────────────────────────── */
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 20px;
}

.navbar-logo-img {
  height: 36px;
  width: auto;
  display: block;
  object-fit: contain;
  border-radius: 50%;
}

.navbar-logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--nb-red);
  color: #fff;
  font-family: var(--font-family-heading);
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.navbar-logo-text {
  font-family: var(--font-family-heading);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1;
}

/* ── Primary Menu ──────────────────────────────────────────────── */
.navbar-nav { flex: 1; overflow: hidden; display: flex; justify-content: center; }

.navbar-menu {
  display: flex;
  align-items: center;
  height: var(--nb-h);
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

.navbar-menu > li > a {
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--nb-h);
  padding: 0 13px;
  font-family: var(--font-family-body);
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  box-sizing: border-box;
  transition: color 0.12s, border-color 0.12s;
}

.navbar-menu > li > a:hover,
.navbar-menu > li.current-menu-item > a,
.navbar-menu > li.current-menu-ancestor > a {
  color: #ffffff;
  border-bottom-color: var(--nb-red);
}

.menu-drop-arrow {
  display: flex;
  align-items: center;
  opacity: 0.55;
  margin-top: 1px;
}

/* Sub-menu dropdown */
.navbar-menu .menu-item-has-children { position: relative; }

.navbar-menu .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--nb-bg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  list-style: none;
  margin: 0;
  padding: 6px 0;
  z-index: 300;
}

.navbar-menu .menu-item-has-children:hover > .sub-menu { display: block; }

.navbar-menu .sub-menu li a {
  display: block;
  padding: 9px 18px;
  font-family: var(--font-family-body);
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}

.navbar-menu .sub-menu li a:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* ── Nav Actions ───────────────────────────────────────────────── */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 10px;
}

/* Search button */
.navbar-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: none;
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}

.navbar-search-btn:hover { background: rgba(255,255,255,0.16); color: #fff; }

/* ── Search Overlay ────────────────────────────────────────────── */
.navbar-search-overlay {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border-bottom: 2px solid gainsboro;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  z-index: 250;
}

.navbar-search-overlay.is-open { display: block; }

/* Row: centered search box + ESC button */
.navbar-search-inner {
  display: flex;
  align-items: center;
  max-width: 860px;
  margin: 0 auto;
  padding: 18px 20px 16px;
  gap: 14px;
}

/* The pill-shaped input wrapper */
.search-ov-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 40px;
  padding: 10px 16px;
  background: #fafafa;
  transition: border-color 0.15s, background 0.15s;
}

.search-ov-wrap:focus-within {
  border-color: var(--nb-red);
  background: #fff;
}

.search-ov-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: #aaa;
}

.search-ov-wrap:focus-within .search-ov-icon { color: var(--nb-red); }

.search-ov-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 17px;
  font-family: var(--font-family-body);
  font-weight: 400;
  color: #222;
  background: transparent;
  line-height: 1.4;
  padding: 0;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}

.search-ov-input::placeholder { color: #bbb; }
.search-ov-input::-webkit-search-cancel-button { display: none; }

/* Clear (×) button inside pill */
.search-ov-clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ddd;
  border: none;
  color: #555;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.12s;
}

.search-ov-clear:hover { background: #ccc; }

/* ESC close button */
.search-ov-close {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 4px;
  background: #f0f0f0;
  border: none;
  color: #666;
  font-size: 12px;
  font-family: var(--font-family-body);
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.search-ov-close:hover { background: #e4e4e4; color: #222; }

/* ── Suggestions ───────────────────────────────────────────────── */
.search-suggestions-list {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px 14px;
}

.srch-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  overflow: hidden;
}

.srch-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 15px;
  font-family: var(--font-family-body);
  color: #222;
  text-decoration: none;
  transition: background 0.1s;
  border-bottom: 1px solid #f5f5f5;
}

.srch-list li:last-child .srch-suggest-item { border-bottom: none; }

.srch-suggest-item:hover { background: #fef2f2; }
.srch-suggest-item:hover .srch-title { color: var(--nb-red); }

.srch-icon { flex-shrink: 0; color: #bbb; display: flex; align-items: center; }
.srch-suggest-item:hover .srch-icon { color: var(--nb-red); }

.srch-title { flex: 1; }

.srch-arrow { flex-shrink: 0; color: #ccc; display: flex; align-items: center; }
.srch-suggest-item:hover .srch-arrow { color: var(--nb-red); }

/* Loading dots */
.srch-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 20px;
}

.srch-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  animation: srch-bounce 1s ease infinite;
}

.srch-loading span:nth-child(2) { animation-delay: 0.15s; }
.srch-loading span:nth-child(3) { animation-delay: 0.3s; }

@keyframes srch-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* No results */
.srch-no-results {
  padding: 14px 20px;
  font-size: 14px;
  font-family: var(--font-family-body);
  color: #888;
  margin: 0;
}

/* ── Mobile Bar ────────────────────────────────────────────────── */
.navbar-mobile-bar { display: none; }

.navbar-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 3px;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s;
}

.navbar-hamburger:hover { background: rgba(255,255,255,0.1); }

/* ── Mobile Drawer ─────────────────────────────────────────────── */
.nav-drawer {
  position: fixed;
  top: 0;
  left: -100%;
  width: min(300px, 86vw);
  height: 100dvh;
  background: var(--nb-bg);
  z-index: 500;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: left 0.3s cubic-bezier(0.32,0.72,0,1);
}

.nav-drawer.is-open { left: 0; }

.nav-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 450;
}

.nav-drawer-overlay.is-visible { display: block; }

.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.nav-drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.nav-drawer-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

.nav-drawer-menu {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  flex: 1;
}

.nav-drawer-menu > li {
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.nav-drawer-menu > li > a {
  display: block;
  padding: 13px 16px;
  font-family: var(--font-family-body);
  font-size: 15px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}

.nav-drawer-menu > li > a:hover,
.nav-drawer-menu > li.current-menu-item > a { background: rgba(255,255,255,0.06); color: #fff; }

.drawer-sub-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.12s, color 0.12s, transform 0.22s;
}

.nav-drawer-menu .sub-open > .drawer-sub-toggle {
  transform: translateY(-50%) rotate(180deg);
  color: rgba(255,255,255,0.8);
}

.nav-drawer-menu .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  background: rgba(0,0,0,0.2);
  overflow: hidden;
}

.nav-drawer-menu .sub-menu li a {
  display: block;
  padding: 10px 16px 10px 28px;
  font-size: 13px;
  font-family: var(--font-family-body);
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}

.nav-drawer-menu .sub-menu li a:hover { background: rgba(255,255,255,0.06); color: #fff; }

.nav-drawer-social {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.drawer-social-label {
  font-size: 11px;
  font-family: var(--font-family-body);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.4);
  margin: 0 0 10px;
}

.drawer-social-icons { display: flex; gap: 10px; }

.drawer-social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.drawer-social-icons a svg { width: 16px; height: 16px; fill: currentColor; }
.drawer-social-icons a:hover { background: var(--nb-red); color: #fff; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .navbar-wrap { display: none; }

  .navbar-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nb-mh);
    padding: 0 12px;
    background: var(--nb-bg);
  }

  .navbar-mobile-bar .navbar-logo { margin-right: 0; }
  .navbar-mobile-bar .navbar-logo-text { font-size: 14px; }
  .navbar-mobile-bar .navbar-logo-mark { width: 28px; height: 28px; font-size: 14px; }
  .navbar-mobile-bar .navbar-logo-img { height: 28px; }

  .navbar-mobile-actions {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .navbar-mobile-actions .navbar-live-btn { padding: 4px 8px; font-size: 11px; }
  .navbar-mobile-actions .navbar-search-btn { width: 30px; height: 30px; }
}

@media (min-width: 901px) {
  .navbar-mobile-bar,
  .navbar-hamburger { display: none !important; }
}
