/* ==========================================================================
   Password Publishing House — Header (Full Corrected CSS)
   Fixes: mobile search row, icon sizing, drawer, responsive breakpoints
   ========================================================================== */

:root {
  --header-height:  70px;
  --pph-blue:       #1565c0;
  --pph-blue-dark:  #0d47a1;
  --pph-blue-light: #e3f0ff;
  --pph-red:        #e53935;
  --border-color:   #dce5ef;
  --bg-search:      #f3f6fa;
  --text-nav:       #1a1a2e;
  --text-muted:     #5f6368;
  --shadow-hdr:     0 1px 0 rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.05);
  --radius-btn:     8px;
  --t:              0.18s ease;
}

/* ── Outer header ── */
.modern-header {
  background: #ffffff;
  box-shadow: var(--shadow-hdr);
  position: sticky;
  top: 0;
  z-index: 999;
}

.modern-header .header-lower {
  padding: 0;
}

/* Fluid inner container */
.header-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── ROW 1: logo | nav | icons ── */
.modern-header .outer-box {
  display: flex;
  align-items: center;
  height: var(--header-height);
  gap: 16px;
}

/* ── Logo ── */
.modern-header .logo-box { flex-shrink: 0; }
.modern-header .logo-box a { display: flex; align-items: center; }
.modern-header .logo-box img { max-height: 44px; width: auto; display: block; }

/* ── Desktop nav ── */
.modern-header .menu-area {
  flex: 1;
  display: flex;
  justify-content: center;
}

.modern-header .main-menu .navigation {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 2px;
  margin: 0;
  padding: 0;
}

.modern-header .main-menu .navigation > li > a {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-nav);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 7px;
  white-space: nowrap;
  position: static;
  transition: color var(--t), background var(--t);
}

/* Remove old pseudo-underline */
.modern-header .main-menu .navigation > li > a::after { display: none; }

.modern-header .main-menu .navigation > li:hover > a,
.modern-header .main-menu .navigation > li.current > a {
  color: var(--pph-blue);
  background: var(--pph-blue-light);
}

.modern-header .main-menu .navigation > li.current > a { font-weight: 700; }

/* Dropdown submenu */
.modern-header .main-menu .navigation > li.dropdown { position: relative; }

.modern-header .main-menu .navigation > li.dropdown > ul {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 6px 0;
  min-width: 220px;
  list-style: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  z-index: 100;
}

.modern-header .main-menu .navigation > li.dropdown:hover > ul { display: block; }

.modern-header .main-menu .navigation > li.dropdown > ul > li > a {
  display: block;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-nav);
  text-decoration: none;
  transition: background var(--t), color var(--t);
}

.modern-header .main-menu .navigation > li.dropdown > ul > li > a:hover {
  background: var(--pph-blue-light);
  color: var(--pph-blue);
}

/* ── Right block ── */
.menu-right-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Desktop search ── */
/* Modified search box for toggle behavior */
.search-box-modern {
  display: flex;
  align-items: center;
  margin-right: 10px;
}

.search-box-modern .form-group {
  display: flex;
  align-items: center;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: var(--radius-btn);
  padding: 0 !important;
  gap: 0 !important;
  height: 38px;
  width: 38px !important; /* Icon size only */
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  overflow: hidden;
  position: relative;
  box-shadow: none !important;
}

.search-box-modern.active .form-group {
  width: 240px !important;
  background: var(--bg-search) !important;
  border-color: var(--border-color) !important;
  padding: 0 12px !important;
  gap: 8px !important;
}

.search-box-modern.active .form-group:focus-within {
  border-color: var(--pph-blue) !important;
  box-shadow: 0 0 0 3px rgba(21,101,192,0.12) !important;
  background: #fff !important;
}

.search-box-modern input[type="search"] {
  width: 0 !important;
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-size: 13.5px;
  color: var(--text-nav);
  transition: all 0.3s ease;
  padding: 0 !important;
  margin: 0 !important;
}

.search-box-modern.active input[type="search"] {
  width: 100% !important;
  opacity: 1 !important;
  visibility: visible;
  pointer-events: auto;
  padding: 0 !important;
}

.search-box-modern .form-group button[type="submit"] {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 38px !important;
  height: 38px !important;
  background: transparent !important;
  border: none;
  color: var(--pph-blue);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.3s ease;
}

.search-box-modern.active .form-group button[type="submit"] {
  color: #aaa;
}

.search-box-modern.active .form-group button[type="submit"]:hover {
  color: var(--pph-blue);
}

