/* =========================================================
   NAVBAR / SIDEBAR
   ========================================================= */

/* ---------- Shared ---------- */
.es-navbar-logo {
  height: 42px;
  width: auto;
  display: block;
}

.es-icon-btn {
  border: 0;
  box-shadow: none;
  background-image: none;
  padding: 0.35rem 0.5rem;
}

.es-kyc-badge {
  cursor: help;
}

/* ---------- Auth shell: sidebar + content ---------- */
.es-shell {
  display: flex;
  gap: 0;
}

.es-content {
  flex: 1;
  min-width: 0;
  padding: 0;
}

/* ---------- Sidebar (desktop) ---------- */
.es-sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: var(--bs-primary);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.es-sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  padding: 1rem;
  gap: 1rem;
}

/* Non-clickable brand (player portal) */
.es-navbar-brand-static {
  cursor: default;
}

.es-sidebar-brand {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

/* Sidebar nav should scroll internally (prevents extending below page/footer) */
.es-side-nav {
  flex: 1 1 auto;   /* allow it to grow within .es-sidebar-inner */
  min-height: 0;    /* REQUIRED for overflow in flex containers */
  overflow-y: auto; /* internal scroll instead of pushing past viewport */
}

/* Optional: nicer scrollbar on desktop */
.es-side-nav::-webkit-scrollbar {
  width: 10px;
}
.es-side-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 10px;
}
.es-side-nav::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.08);
}

/* ---------- Sidebar + Offcanvas nav link styling (shared) ---------- */
.es-side-nav .nav-link,
.es-offcanvas .nav-link {
  /* Slightly brighter for better readability */
  color: rgba(255, 255, 255, 0.98);
  border-radius: var(--bs-border-radius);
  padding: 0.6rem 0.75rem;
}

.es-side-nav .nav-link:hover,
.es-side-nav .nav-link:focus,
.es-offcanvas .nav-link:hover,
.es-offcanvas .nav-link:focus {
  color: #fff;
  background: rgba(0, 0, 0, 0.14);
}

.es-side-nav .nav-link.active {
  color: #fff;
  background: rgba(0, 0, 0, 0.22);
}

/* Disabled sidebar link refinement */
.es-side-nav .nav-link.disabled {
  opacity: 0.65;
  pointer-events: none;
}

.es-side-nav .nav-link.disabled .badge {
  font-size: 0.65rem;
}

/* ---------- Admin accordion inside sidebar (match orange theme) ---------- */
.es-sidebar .accordion {
  --bs-accordion-bg: transparent;
  --bs-accordion-border-color: rgba(255, 255, 255, 0.18);

  /* Brighter text for menu group headers */
  --bs-accordion-btn-color: rgba(255, 255, 255, 0.98);
  --bs-accordion-btn-bg: transparent;
  --bs-accordion-active-bg: rgba(0, 0, 0, 0.12);
  --bs-accordion-active-color: #fff;

  /* Keep a white icon in case Bootstrap uses the variable path */
  --bs-accordion-btn-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='%23ffffff' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
  --bs-accordion-btn-active-icon: var(--bs-accordion-btn-icon);
}

.es-sidebar .accordion-item {
  background: transparent;
  border: 0;
  margin-bottom: 0.25rem;
}

.es-sidebar .accordion-button {
  border-radius: var(--bs-border-radius);
  padding: 0.55rem 0.75rem;
  box-shadow: none;

  /* app.css forces accordion-button color to body color; keep sidebar menu readable */
  color: rgba(255, 255, 255, 0.98) !important;

  /* polish */
  transition: background-color 160ms ease, color 160ms ease;
}

.es-sidebar .accordion-button:not(.collapsed) {
  color: #fff !important;
}

.es-sidebar .accordion-button:focus {
  box-shadow: none;
}

/* ---------- Sidebar accordion chevron: ALWAYS WHITE, no tile ---------- */
.es-sidebar .accordion-button::after {
  /* force our own SVG (bypasses dark-mode tint + mask path) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23ffffff' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E") !important;

  /* kill Bootstrap mask-based icon pipeline (prevents “white box” tiles) */
  -webkit-mask-image: none !important;
  mask-image: none !important;

  /* ensure no background tile */
  background-color: transparent !important;

  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 1.25rem 1.25rem !important;

  filter: none !important;
  opacity: 1 !important;

  transition: transform 160ms ease, opacity 160ms ease;
}

.es-sidebar .accordion-button:not(.collapsed)::after {
  transform: rotate(-180deg);
}

/* Slight polish: ensure hover doesn’t dim */
.es-sidebar .accordion-button:hover::after {
  opacity: 1 !important;
}

