/* ==========================================================================
   MedicaBazaar - Trendyol Tarzı Kategori Mega Menü Stilleri
   ========================================================================== */

:root {
  --mega-primary: #2b66ba;
  --mega-primary-hover: #1e4d94;
  --mega-primary-light: #eff6ff;
  --mega-primary-glow: rgba(43, 102, 186, 0.12);
  --mega-border: #e2e8f0;
  --mega-border-light: #f1f5f9;
  --mega-text-main: #0f172a;
  --mega-text-body: #334155;
  --mega-text-muted: #64748b;
  --mega-bg: #ffffff;
  --mega-sidebar-bg: #ffffff;
  --mega-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.18), 0 0 1px rgba(15, 23, 42, 0.12);
  --mega-radius: 16px;
}

/* Mega Menü Nav Item Wrapper */
.mega-menu-nav-item {
  position: static !important;
}

/* Tetikleyici Buton / Alanı */
.mega-menu-trigger {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  text-decoration: none !important;
}

.mega-menu-trigger:hover,
.mega-menu-nav-item:hover .mega-menu-trigger,
.mega-menu-nav-item.is-active .mega-menu-trigger {
  color: var(--mega-primary) !important;
}

.mega-menu-trigger .mega-chevron {
  font-size: 11px;
  color: var(--mega-text-muted);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.mega-menu-nav-item:hover .mega-menu-trigger .mega-chevron,
.mega-menu-nav-item.is-active .mega-menu-trigger .mega-chevron {
  transform: rotate(180deg);
  color: var(--mega-primary);
}

/* ==========================================================================
   Mega Dropdown Konteyneri
   ========================================================================== */
.mega-menu-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1045;
  background: transparent;
  padding-top: 4px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.2s;
}

@media (max-width: 991.98px) {
  .mega-menu-dropdown {
    display: none !important;
  }
}

/* Mouse hover köprüsü */
.mega-menu-dropdown::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  height: 20px;
}

/* Aktif / Hover Durumunda Açılma */
.mega-menu-nav-item:hover .mega-menu-dropdown,
.mega-menu-nav-item.is-active .mega-menu-dropdown,
.mega-menu-dropdown:hover,
.mega-menu-dropdown.is-open {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) !important;
}

/* İç Kutu */
.mega-menu-inner {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  background: var(--mega-bg);
  border-radius: 0 0 var(--mega-radius) var(--mega-radius);
  border: 1px solid var(--mega-border);
  border-top: none;
  box-shadow: var(--mega-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(16px);
}

/* Ana Gövde (Sol Sidebar + Sağ Grid) */
.mega-menu-body {
  display: flex;
  min-height: 480px;
  max-height: 560px;
  width: 100%;
}

/* ==========================================================================
   Sol Sidebar - Kök Kategoriler (Root Categories)
   ========================================================================== */
.mega-sidebar {
  width: 320px;
  flex-shrink: 0;
  background: var(--mega-sidebar-bg);
  border-right: 1px solid var(--mega-border-light);
  overflow-y: auto;
  padding: 12px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--mega-border) transparent;
}

.mega-sidebar::-webkit-scrollbar {
  width: 5px;
}

.mega-sidebar::-webkit-scrollbar-thumb {
  background: var(--mega-border);
  border-radius: 10px;
}

.mega-root-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.mega-root-item {
  position: relative;
  width: 100%;
}

.mega-root-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--mega-text-body);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.15s ease;
  cursor: pointer;
  width: 100%;
}

.mega-root-link .root-name {
  flex-grow: 1;
  white-space: normal;
  line-height: 1.35;
  padding-right: 8px;
}

.mega-root-link .root-arrow {
  font-size: 11px;
  color: #94a3b8;
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.15s ease;
}

/* Sol Kategoriler Hover ve Aktif Durum */
.mega-root-item.active .mega-root-link,
.mega-root-link:hover {
  background: var(--mega-primary-light);
  color: var(--mega-primary) !important;
  font-weight: 700;
}

.mega-root-item.active .mega-root-link .root-arrow,
.mega-root-link:hover .root-arrow {
  opacity: 1;
  color: var(--mega-primary);
  transform: translateX(0);
}

/* ==========================================================================
   Sağ İçerik Alanı - Alt Kategoriler ve Yapraklar (Sub & Leaf)
   ========================================================================== */
