/* YallaEdu Baims-style category mega menu */

.ye-mega-cat {
  position: relative;
}

.ye-mega-cat__trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: #f1f1f1;
  color: #171347;
  font-weight: 500;
  font-size: 14px;
  font-family: inherit;
  border-radius: 10px;
  padding: 12px 18px 12px 14px;
  cursor: pointer;
  line-height: 1.2;
}

.ye-mega-cat.is-open .ye-mega-cat__trigger,
.ye-mega-cat__trigger:hover {
  background: #e9eef3;
}

.ye-mega-cat__panel {
  position: absolute;
  top: calc(100% + 14px);
  left: 0;
  z-index: 1050;
  padding-top: 4px;
}

/* RTL: pin panel to the right edge of the trigger (logo/categories side) */
.ye-mega-cat.is-rtl .ye-mega-cat__panel {
  left: auto;
  right: 0;
}

/*
 * Column flex is ALWAYS LTR mechanically so append order is predictable:
 *   col0 = roots, col1 = children, col2 = grandchildren...
 * RTL flips visual order with row-reverse → roots on the RIGHT, children grow LEFT.
 */
.ye-mega-cat__columns {
  display: flex;
  flex-direction: row;
  direction: ltr;
  align-items: stretch;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.16);
  overflow: hidden;
  max-width: min(96vw, 1100px);
}

.ye-mega-cat.is-rtl .ye-mega-cat__columns {
  flex-direction: row-reverse;
}

.ye-mega-cat__col {
  min-width: 220px;
  max-width: 280px;
  padding: 14px 10px;
  border-right: 1px solid #edf0f2;
  max-height: min(70vh, 480px);
  overflow-y: auto;
  direction: ltr; /* default; overridden in RTL */
}

.ye-mega-cat.is-rtl .ye-mega-cat__col {
  direction: rtl;
  border-right: 0;
  border-left: 1px solid #edf0f2;
}

.ye-mega-cat__col:last-child,
.ye-mega-cat.is-rtl .ye-mega-cat__col:last-child {
  border-right: 0;
  border-left: 0;
}

/* After row-reverse, the visually-leftmost column is the deepest — drop its outer border */
.ye-mega-cat.is-rtl .ye-mega-cat__col:first-child {
  border-left: 0;
}

.ye-mega-cat__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: start;
  font: inherit;
  color: #171347;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.ye-mega-cat__item:hover,
.ye-mega-cat__item.is-active {
  background: #f3f5f7;
  color: #046ab2;
  text-decoration: none;
}

.ye-mega-cat__item-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.ye-mega-cat__item-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 auto;
}

.ye-mega-cat__item-text {
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: start;
}

.ye-mega-cat__chevron {
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1;
  color: #9aa3ad;
  font-family: inherit;
}

@media (max-width: 991.98px) {
  .ye-mega-cat {
    width: 100%;
  }

  .ye-mega-cat__trigger {
    width: 100%;
    background: transparent;
    padding: 10px 0;
    border-radius: 0;
    justify-content: flex-start;
  }

  .ye-mega-cat__panel {
    position: static;
    padding-top: 8px;
    left: auto;
    right: auto;
  }

  .ye-mega-cat__columns,
  .ye-mega-cat.is-rtl .ye-mega-cat__columns {
    flex-direction: column;
    direction: ltr;
    max-width: 100%;
    box-shadow: none;
    border: 1px solid #edf0f2;
  }

  .ye-mega-cat__col,
  .ye-mega-cat.is-rtl .ye-mega-cat__col {
    min-width: 0;
    max-width: none;
    max-height: none;
    border-right: 0;
    border-left: 0;
    border-bottom: 1px solid #edf0f2;
  }

  .ye-mega-cat__col:last-child,
  .ye-mega-cat.is-rtl .ye-mega-cat__col:last-child {
    border-bottom: 0;
  }
}