/* ── Action icon buttons ── */
.header-action-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.action-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-btn);
  color: var(--pph-blue);
  font-size: 18px;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition: background var(--t);
}

.action-btn:hover { background: var(--pph-blue-light); }

/* Cart count badge */
.action-btn .cart-count {
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(30%, -30%);
  background: var(--pph-red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  pointer-events: none;
  line-height: 1;
}

/* ── Hamburger toggler ── */
.mobile-nav-toggler {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background var(--t);
}

.mobile-nav-toggler:hover { background: var(--pph-blue-light); }

.mobile-nav-toggler .bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
}

.mobile-nav-toggler .bar span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-nav);
  border-radius: 2px;
  transform-origin: center;
  transition: transform 0.25s, opacity 0.2s, width 0.2s;
}

/* Animate hamburger → × */
.mobile-nav-toggler[aria-expanded="true"] .bar span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-nav-toggler[aria-expanded="true"] .bar span:nth-child(2) { opacity: 0; width: 0; }
.mobile-nav-toggler[aria-expanded="true"] .bar span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ═══════════════════════════════════════════════════════════
   ROW 2 — MOBILE SEARCH BAR
   ─────────────────────────────────────────────────────────
   THE KEY FIX:
   This sits BELOW .outer-box in the DOM, inside .header-lower.
   On desktop: display:none (hidden).
   On mobile:  display:flex — full width, no cramming.
═══════════════════════════════════════════════════════════ */
.mobile-search-bar {
  display: none;
  align-items: center;
  background: var(--bg-search);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-btn);
  padding: 0 12px;
  gap: 8px;
  height: 40px;
  margin: 0 0 10px;
  transition: border-color var(--t), box-shadow var(--t);
}

.mobile-search-bar:focus-within {
  border-color: var(--pph-blue);
  box-shadow: 0 0 0 3px rgba(21,101,192,0.12);
  background: #fff;
}

.mobile-search-bar .fa-search {
  color: #aaa;
  font-size: 13px;
  flex-shrink: 0;
}

.mobile-search-bar input[type="search"] {
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-nav);
  flex: 1;
  height: 100%;
}

.mobile-search-bar input::placeholder { color: #bbb; }

/* ── Mobile slide-in drawer (theme's .mobile-menu) ── */
.mobile-menu .menu-box {
  background: #ffffff;
  box-shadow: 4px 0 24px rgba(0,0,0,0.1);
}

.mobile-menu .nav-logo img { max-height: 40px; }

.mobile-menu .navigation li > a {
  color: var(--text-nav) !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  border-top: 1px solid #f0f4f8 !important;
  padding: 13px 20px !important;
  transition: background var(--t), color var(--t) !important;
}

.mobile-menu .navigation li > a:hover,
.mobile-menu .navigation li.current > a {
  background: var(--pph-blue-light) !important;
  color: var(--pph-blue) !important;
}

.mobile-menu .close-btn {
  color: var(--text-nav);
  font-size: 20px;
  transition: color var(--t);
}

.mobile-menu .close-btn:hover { color: var(--pph-red); }

.mobile-menu .contact-info h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--pph-blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.mobile-menu .contact-info ul li,
.mobile-menu .contact-info ul li a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}

.mobile-menu .contact-info ul li a:hover { color: var(--pph-blue); }

.mobile-menu .social-links ul li a {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pph-blue-light);
  border-radius: 50%;
  color: var(--pph-blue);
  font-size: 14px;
  transition: background var(--t), color var(--t);
}

.mobile-menu .social-links ul li a:hover {
  background: var(--pph-blue);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
═══════════════════════════════════════════════════════════ */

@media only screen and (max-width: 1024px) {
  /* Hide desktop elements */
  .modern-header .nav-outer,
  .desktop-only {
    display: none !important;
  }

  /* Show mobile elements */
  .mobile-nav-toggler {
    display: flex !important;
  }

  .mobile-search-bar {
    display: flex;
  }

  .menu-right-content { gap: 4px; }
}

@media only screen and (max-width: 768px) {
  :root { --header-height: 62px; }

  .header-container { padding: 0 14px; }

  .modern-header .outer-box { gap: 8px; }

  .modern-header .logo-box img { max-height: 36px; }

  .action-btn { width: 36px; height: 36px; font-size: 17px; }

  .mobile-nav-toggler { width: 36px; height: 36px; }

  .mobile-search-bar { height: 38px; margin-bottom: 8px; }
}

@media only screen and (max-width: 390px) {
  :root { --header-height: 58px; }

  .header-container { padding: 0 10px; }
}