.mega-content-panel {
  flex-grow: 1;
  min-width: 0;
  padding: 24px 32px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--mega-border) transparent;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

.mega-content-panel::-webkit-scrollbar {
  width: 6px;
}

.mega-content-panel::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

/* Çok Sütunlu Dengeli Grid Yapısı (Trendyol Tarzı) */
.mega-subcat-columns {
  display: grid;
  grid-template-columns: repeat(var(--mega-cols, 4), minmax(0, 1fr));
  gap: 24px 32px;
  width: 100%;
  align-items: start;
}

.mega-subcat-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  width: 100%;
}

.mega-subcat-group {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.mega-subcat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--mega-text-main);
  text-decoration: none !important;
  min-height: 38px;
  line-height: 1.35;
  margin-bottom: 6px;
  transition: color 0.15s ease;
}

.mega-subcat-header span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mega-subcat-header:hover {
  color: var(--mega-primary) !important;
}

.mega-subcat-header i {
  font-size: 10px;
  margin-top: 4px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.mega-subcat-header:hover i {
  transform: translateX(2px);
}

/* Yaprak Kategori Listesi - Sabit Satır Yüksekliği ile Milimetrik Hiza */
.mega-leaf-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 122px;
}

.mega-leaf-item {
  margin: 0;
  height: 22px;
  line-height: 22px;
  overflow: hidden;
}

.mega-leaf-link {
  display: block;
  width: 100%;
  font-size: 12.5px;
  line-height: 22px;
  color: var(--mega-text-muted);
  text-decoration: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.15s ease;
}

.mega-leaf-link:hover {
  color: var(--mega-text-main) !important;
  transform: translateX(2px);
}

/* "Daha Fazla Gör" Butonu - Yatay Hiza Kilidi */
.mega-more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  font-size: 12px;
  font-weight: 700;
  color: var(--mega-primary);
  background: none;
  border: none;
  padding: 0;
  margin-top: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease;
  width: fit-content;
}

.mega-more-toggle:hover {
  color: var(--mega-primary-hover);
}

.mega-more-toggle i {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.mega-more-spacer {
  height: 24px;
  margin-top: 6px;
}

.mega-more-toggle.expanded i {
  transform: rotate(180deg);
}

/* ==========================================================================
   Yüklenme & Skeleton Durumu
   ========================================================================== */
.mega-skeleton-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 380px;
  width: 100%;
  color: var(--mega-text-muted);
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
}

.mega-skeleton-loading .spinner-border {
  width: 24px;
  height: 24px;
  border-width: 2px;
  color: var(--mega-primary);
}

/* ==========================================================================
   Alt Şerit / Footer Bar
   ========================================================================== */
