/* =================================================================
   MEGEBEYA AUTOMATIC DYNAMIC HEADER SYSTEM  –  header.css
   Modern, Clean, Premium Native-App Feel Header
   ================================================================= */

:root {
  --hdr-red-bg:        #850e1b;
  --hdr-red-dark:      #690a14;
  --hdr-red-accent:    #901323;
  --hdr-text-light:    #ffffff;
  --hdr-text-dark:     #232323;
  --hdr-text-muted:    #666666;
  --hdr-dropdown-bg:   #ffffff;
  --hdr-height-desk:   68px;
  --hdr-height-mob:    60px;
  --hdr-radius-pill:   30px;
  --hdr-radius-card:   12px;
  --hdr-shadow-menu:   0 15px 35px rgba(0, 0, 0, 0.12);
  --hdr-shadow-header: 0 2px 10px rgba(0, 0, 0, 0.15);
  --hdr-font:          'Poppins', 'Inter', system-ui, -apple-system, sans-serif;
  --hdr-z-index:       9999;
}

/* ---------------------------------------------------------------
   1. MAIN HEADER CONTAINER
--------------------------------------------------------------- */
.mgb-header-wrapper {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: var(--hdr-z-index);
  background-color: var(--hdr-red-bg);
  box-shadow: var(--hdr-shadow-header);
  font-family: var(--hdr-font);
  transition: all 0.3s ease;
}

.mgb-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--hdr-height-desk);
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
}

/* ---------------------------------------------------------------
   2. LOGO SECTION
--------------------------------------------------------------- */
.mgb-header-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.mgb-header-brand a {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.mgb-header-brand img {
  max-height: 42px;
  width: auto;
  object-fit: contain;
}

/* ---------------------------------------------------------------
   3. DESKTOP NAVIGATION
--------------------------------------------------------------- */
.mgb-desktop-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mgb-nav-item {
  position: relative;
}

.mgb-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  color: var(--hdr-text-light);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none !important;
  border-radius: var(--hdr-radius-pill);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  white-space: nowrap;
}

.mgb-nav-link:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--hdr-text-light) !important;
}

/* Hover / Open Pill Styling */
.mgb-nav-item.has-mega:hover > .mgb-nav-link,
.mgb-nav-item.has-dropdown:hover > .mgb-nav-link,
.mgb-nav-item.is-open > .mgb-nav-link {
  background-color: var(--hdr-dropdown-bg);
  color: var(--hdr-text-dark) !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mgb-nav-item.has-mega:hover > .mgb-nav-link svg,
.mgb-nav-item.has-dropdown:hover > .mgb-nav-link svg,
.mgb-nav-item.is-open > .mgb-nav-link svg {
  stroke: var(--hdr-text-dark);
  transform: rotate(180deg);
}

.mgb-nav-link svg {
  width: 14px;
  height: 14px;
  stroke: var(--hdr-text-light);
  transition: transform 0.25s ease, stroke 0.25s ease;
}

.mgb-nav-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--hdr-red-bg);
  background: #ffffff;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.25s ease;
}

.mgb-nav-item.has-mega:hover > .mgb-nav-link .mgb-nav-count,
.mgb-nav-item.has-dropdown:hover > .mgb-nav-link .mgb-nav-count,
.mgb-nav-item.is-open > .mgb-nav-link .mgb-nav-count {
  background: var(--hdr-red-bg);
  color: #ffffff;
}


/* ---------------------------------------------------------------
   4. MEGA MENU & MULTI-COLUMN DROPDOWNS
--------------------------------------------------------------- */
.mgb-mega-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: 90vw;
  max-width: 1180px;
  background: var(--hdr-dropdown-bg);
  box-shadow: var(--hdr-shadow-menu);
  border-radius: 0 0 16px 16px;
  padding: 32px 40px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.3s ease;
  z-index: 100;
}

.mgb-nav-item.has-mega:hover .mgb-mega-dropdown,
.mgb-nav-item.has-mega.is-open .mgb-mega-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.mgb-mega-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 310px;
  gap: 32px;
}

