/* Top Action Bar: Admin, Portal & Pricing Links */
.top-action-bar {
  position: fixed !important;
  z-index: 950 !important;
  top: 14px !important;
  left: 14px !important;
  display: flex !important;
  align-items: center;
  gap: 8px;
  direction: ltr;
}

.top-action-bar a,
.top-action-bar button {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 8px 14px !important;
  border: 2px solid #ffffff !important;
  border-radius: 16px;
  text-decoration: none;
  font: 900 12px Cairo, Tahoma, sans-serif;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  line-height: 1;
}

.top-action-bar a:hover,
.top-action-bar button:hover {
  transform: translateY(-2px);
}

/* 1. Admin Link */
.admin-top-link {
  background: linear-gradient(145deg, #efffff, #bfefff) !important;
  color: #17617b !important;
  box-shadow: 0 4px 0 #087dac, 0 8px 20px rgba(0, 63, 102, 0.25) !important;
}
.admin-top-link:hover {
  box-shadow: 0 6px 0 #087dac, 0 12px 24px rgba(0, 63, 102, 0.35) !important;
}
.admin-top-link span { font-size: 16px; }

/* 2. Portal Link (Teacher & Parent) */
.portal-top-link {
  background: linear-gradient(145deg, #fef3c7, #fde68a) !important;
  color: #92400e !important;
  box-shadow: 0 4px 0 #d97706, 0 8px 20px rgba(217, 119, 6, 0.3) !important;
  position: relative;
}
.portal-top-link:hover {
  box-shadow: 0 6px 0 #d97706, 0 12px 24px rgba(217, 119, 6, 0.4) !important;
}
.portal-top-link span { font-size: 16px; }

/* 3. Pricing Link */
.pricing-top-link {
  background: linear-gradient(135deg, #ecfdf5, #a7f3d0) !important;
  color: #065f46 !important;
  box-shadow: 0 4px 0 #059669, 0 8px 20px rgba(5, 150, 105, 0.3) !important;
  border: 2px solid #ffffff !important;
}
.pricing-top-link:hover {
  box-shadow: 0 6px 0 #059669, 0 12px 24px rgba(5, 150, 105, 0.4) !important;
}
.pricing-top-link span { font-size: 16px; }

/* Unified Top Command Navigation Deck (Design 1) */
.main-top-navbar {
  position: relative !important;
  z-index: 1005 !important;
  max-width: 1100px;
  margin: 12px auto 6px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(224, 242, 254, 0.92)) !important;
  border: 3px solid #ffffff !important;
  border-radius: 26px !important;
  box-shadow: 0 12px 32px rgba(0, 50, 80, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(14px) !important;
  direction: rtl;
}

/* Right Zone: Player Profile & Gamification Wallet */
.nav-right-zone {
  display: flex;
  align-items: center;
  gap: 10px;
}
.player-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  padding: 4px 10px 4px 6px;
  border-radius: 18px;
  border: 2px solid #e0f2fe;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.player-pill .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  display: grid;
  place-items: center;
  font-size: 22px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.player-info {
  display: flex;
  flex-direction: column;
}
.player-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.player-name-row strong {
  font-size: 13px;
  font-weight: 900;
  color: #0f172a;
  white-space: nowrap;
}
.logout-pill-btn {
  border: none;
  background: #fee2e2;
  color: #ef4444;
  padding: 1px 5px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  transition: transform 0.15s;
}
.logout-pill-btn:hover {
  transform: scale(1.1);
}
.player-info span {
  font-size: 10px;
  font-weight: 800;
  color: #0284c7;
}

.wallet-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(224, 242, 254, 0.75);
  padding: 6px 12px;
  border-radius: 16px;
  border: 1.5px solid #bae6fd;
  font-size: 12px;
  font-weight: 900;
  color: #0369a1;
  white-space: nowrap;
}
.wallet-pill b {
  color: #075985;
}

/* Center Zone: Brand Header */
.nav-center-zone {
  text-align: center;
  padding: 0 4px;
}
.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 2px 0 #0284c7, 0 3px 6px rgba(0, 0, 0, 0.2);
  line-height: 1.1;
  white-space: nowrap;
}
.brand-title span {
  color: #f59e0b;
  display: block;
  font-size: 22px;
  text-shadow: 0 2px 0 #b45309;
}
.brand-title small {
  font-size: 11px;
  color: #0284c7;
  text-shadow: none;
  font-weight: 800;
}

/* Left Zone: Action Pills Deck */
.nav-left-zone {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 14px;
  border: 2px solid #ffffff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  white-space: nowrap;
}
.nav-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
}

.nav-pill.pricing-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border-color: #fef3c7;
}
.nav-pill.pricing-btn .pill-badge {
  background: #ef4444;
  color: #ffffff;
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 5px;
}

.nav-pill.portal-btn {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
}