.mega-menu-footer {
  background: #ffffff;
  border-top: 1px solid var(--mega-border-light);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.mega-footer-stats {
  color: var(--mega-text-muted);
  font-weight: 500;
}

.mega-footer-link {
  font-weight: 700;
  color: var(--mega-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.mega-footer-link:hover {
  color: var(--mega-primary-hover);
  text-decoration: underline;
}

/* ==========================================================================
   Modal Açıkken Sayfa Arka Plan Scroll Kilidi (Scroll Leak Fix)
   ========================================================================== */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  height: 100% !important;
  touch-action: none;
}

.modal-open .modal {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  touch-action: auto;
}

.modal-open .modal-dialog,
.modal-open .modal-content,
.modal-open .mobile-cat-split,
.modal-open .mobile-cat-roots,
.modal-open .mobile-cat-subs {
  touch-action: pan-y !important;
}

/* ==========================================================================
   Mobil Kategori Modal Stilleri (Tablet ve Mobil Optimize Genişlik)
   ========================================================================== */
.mobile-category-modal .modal-dialog {
  max-width: 94%;
  width: 94%;
  margin: 1.5rem auto;
}

.mobile-category-modal .modal-content {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

@media (min-width: 576px) {
  .mobile-category-modal .modal-dialog {
    max-width: 720px;
    width: 90%;
  }
}

@media (min-width: 768px) {
  .mobile-category-modal .modal-dialog {
    max-width: 860px;
    width: 88%;
  }
}

@media (min-width: 992px) {
  .mobile-category-modal .modal-dialog {
    max-width: 980px;
    width: 85%;
  }
}

@media (max-width: 767.98px) {
  .mobile-category-modal .modal-dialog {
    margin: 0;
    max-width: 100%;
    width: 100%;
    height: 100%;
  }
  .mobile-category-modal .modal-content {
    height: 100%;
    border-radius: 0;
  }
}

.mobile-cat-split {
  display: flex;
  height: calc(85vh - 120px);
  min-height: 480px;
  max-height: 720px;
}

@media (max-width: 767.98px) {
  .mobile-cat-split {
    height: calc(100vh - 110px);
    max-height: none;
    min-height: unset;
  }
}

/* Sol Kök Kategoriler (Tablet/Mobilde Ferah Genişlik) */
.mobile-cat-roots {
  width: 135px;
  flex-shrink: 0;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 576px) {
  .mobile-cat-roots {
    width: 210px;
  }
}

@media (min-width: 768px) {
  .mobile-cat-roots {
    width: 240px;
  }
}

.mobile-root-item {
  position: relative;
  list-style: none;
  transition: all 0.15s ease;
}

.mobile-root-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  color: #475569;
  border-bottom: 1px solid #f1f5f9;
  text-decoration: none !important;
  user-select: none;
  transition: all 0.15s ease;
}

@media (min-width: 576px) {
  .mobile-root-link {
    padding: 13px 14px;
    font-size: 13.5px;
  }
}

.mobile-root-link .root-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mobile-root-link .root-arrow {
  font-size: 9px;
  opacity: 0.4;
  margin-left: 6px;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

@media (min-width: 576px) {
  .mobile-root-link .root-arrow {
    font-size: 11px;
  }
}

.mobile-root-item.active .mobile-root-link {
  background: #ffffff;
  color: var(--mega-primary) !important;
  font-weight: 700;
  border-left: 4px solid var(--mega-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.mobile-root-item.active .mobile-root-link .root-arrow {
  opacity: 1;
  color: var(--mega-primary);
  transform: translateX(2px);
}

/* Sağ Alt Kategoriler (Masaüstü gibi ferah grup + liste + daha fazla gör) */
.mobile-cat-subs {
  flex-grow: 1;
  min-width: 0;
  padding: 16px 14px;
  overflow-y: auto;
  background: #ffffff;
  -webkit-overflow-scrolling: touch;
}

.mobile-cat-subs .mega-subcat-columns {
  display: grid;
  grid-template-columns: repeat(var(--mega-cols, 1), minmax(0, 1fr));
  gap: 16px 22px;
  width: 100%;
  align-items: start;
}

.mobile-cat-subs .mega-subcat-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  width: 100%;
}

.mobile-cat-subs .mega-subcat-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.mobile-cat-subs .mega-subcat-group:last-child {
  border-bottom: none;
}

.mobile-cat-subs .mega-subcat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--mega-text-main);
  text-decoration: none !important;
  min-height: 38px;
  line-height: 1.35;
  margin-bottom: 6px;
  transition: color 0.15s ease;
}

.mobile-cat-subs .mega-subcat-header span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mobile-cat-subs .mega-subcat-header:hover,
.mobile-cat-subs .mega-subcat-header:active {
  color: var(--mega-primary) !important;
}

.mobile-cat-subs .mega-subcat-header i {
  font-size: 10px;
  margin-top: 4px;
  flex-shrink: 0;
}

.mobile-cat-subs .mega-leaf-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 122px;
}

.mobile-cat-subs .mega-leaf-item {
  margin: 0;
  height: 22px;
  line-height: 22px;
  overflow: hidden;
}

.mobile-cat-subs .mega-leaf-link {
  display: block;
  font-size: 12.5px;
  line-height: 22px;
  color: var(--mega-text-muted);
  text-decoration: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.15s ease;
}

.mobile-cat-subs .mega-leaf-link:hover,
.mobile-cat-subs .mega-leaf-link:active {
  color: var(--mega-primary) !important;
}

.mobile-cat-subs .mega-more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--mega-primary);
  background: none;
  border: none;
  padding: 0;
  margin-top: 6px;
  cursor: pointer;
  text-decoration: none;
  width: fit-content;
}

.mobile-cat-subs .mega-more-toggle:hover {
  color: var(--mega-primary-hover);
}

.mobile-cat-subs .mega-more-toggle i {
  font-size: 9px;
  transition: transform 0.2s ease;
}