.es-sidebar .accordion-body {
  padding: 0.25rem 0;
}

/* Indented links under each group */
.es-sidebar .accordion-body .nav-link {
  padding-left: 1.25rem;
}

/* ---------- Offcanvas (auth menu) ---------- */
.es-offcanvas {
  background: var(--bs-primary);
  color: #fff;
}

/* Offcanvas menu should scroll internally (prevents extending below viewport) */
.es-offcanvas .offcanvas-body {
  overflow-y: auto;
}

.es-offcanvas .offcanvas-title,
.es-offcanvas .btn-close {
  filter: invert(1);
}

/* =========================================================
   PLAYER MOBILE TOPBAR (authTopbar)
   - Single-row layout down to ~320px
   - Theme-friendly balance pill + actions (+) button
   ========================================================= */
.es-player-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.es-topbar-single {
  min-height: 56px;
}

.es-player-brand .es-navbar-logo {
  height: 40px;
}

/* Balance pill */
.es-balance-pill {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--bs-dark);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* + actions button */
.es-topbar-plus {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--bs-primary);
  padding: 0.45rem 0.7rem;
  border-radius: var(--bs-border-radius);
}

.es-topbar-plus:hover,
.es-topbar-plus:focus {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(255, 255, 255, 0.55);
  color: var(--bs-primary);
}

/* Tighten for small phones + hide desktop sidebar */
@media (max-width: 430px) {
  .es-player-brand .es-navbar-logo {
    height: 36px;
  }
  .es-balance-pill {
    padding: 0.45rem 0.75rem !important;
    font-size: 0.95rem;
  }
  .es-topbar-plus {
    padding: 0.45rem 0.6rem;
  }
  .es-sidebar {
    display: none;
  }
}

@media (max-width: 399.98px) {
  .es-player-brand .es-navbar-logo {
    height: 34px;
  }
  .es-balance-pill {
    padding: 6px !important;
    font-size: 13px;
    white-space: nowrap;
  }
  .es-topbar-plus {
    padding: 0.4rem 0.55rem;
  }
}

/* =========================================================
   PUBLIC NAVBAR: stable mobile layout (no overlap)
   ========================================================= */
@media (max-width: 991.98px) {
  /* Header row becomes a 3-column grid */
  .es-public-head {
    display: grid;
    grid-template-columns: 44px 1fr 44px; /* left spacer | logo | toggler */
    align-items: center;
    min-height: 56px;
  }
  .es-public-left {
    width: 44px;
    height: 44px;
  }
  .es-public-head .navbar-brand {
    justify-self: center;
    margin: 0;
  }
  .es-public-toggler {
    justify-self: end;
    margin: 0;
  }

  /* Collapsed menu sits below header row and aligns right */
  .es-public-collapse {
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
  }
  .es-public-collapse .navbar-nav {
    align-items: flex-end;
    text-align: right;
  }
}

@media (min-width: 992px) {
  .es-public-navbar {
    display: flex;
    align-items: center;
    gap: 1rem;
  }
  .es-public-head {
    flex: 0 0 auto;
  }

  /* Collapse behaves like normal navbar row on desktop */
  .es-public-collapse {
    display: flex !important;
    flex-basis: auto;
    flex-grow: 1;
  }

  /* Keep menu on the right */
  .es-public-collapse .navbar-nav {
    margin-left: auto;
  }

  /* Desktop cleanup */
  .es-public-toggler {
    display: none;
  }
  .es-public-left {
    display: none;
  }
}

/* =========================================================
   Z-INDEX: offcanvas above mobile topbar
   ========================================================= */
.es-auth-topbar {
  position: relative;
  z-index: 1030; /* Bootstrap navbar default */
}

.es-offcanvas.offcanvas {
  z-index: 1055; /* above navbar/topbar */
}

.offcanvas-backdrop {
  z-index: 1050; /* Bootstrap uses 1040+; keep above topbar */
}

/* =========================================================
   BADGES: contrast on primary (orange) background
   ========================================================= */
.es-sidebar .badge,
.es-offcanvas .badge {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.es-sidebar .badge.text-bg-warning,
.es-offcanvas .badge.text-bg-warning {
  background-color: rgba(0, 0, 0, 0.28) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

/* =========================================================
   TRANSITIONS
   - Hooked by .es-sidebar-transition on sidebar inner
   ========================================================= */
.es-sidebar-transition {
  transition: transform 220ms ease, opacity 220ms ease;
  transform: translateX(0);
  opacity: 1;
}

/* When sidebar is inside an offcanvas, give it a tiny slide-in feel */
.offcanvas:not(.show) .es-sidebar-transition {
  transform: translateX(-8px);
  opacity: 0.96;
}