/* ==========================================================================
   HAZAR LOJİSTİK — 3-STEP MEGA NAVIGATION & SPOTLIGHT SEARCH
   ========================================================================== */

/* --- 1. Header Container & Nav Alignment --- */
.flexe-header .flexe-container {
  max-width: 1380px;
  position: relative;
}

.flexe-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
  gap: 16px;
  flex-wrap: nowrap;
  position: relative; /* Global anchor for perfectly centered mega menus */
}

.flexe-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 12px;
  position: static; /* Allows child mega menus to anchor directly to .flexe-header-inner */
  flex-shrink: 0;
}

.flexe-nav-item {
  display: inline-flex;
  align-items: center;
  height: 100%;
}

.flexe-nav-item.flexe-has-mega {
  position: static; /* Key: frees the mega menu from nav item bounds */
}

.flexe-mega-trigger {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 550;
  color: #111827;
  cursor: pointer;
  padding: 8px 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.flexe-nav-link {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 550;
  color: #111827;
  padding: 8px 6px;
  text-decoration: none;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.flexe-mega-trigger:hover,
.flexe-nav-item:hover .flexe-mega-trigger,
.flexe-nav-link:hover {
  color: var(--brand-primary, #D91A2A);
}

.flexe-chevron {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  stroke: currentColor;
}

.flexe-nav-item:hover .flexe-chevron {
  transform: rotate(180deg);
}

/* --- 2. Mega Menu Container (Centered, Screen-Bounded, Anti-Overflow) --- */
.flexe-mega-menu {
  position: absolute;
  top: calc(100% - 2px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 18px;
  box-shadow: 0 28px 64px -12px rgba(17, 24, 39, 0.16), 0 8px 24px -4px rgba(17, 24, 39, 0.06);
  padding: 24px 28px 18px 28px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1200;
}

/* Invisible Bridge to guarantee seamless hover continuity */
.flexe-mega-menu::before {
  content: '';
  position: absolute;
  top: -24px;
  left: 0;
  right: 0;
  height: 24px;
}

/* Show on hover / focus */
.flexe-nav-item:hover .flexe-mega-menu,
.flexe-nav-item:focus-within .flexe-mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Width & Clamping Variants */
.flexe-mega-wide {
  width: min(1180px, calc(100% - 32px));
  max-width: calc(100vw - 32px);
}

.flexe-mega-services {
  width: min(840px, calc(100% - 32px));
  max-width: calc(100vw - 32px);
}

.flexe-mega-guides {
  width: min(840px, calc(100% - 32px));
  max-width: calc(100vw - 32px);
}

/* --- 3. Grid Columns --- */
.flexe-mega-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.flexe-mega-grid-services,
.flexe-mega-grid-guides {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.flexe-mega-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0; /* Prevents overflow blowouts in grid cells */
}

.flexe-mega-col-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #111827;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #F3F4F6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mega Links with Ellipsis Protection */
.flexe-mega-link {
  font-size: 0.81rem;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flexe-mega-link:hover {
  background: var(--brand-soft, #FFF0F1);
  color: var(--brand-primary, #D91A2A);
  transform: translateX(3px);
}

.flexe-mega-link.highlight {
  font-weight: 600;
  color: var(--brand-primary, #D91A2A);
}

.flexe-mega-all {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand-primary, #D91A2A);
  text-decoration: none;
  padding: 5px 6px;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-top: 1px dashed #E5E7EB;
  transition: color 0.15s ease;
  white-space: nowrap;
}

.flexe-mega-all:hover {
  color: #D91A2A;
  text-decoration: underline;
}

/* Service Cards in Mega Menu (Scoped to prevent collision with Bento Service Cards) */
.flexe-mega-menu .flexe-service-card,
.flexe-mega-service-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #1F2937;
  border: 1px solid transparent;
  background: transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}

.flexe-mega-menu .flexe-service-card:hover,
.flexe-mega-service-item:hover {
  background: #FFF1F2;
  border-color: rgba(217, 26, 42, 0.18);
  transform: translateX(3px) !important;
  box-shadow: 0 4px 12px rgba(217, 26, 42, 0.06) !important;
}

.flexe-mega-menu .flexe-service-card .service-icon,
.flexe-mega-service-item .service-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  color: var(--brand-primary, #D91A2A);
  border-radius: 8px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.flexe-mega-menu .flexe-service-card:hover .service-icon,
.flexe-mega-service-item:hover .service-icon {
  background: #D91A2A;
  border-color: #D91A2A;
  color: #FFFFFF;
}

.flexe-mega-menu .flexe-service-card strong,
.flexe-mega-service-item strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0F172A;
}

.flexe-mega-menu .flexe-service-card p,
.flexe-mega-service-item p {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: #64748B;
  line-height: 1.35;
}

/* Mega Footer */
.flexe-mega-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #4B5563;
}

.flexe-mega-footer .flexe-btn-link {
  color: var(--brand-primary, #D91A2A);
  font-weight: 600;
  text-decoration: none;
}

.flexe-mega-footer .flexe-btn-link:hover {
  text-decoration: underline;
}

/* --- 4. Spotlight Quick Search Button (Navbar) --- */
.flexe-search-trigger {
  width: 38px;
  height: 38px;
  background: #FFFFFF;
  border: 1px solid var(--border-color, #E5E7EB);
  border-radius: 8px;
  color: #4B5563;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.flexe-search-trigger:hover {
  background: var(--brand-soft, #FFF0F1);
  border-color: var(--brand-primary, #D91A2A);
  color: var(--brand-primary, #D91A2A);
  box-shadow: 0 2px 8px rgba(217, 26, 42, 0.12);
}

.flexe-search-trigger .search-text,
.flexe-search-trigger .search-kbd {
  display: none;
}

/* --- 5. Spotlight Search Modal (Command Palette) --- */
.hazar-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 20px 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

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

.hazar-search-modal {
  width: 100%;
  max-width: 640px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  transform: translateY(-10px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hazar-search-overlay.active .hazar-search-modal {
  transform: translateY(0);
}

.hazar-search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #E5E7EB;
  background: #FAFAFA;
}

.hazar-search-header svg {
  color: var(--brand-primary, #D91A2A);
  flex-shrink: 0;
}

.hazar-search-input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 1.05rem;
  color: #111827;
  outline: none;
}

.hazar-search-input::placeholder {
  color: #9CA3AF;
}

.hazar-search-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #9CA3AF;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.hazar-search-close:hover {
  color: #111827;
}

.hazar-search-results {
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hazar-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: #1F2937;
  transition: background 0.12s ease;
  cursor: pointer;
}

.hazar-search-item:hover,
.hazar-search-item.selected {
  background: #FFF0F1;
  color: #D91A2A;
}

.hazar-search-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hazar-search-item-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.hazar-search-item-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: inherit;
}

.hazar-search-item-sub {
  font-size: 0.75rem;
  color: #6B7280;
  margin-top: 1px;
}

.hazar-search-item-cat {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  background: #E5E7EB;
  color: #4B5563;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.04em;
}

.hazar-search-item.selected .hazar-search-item-cat {
  background: #FFF0F1;
  color: #D91A2A;
}

.hazar-search-empty {
  padding: 40px 20px;
  text-align: center;
  color: #6B7280;
  font-size: 0.9rem;
}

.hazar-search-footer {
  padding: 10px 18px;
  background: #F9FAFB;
  border-top: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #6B7280;
}

.hazar-search-shortcuts {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hazar-search-shortcuts kbd {
  background: #FFFFFF;
  border: 1px solid #D1D5DB;
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 0.7rem;
}

/* --- 6. Mobile Off-Canvas Drawer --- */
.hazar-mobile-drawer {
  display: none !important; /* CRITICAL: Must be display:none when closed so translateX(100%) does not stretch viewport */
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden !important;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.hazar-mobile-drawer.active {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.hazar-mobile-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 85%;
  max-width: 360px;
  height: 100%;
  background: #FFFFFF;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  padding: 20px;
}

.hazar-mobile-drawer.active .hazar-mobile-panel {
  transform: translateX(0);
}

.hazar-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid #E5E7EB;
}

.hazar-mobile-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.hazar-acc-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
  padding: 10px 4px;
  cursor: pointer;
  text-align: left;
}

.hazar-acc-content {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding-left: 12px;
  border-left: 2px solid #E5E7EB;
  margin-bottom: 8px;
}

.hazar-acc-content.open {
  display: flex;
}

.hazar-acc-content a {
  font-size: 0.88rem;
  color: #4B5563;
  text-decoration: none;
  padding: 4px 0;
}

.hazar-acc-content a:hover {
  color: var(--brand-primary, #D91A2A);
}

@media (max-width: 1024px) {
  .flexe-search-trigger .search-text,
  .flexe-search-trigger .search-kbd {
    display: none;
  }
  .flexe-search-trigger {
    padding: 8px;
  }
}

/* Medium Desktop & Laptop Precision Tuning (992px - 1260px) */
@media (max-width: 1260px) and (min-width: 992px) {
  .flexe-nav {
    gap: 8px;
    margin: 0 6px;
  }
  .flexe-mega-trigger,
  .flexe-nav-link {
    font-size: 0.82rem;
    padding: 6px 2px;
  }
  .flexe-header-actions {
    gap: 8px;
  }
  .flexe-nav-phone-btn {
    padding: 6px 8px;
  }
  .flexe-nav-phone-btn span {
    display: none;
  }
  .flexe-btn-sm {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
  .flexe-mega-wide {
    width: calc(100% - 20px);
    padding: 18px 16px 14px 16px;
  }
  .flexe-mega-grid {
    gap: 8px;
  }
  .flexe-mega-link {
    font-size: 0.76rem;
    padding: 3px 4px;
    gap: 4px;
  }
}

/* Strict Mobile Header Layout (<= 991px) */
@media (max-width: 991px) {
  .flexe-header .flexe-container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .flexe-nav {
    display: none !important;
  }
  #btn-header-quote {
    display: none !important;
  }
  .flexe-nav-phone-btn {
    display: none !important; /* On mobile, direct dial is in sticky bottom dock & drawer */
  }
  .flexe-mobile-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    background: #F8FAFC !important;
    border: 1.5px solid #CBD5E1 !important;
    border-radius: 9px !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin-left: 4px !important;
    flex-shrink: 0 !important;
  }
  .flexe-mobile-toggle svg {
    stroke: #0F172A !important;
    width: 20px !important;
    height: 20px !important;
  }
  .flexe-header-inner {
    height: 56px !important;
    padding: 0 !important;
    justify-content: space-between !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .flexe-brand-img {
    height: 25px !important;
    max-width: 110px !important;
    width: auto !important;
    object-fit: contain !important;
  }
  .flexe-header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
  }
  .flexe-search-trigger {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .hazar-lang-btn {
    padding: 5px 8px !important;
    font-size: 0.75rem !important;
    height: 36px !important;
  }
}
