/* ==========================================================================
   ARIAN CABLE - DIGISTYLE-GRADE UNIVERSAL MEGA MENU (VERSION 2.0.0)
   Strictly adheres to DESIGN.md and DigiStyle Reference Architecture
   ========================================================================== */

/* Mega Menu Wrapper attached to .site-header */
.site-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
}

/* Nav links item container for hover */
.nav-links {
  position: relative;
}

.nav-mega-trigger-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
}

/* Universal Mega Dropdown Panel */
.digistyle-mega-panel {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  width: 100%;
  margin-right: 0;
  margin-left: 0;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
  border-bottom: 2px solid #E2E8F0;
  box-shadow: 0 20px 40px -8px rgba(15, 23, 42, 0.14), 0 6px 16px -2px rgba(15, 23, 42, 0.06);
  opacity: 0;
  visibility: hidden;
  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 ease;
  pointer-events: none;
  z-index: 999;
  direction: rtl;
  max-height: 85vh;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Active Open State */
.digistyle-mega-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Inner Container matching maximum width */
.mega-panel-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px 30px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 36px;
  box-sizing: border-box;
}

/* Wide layout for Articles (gives more space for 6 articles) */
.mega-panel-container.wide-articles {
  grid-template-columns: 1fr 300px;
  gap: 30px;
}

/* Categories Multi-Column Grid (Right Side) */
.mega-categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px 20px;
}

.mega-cat-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: transparent;
  padding: 2px 6px 12px;
  border: none;
  border-radius: 0;
  transition: all 0.2s ease;
}

.mega-cat-column:hover {
  background: transparent;
  box-shadow: none;
}

/* Column Main Header (Authentic DigiStyle Grade: e.g. "خرید کابل افشان مسی") */
.mega-cat-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 900;
  color: #0F172A;
  text-decoration: none;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1.5px solid #F1F5F9;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.mega-cat-title:hover {
  color: #D92626;
  border-color: #D92626;
}

.mega-cat-title-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748B;
  background: #F1F5F9;
  padding: 2px 6px;
  border-radius: 6px;
}

/* Subcategory Links (Pristine clean typography like Digistyle) */
.mega-subcat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mega-subcat-link {
  font-size: 0.84rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  line-height: 1.55;
  padding: 2px 0;
  display: inline-flex;
  align-items: center;
  transition: color 0.18s ease, transform 0.18s ease;
}

.mega-subcat-link:hover {
  color: #D92626;
  font-weight: 700;
  transform: translateX(-4px);
}

/* "نمایش بیشتر" Action in each subgroup */
.mega-more-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #D92626;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #E2E8F0;
  text-decoration: none;
  transition: all 0.18s ease;
}

.mega-more-link:hover {
  color: #991B1B;
  transform: translateX(-4px);
}

.mega-more-link svg {
  transition: transform 0.18s ease;
}

.mega-more-link:hover svg {
  transform: translateX(-3px);
}

/* Left Featured Box / Visual Banner */
.mega-featured-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid #F1F5F9;
  padding-right: 28px;
}

.mega-featured-card {
  background: linear-gradient(145deg, #0F172A 0%, #1E293B 100%);
  border-radius: 14px;
  padding: 20px;
  color: #FFFFFF;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 24px -6px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.mega-featured-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px -8px rgba(15, 23, 42, 0.35);
}

.mega-featured-badge {
  align-self: flex-start;
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.mega-featured-title {
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.4;
  margin: 0;
  color: #FFFFFF;
}

.mega-featured-desc {
  font-size: 0.8rem;
  color: #94A3B8;
  margin: 0;
  line-height: 1.5;
}

.mega-featured-action {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #F59E0B;
}

/* Quick Action Links Bar at Bottom of Side Panel */
.mega-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mega-quick-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  text-decoration: none;
  color: #1E293B;
  font-size: 0.84rem;
  font-weight: 800;
  transition: all 0.18s ease;
}

.mega-quick-btn:hover {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #D97706;
  transform: translateX(-3px);
}

/* Articles 6-Grid Layout (3 columns x 2 rows) */
.mega-articles-6grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.mega-article-mini-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: #0F172A;
  transition: all 0.2s ease;
}

.mega-article-mini-card:hover {
  background: #FFFFFF;
  border-color: #CBD5E1;
  box-shadow: 0 10px 22px -6px rgba(0, 0, 0, 0.1);
  transform: translateY(-3px);
}

.mega-article-mini-card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  background: #E2E8F0;
}

.mega-article-mini-content {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mega-article-cat {
  font-size: 0.68rem;
  font-weight: 800;
  color: #D97706;
}

.mega-article-title {
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.45;
  margin: 0;
  color: #0F172A;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mega-article-readtime {
  font-size: 0.7rem;
  color: #64748B;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Backdrop dark overlay on hover */
.mega-backdrop-overlay {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  z-index: 998;
  pointer-events: none;
}

.mega-backdrop-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .mega-categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .mega-articles-6grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .mega-panel-container {
    grid-template-columns: 1fr 280px;
    gap: 24px;
  }
}

@media (max-width: 960px) {
  .digistyle-mega-panel {
    display: none !important;
  }
  .mega-backdrop-overlay {
    display: none !important;
  }
}