.mgb-mega-col h4 {
  color: var(--hdr-red-bg);
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 14px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #f3f3f3;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mgb-mega-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mgb-mega-col ul li a {
  color: var(--hdr-text-dark);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mgb-mega-col ul li a:hover {
  color: var(--hdr-red-bg);
  transform: translateX(4px);
}

.mgb-mega-col ul li .item-count {
  font-size: 12px;
  color: var(--hdr-text-muted);
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 10px;
}

/* Post a Car Banner in Mega Menu */
.mgb-mega-banner {
  background: #ffffff;
  border: 1px solid #eaeaea;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.mgb-mega-banner-content h3 {
  font-size: 22px;
  font-weight: 800;
  color: #2b2b2b;
  margin: 0 0 4px 0;
  letter-spacing: -0.5px;
}

.mgb-mega-banner-content p {
  font-size: 13px;
  color: var(--hdr-red-bg);
  font-weight: 600;
  margin: 0 0 16px 0;
}

.mgb-mega-banner-btn {
  display: inline-block;
  background: var(--hdr-red-bg);
  color: #ffffff !important;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: var(--hdr-radius-pill);
  text-decoration: none !important;
  text-align: center;
  align-self: flex-start;
  transition: background 0.25s ease, transform 0.25s ease;
}

.mgb-mega-banner-btn:hover {
  background: var(--hdr-red-dark);
  transform: translateY(-2px);
}

.mgb-mega-banner-img {
  margin-top: 12px;
  width: 100%;
  height: auto;
  max-height: 120px;
  object-fit: contain;
}

/* Multi-Column Dropdown (e.g. By Body Type / Seller Type / Condition) */
.mgb-multi-col-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: 650px;
  background: var(--hdr-dropdown-bg);
  box-shadow: var(--hdr-shadow-menu);
  border-radius: 0 0 16px 16px;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 100;
}

.mgb-nav-item:hover > .mgb-multi-col-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Standard Vertical Dropdown (No scrollbar, clean overflow) */
.mgb-standard-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: var(--hdr-dropdown-bg);
  box-shadow: var(--hdr-shadow-menu);
  border-radius: 0 0 14px 14px;
  padding: 12px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s ease;
  list-style: none;
  margin: 0;
  z-index: 100;
  overflow: visible !important;
}

/* Popular Cars 2-Column Clean Panel (No scrollbar) */
.mgb-popular-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 480px;
  background: var(--hdr-dropdown-bg);
  box-shadow: var(--hdr-shadow-menu);
  border-radius: 0 0 16px 16px;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s ease;
  list-style: none;
  margin: 0;
  z-index: 100;
  overflow: visible !important;
}

.mgb-nav-item:hover > .mgb-popular-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mgb-popular-dropdown li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  color: var(--hdr-text-dark);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}

.mgb-popular-dropdown li a:hover {
  background: #f7f7f7;
  color: var(--hdr-red-bg);
}

.mgb-popular-dropdown li .badge-count {
  font-size: 11px;
  color: #666;
  background: #eee;
  padding: 2px 7px;
  border-radius: 10px;
}

.mgb-popular-footer-link {
  grid-column: 1 / -1;
  border-top: 1px solid #eeeeee;
  margin-top: 6px;
  padding-top: 10px !important;
  text-align: center;
}

.mgb-popular-footer-link a {
  justify-content: center !important;
  color: var(--hdr-red-bg) !important;
  font-weight: 600 !important;
}
  transition: all 0.25s ease;
  list-style: none;
  margin: 0;
  z-index: 100;
}

.mgb-nav-item:hover > .mgb-standard-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mgb-standard-dropdown li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  color: var(--hdr-text-dark);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.mgb-standard-dropdown li a:hover {
  background: #f9f9f9;
  color: var(--hdr-red-bg);
}

.mgb-standard-dropdown li .badge-count {
  font-size: 11px;
  color: #888;
  background: #eee;
  padding: 2px 7px;
  border-radius: 10px;
}

/* ---------------------------------------------------------------
   5. HEADER ACTIONS (Search, User, Post Car)
--------------------------------------------------------------- */
.mgb-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mgb-action-btn {
  background: transparent;
  border: none;
  color: var(--hdr-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  text-decoration: none !important;
  transition: background 0.2s ease;
}

.mgb-action-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--hdr-text-light) !important;
}

.mgb-action-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.mgb-post-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--hdr-text-light) !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  padding: 8px 18px;
  border-radius: var(--hdr-radius-pill);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: all 0.25s ease;
  white-space: nowrap;
}

