/**
 * CodersGrow - Store Mega Menu & Tab Switching Styles
 */

/* Navigation item container */
.cg-has-store-mega-menu {
  position: relative !important;
}

.cg-has-store-mega-menu > a {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  outline: none !important;
}

.cg-menu-chevron {
  display: inline-block !important;
  vertical-align: middle !important;
  transition: transform 0.22s ease, color 0.22s ease !important;
  color: inherit !important;
}

.cg-has-store-mega-menu:hover .cg-menu-chevron,
.cg-has-store-mega-menu.is-open .cg-menu-chevron {
  transform: rotate(180deg) !important;
  color: #2563eb !important;
}

/* Invisible hover bridge to eliminate pointer drops between link and popup */
.cg-has-store-mega-menu::after {
  content: '';
  position: absolute;
  top: 100%;
  right: -130px;
  width: 780px;
  max-width: calc(100vw - 32px);
  height: 20px;
  display: block;
  z-index: 999;
}

/* The Mega Menu Card */
.cg-store-mega-menu {
  position: absolute !important;
  top: calc(100% + 14px) !important;
  right: -130px !important;
  left: auto !important;
  transform: translateX(var(--cg-shift-x, 0px)) translateY(8px) !important;
  width: 780px !important;
  max-width: calc(100vw - 32px) !important;
  background: #ffffff !important;
  border: 1px solid #eef2f6 !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 48px -10px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  display: flex !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s ease !important;
  z-index: 1000 !important;
  text-align: left !important;
  overflow: hidden !important;
  line-height: 1.5 !important;
}

.cg-has-store-mega-menu:hover .cg-store-mega-menu,
.cg-has-store-mega-menu.is-open .cg-store-mega-menu,
.cg-has-store-mega-menu:focus-within .cg-store-mega-menu {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateX(var(--cg-shift-x, 0px)) translateY(0) !important;
}

/* Left Column: Categories List */
.cg-mega-tabs {
  width: 215px !important;
  background: #ffffff !important;
  border-right: 1px solid #f1f5f9 !important;
  padding: 18px 14px 14px 14px !important;
  display: flex !important;
  flex-direction: column !important;
  flex-shrink: 0 !important;
}

.cg-mega-tabs-header {
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  color: #1e293b !important;
  letter-spacing: -0.01em !important;
  margin-bottom: 12px !important;
  padding: 0 4px !important;
  text-transform: none !important;
}

.cg-mega-tab {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 8px 10px !important;
  border-radius: 10px !important;
  margin-bottom: 6px !important;
  font-weight: 500 !important;
  font-size: 0.88rem !important;
  color: #334155 !important;
  cursor: pointer !important;
  transition: all 0.18s ease !important;
  text-decoration: none !important;
  border: 1px solid transparent !important;
  outline: none !important;
}

.cg-mega-tab:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
}

.cg-mega-tab.active {
  background: #edf3fe !important;
  color: #0f172a !important;
  font-weight: 600 !important;
}