.nav-pill.contact-btn {
  background: linear-gradient(135deg, #25d366, #16a34a);
  color: #ffffff;
}

.nav-pill.admin-btn {
  background: linear-gradient(135deg, #475569, #334155);
  color: #ffffff;
}
.nav-left-zone .nav-pill {
  height: 40px;
  min-height: 40px;
  padding: 0 11px;
  border-width: 2px;
  border-radius: 13px;
  box-shadow: 0 3px 0 rgba(5,55,78,.22),0 6px 12px rgba(0,45,70,.1);
}
.nav-pill.language-btn,
.nav-pill.number-btn {
  min-width: 70px;
  background: linear-gradient(135deg,#ffffff,#dff7ff);
  color: #075985;
  border-color: #b9efff;
  direction: ltr;
}
.nav-pill.number-btn { min-width: 90px; }
.nav-pill.language-btn b,
.nav-pill.number-btn b { display: inline-flex; align-items: center; gap: 4px; }
.nav-pill.language-btn i,
.nav-pill.number-btn i { opacity: .35; font-style: normal; }
.nav-pill.language-btn .lang-ar,
.nav-pill.language-btn .lang-en { opacity: .55; }
html[lang="ar"] .nav-pill.language-btn .lang-ar,
html[lang="en"] .nav-pill.language-btn .lang-en { opacity: 1; color: #0284c7; }
.nav-pill.number-btn .digits-indian,
.nav-pill.number-btn .digits-western { opacity: .45; }
html[data-numerals="arabic"] .nav-pill.number-btn .digits-indian,
html[data-numerals="english"] .nav-pill.number-btn .digits-western { opacity: 1; color: #0284c7; }
html[lang="en"] .nav-pill.number-btn { display: none !important; }

@media (max-width: 960px) {
  .main-top-navbar {
    flex-direction: column;
    padding: 10px;
    gap: 8px;
    margin: 6px;
  }
  .nav-right-zone, .nav-left-zone {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .brand-title span { font-size: 18px; }
}

@media (max-width: 768px) {
  .top-action-bar {
    top: 8px !important;
    left: 8px !important;
    gap: 5px;
  }
  .top-action-bar a,
  .top-action-bar button {
    padding: 6px 9px !important;
    border-radius: 12px;
    font-size: 11px;
  }
  .admin-top-link b {
    display: none;
  }
}

@media (max-width: 460px) {
  .portal-top-link b {
    font-size: 10px;
  }
  .pricing-top-link b {
    font-size: 10px;
  }
}

/* Responsive command deck: one clear hierarchy instead of a crowded toolbar. */
.main-top-navbar {
  width: min(1180px, calc(100% - 32px));
  max-width: none;
  display: grid;
  grid-template-columns: minmax(285px, 1fr) auto minmax(440px, 1.45fr);
  grid-template-areas: "profile brand actions";
  gap: 18px;
  padding: 11px 14px;
}
.nav-right-zone { grid-area: profile; min-width: 0; }
.nav-center-zone { grid-area: brand; }
.nav-left-zone { grid-area: actions; justify-content: flex-end; min-width: 0; }
.nav-pill { min-height: 38px; justify-content: center; }
.nav-pill .pill-icon { font-size: 15px; }

@media (max-width: 1100px) {
  .main-top-navbar {
    width: calc(100% - 20px);
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand profile"
      "actions actions";
    gap: 9px 14px;
  }
  .nav-center-zone { align-self: center; }
  .nav-left-zone {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 700px) {
  .main-top-navbar {
    width: calc(100% - 16px);
    margin: 8px auto 4px;
    padding: 9px;
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "profile"
      "actions";
    border-radius: 20px !important;
  }
  .nav-right-zone {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    gap: 7px;
  }
  .player-pill { min-width: 0; padding: 4px 7px; }
  .player-pill .avatar { width: 36px; height: 36px; }
  .player-info { min-width: 0; }
  .player-name-row strong,
  .player-info > span { overflow: hidden; text-overflow: ellipsis; }
  .wallet-pill { gap: 6px; padding: 6px 8px; }
  .nav-left-zone {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  .nav-pill {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 7px 8px;
    white-space: normal;
    line-height: 1.2;
  }
  .nav-left-zone .nav-pill { height: 42px; min-height: 42px; }
  .brand-title span { font-size: 20px; }
}

@media (max-width: 390px) {
  .wallet-pill { font-size: 10px; }
  .nav-pill { font-size: 10px; }
  .nav-pill .pill-badge { display: none; }
}

/* Final header structure: identity row above a dedicated navigation row. */
.main-top-navbar {
  width: min(1180px, calc(100% - 28px));
  grid-template-columns: minmax(330px, 1fr) minmax(260px, auto) minmax(330px, 1fr);
  grid-template-areas:
    "profile brand empty"
    "actions actions actions";
  gap: 10px 18px;
  padding: 12px 16px 11px;
  border-radius: 24px !important;
}
.nav-right-zone {
  justify-self: start;
  align-self: center;
  width: auto;
}
.nav-center-zone {
  justify-self: center;
  align-self: center;
  min-width: 240px;
  padding: 2px 22px;
}
.brand-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  white-space: normal;
}
.brand-title span,
.brand-title small {
  display: block;
  width: 100%;
  text-align: center;
}
.brand-title span { font-size: 24px; line-height: 1.15; }
.brand-title small { margin-top: 2px; font-size: 12px; line-height: 1.35; }
.nav-left-zone {
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(14,116,144,.15);
}
.nav-left-zone .nav-pill {
  flex: 0 0 auto;
  min-width: 112px;
}
.nav-left-zone .language-btn { min-width: 82px; }
.nav-left-zone .number-btn { min-width: 102px; }

@media (max-width: 900px) {
  .main-top-navbar {
    width: calc(100% - 20px);
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "profile"
      "actions";
    gap: 9px;
  }
  .nav-center-zone { min-width: 0; padding: 0; }
  .nav-right-zone { justify-self: center; width: min(560px,100%); justify-content: center; }
}

@media (max-width: 700px) {
  .main-top-navbar { width: calc(100% - 14px); padding: 10px; }
  .brand-title { min-height: 46px; }
  .brand-title span { font-size: 21px; }
  .brand-title small { font-size: 11px; }
  .nav-left-zone {
    grid-template-columns: repeat(2,minmax(0,1fr));
    padding-top: 9px;
  }
  .nav-left-zone .nav-pill { min-width: 0; }
}