.mgb-post-btn:hover {
  background: #ffffff;
  color: var(--hdr-red-bg) !important;
  border-color: #ffffff;
  transform: translateY(-1px);
}

.mgb-post-btn svg {
  width: 16px;
  height: 16px;
}

/* User Dropdown */
.mgb-user-menu-wrap {
  position: relative;
}

.mgb-user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 200px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: var(--hdr-shadow-menu);
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s ease;
  z-index: 101;
  list-style: none;
  margin: 0;
}

.mgb-user-menu-wrap:hover .mgb-user-dropdown,
.mgb-user-menu-wrap.is-open .mgb-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mgb-user-dropdown li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: #333333;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.mgb-user-dropdown li a:hover {
  background: #f5f5f5;
  color: var(--hdr-red-bg);
}

.mgb-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

/* ---------------------------------------------------------------
   6. SEARCH OVERLAY BAR
--------------------------------------------------------------- */
.mgb-search-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--hdr-red-bg);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 105;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

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

.mgb-search-form {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  gap: 12px;
}

.mgb-search-input {
  flex: 1;
  height: 44px;
  border-radius: var(--hdr-radius-pill);
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 0 20px;
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
}

.mgb-search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.mgb-search-input:focus {
  background: #ffffff;
  color: #232323;
  border-color: #ffffff;
}

.mgb-search-close {
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------------------------------------------------------
   7. MOBILE CONTROLS & MOBILE DRAWER
--------------------------------------------------------------- */
.mgb-mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #ffffff;
  padding: 8px;
  cursor: pointer;
}

.mgb-mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 82vw;
  max-width: 320px;
  height: 100vh;
  background: #ffffff;
  z-index: 10000;
  box-shadow: 4px 0 25px rgba(0, 0, 0, 0.2);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.mgb-mobile-drawer.is-open {
  transform: translateX(0);
}

.mgb-drawer-header {
  padding: 20px;
  background: var(--hdr-red-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mgb-drawer-header img {
  max-height: 36px;
}

.mgb-drawer-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
}

.mgb-drawer-body {
  padding: 10px 0;
  flex: 1;
}

.mgb-mobile-nav li {
  position: relative;
}

.mgb-mobile-nav li .mgb-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f2f2f2;
}

.mgb-mobile-nav li .mgb-nav-row a {
  flex: 1;
  border-bottom: none !important;
}

.mgb-mobile-nav li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  color: #232323;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid #f2f2f2;
}

.mgb-mobile-nav li a:hover {
  background: #f9f9f9;
  color: var(--hdr-red-bg);
}

.mgb-accordion-toggle {
  background: transparent;
  border: none;
  padding: 14px 20px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mgb-accordion-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.25s ease;
}

.mgb-mobile-nav li.is-open > .mgb-nav-row .mgb-accordion-toggle svg {
  transform: rotate(180deg);
  stroke: var(--hdr-red-bg);
}

.mgb-mobile-sub {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  background: #f8f8f8;
}

.mgb-mobile-sub li a {
  padding: 10px 24px 10px 36px !important;
  font-size: 13.5px !important;
  color: #555 !important;
  border-bottom: 1px solid #eeeeee !important;
}

.mgb-mobile-sub li a:hover {
  color: var(--hdr-red-bg) !important;
}

.mgb-drawer-footer {
  padding: 20px;
  border-top: 1px solid #eeeeee;
}

.mgb-drawer-post-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--hdr-red-bg);
  color: #ffffff !important;
  padding: 12px;
  border-radius: var(--hdr-radius-pill);
  font-weight: 600;
  text-decoration: none !important;
}

.mgb-scrim {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mgb-scrim.is-active {
  opacity: 1;
  visibility: visible;
}

/* ---------------------------------------------------------------
   8. RESPONSIVE BREAKPOINTS
--------------------------------------------------------------- */
@media (max-width: 992px) {
  .mgb-desktop-nav {
    display: none;
  }
  
  .mgb-mobile-toggle {
    display: flex;
    align-items: center;
  }
  
  .mgb-header-bar {
    height: var(--hdr-height-mob);
  }
  
  .mgb-post-btn {
    display: none !important;
  }
}