.cg-tab-left {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.cg-tab-brand-squircle {
  width: 28px !important;
  height: 28px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

.cg-tab-brand-squircle.cg-brand-woo {
  background: #673de6 !important;
}

.cg-tab-icon {
  width: 28px !important;
  height: 28px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

.cg-tab-title {
  font-size: 0.88rem !important;
  letter-spacing: -0.01em !important;
}

.cg-tab-count {
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  padding: 2px 7px !important;
  border-radius: 999px !important;
  background: #f1f5f9 !important;
  color: #64748b !important;
  transition: all 0.18s ease !important;
}

.cg-mega-tab.active .cg-tab-count {
  background: #dbeafe !important;
  color: #2563eb !important;
}

.cg-mega-tabs-footer {
  margin-top: auto !important;
  padding-top: 14px !important;
}

.cg-tab-store-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: #eef4fe !important;
  border: 1px solid #dbeafe !important;
  border-radius: 10px !important;
  padding: 10px 12px !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: #2563eb !important;
  text-decoration: none !important;
  transition: all 0.18s ease !important;
}

.cg-tab-store-btn:hover {
  background: #e0edff !important;
  border-color: #bfdbfe !important;
  color: #1d4ed8 !important;
}

.cg-store-btn-icon,
.cg-store-btn-arrow {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Right Column: Module Listing & Dynamic Showcase */
.cg-mega-content {
  flex: 1 !important;
  padding: 20px 22px !important;
  background: #ffffff !important;
  position: relative !important;
  min-height: 330px !important;
  display: flex !important;
  flex-direction: column !important;
}

.cg-mega-panel {
  display: none !important;
  width: 100% !important;
  animation: cgMegaFade 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.cg-mega-panel.active {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
}

@keyframes cgMegaFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cg-panel-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 16px !important;
}

.cg-panel-header-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.cg-panel-brand-badge {
  width: 42px !important;
  height: 42px !important;
  border-radius: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

.cg-panel-brand-badge.cg-badge-woo {
  background: #673de6 !important;
}

.cg-panel-brand-badge.cg-badge-laravel {
  background: #e11d48 !important;
}

.cg-panel-brand-badge.cg-badge-shopify {
  background: #16a34a !important;
}

.cg-panel-header-titles h4 {
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  margin: 0 0 2px 0 !important;
  letter-spacing: -0.015em !important;
}

.cg-panel-header-titles p {
  font-size: 0.78rem !important;
  color: #64748b !important;
  margin: 0 !important;
  line-height: 1.4 !important;
}

.cg-panel-archive-link {
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  color: #2563eb !important;
  white-space: nowrap !important;
  margin-left: 12px !important;
  text-decoration: none !important;
  transition: color 0.15s ease !important;
}

.cg-panel-archive-link:hover {
  color: #1d4ed8 !important;
  text-decoration: underline !important;
}

.cg-mega-products-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 10px !important;
}

.cg-mega-product-item {
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  border: 1px solid #edf2f7 !important;
  background: #ffffff !important;
  transition: all 0.18s ease !important;
  text-decoration: none !important;
  overflow: hidden !important;
}

.cg-mega-product-item:hover {
  border-color: #cbd5e1 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06) !important;
  background: #ffffff !important;
}

.cg-card-top {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.cg-card-icon {
  width: 42px !important;
  height: 42px !important;
  border-radius: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

.cg-card-body {
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.cg-card-title {
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.25 !important;
}

.cg-card-price-row {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin-top: 3px !important;
}

.cg-price-del {
  font-size: 0.78rem !important;
  color: #94a3b8 !important;
  text-decoration: line-through !important;
}

.cg-price-sale {
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  color: #2563eb !important;
}

.cg-card-chevron {
  color: #94a3b8 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  transition: transform 0.18s ease, color 0.18s ease !important;
}

.cg-mega-product-item:hover .cg-card-chevron {
  color: #2563eb !important;
  transform: translateX(2px) !important;
}

.cg-card-bottom {
  margin-top: 5px !important;
  display: flex !important;
  align-items: center !important;
  min-height: 16px !important;
}

.cg-card-tagline {
  font-size: 0.72rem !important;
  color: #64748b !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.cg-card-discount-badge {
  display: inline-block !important;
  background: #e6f9f0 !important;
  color: #16a34a !important;
  font-weight: 700 !important;
  font-size: 0.68rem !important;
  padding: 1px 6px !important;
  border-radius: 5px !important;
  letter-spacing: 0.02em !important;
  line-height: 1.3 !important;
}

.cg-mega-empty-showcase {
  margin: auto 0 !important;
  padding: 24px 20px !important;
  text-align: center !important;
  background: #f8fafc !important;
  border-radius: 12px !important;
  border: 1px dashed #cbd5e1 !important;
}

.cg-empty-icon {
  width: 46px !important;
  height: 46px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-bottom: 10px !important;
}

.cg-mega-empty-showcase h5 {
  font-size: 0.98rem !important;
  font-weight: 700 !important;
  color: var(--text-main, #111827) !important;
  margin-bottom: 6px !important;
}

.cg-mega-empty-showcase p {
  font-size: 0.8rem !important;
  color: var(--text-muted, #4b5563) !important;
  max-width: 360px !important;
  margin: 0 auto 14px auto !important;
  line-height: 1.5 !important;
}

.cg-mega-empty-showcase .btn,
.cg-mega-empty-showcase .btn-primary,
.cg-mega-empty-showcase a.btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #ffffff !important;
  background: var(--primary, #c53030) !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(197, 48, 48, 0.25) !important;
  transition: all 0.2s ease !important;
}

.cg-mega-empty-showcase .btn:hover,
.cg-mega-empty-showcase .btn-primary:hover,
.cg-mega-empty-showcase a.btn:hover {
  color: #ffffff !important;
  background: var(--primary-dark, #9b2c2c) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(197, 48, 48, 0.35) !important;
}

/* Responsive adjustments for mid-size screens and laptops */
@media (max-width: 1280px) {
  .cg-store-mega-menu {
    width: 660px !important;
    right: -100px !important;
  }
  .cg-has-store-mega-menu::after {
    width: 660px !important;
    right: -100px !important;
  }
  .cg-mega-tabs {
    width: 210px !important;
  }
  .cg-mega-content {
    padding: 16px 18px !important;
  }
}

@media (max-width: 1120px) {
  .cg-store-mega-menu {
    width: 590px !important;
    right: -60px !important;
  }
  .cg-has-store-mega-menu::after {
    width: 590px !important;
    right: -60px !important;
  }
  .cg-mega-tabs {
    width: 190px !important;
    padding: 12px 8px !important;
  }
  .cg-mega-tab {
    padding: 8px 10px !important;
  }
  .cg-tab-title {
    font-size: 0.85rem !important;
  }
  .cg-mega-products-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .cg-mega-product-item {
    padding: 6px 8px !important;
    gap: 8px !important;
  }
  .cg-mega-prod-thumb {
    width: 36px !important;
    height: 36px !important;
  }
  .cg-mega-prod-title {
    font-size: 0.78rem !important;
  }
}

/* Mobile: strictly hide mega menu popup and hover bridge (handled by mobile drawer) */
@media (max-width: 991px) {
  .cg-store-mega-menu,
  .cg-has-store-mega-menu::after {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }
}
