.balance-popup {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  width: 360px;
  background: #fff;
  border-radius: 6px;
  padding: 20px;
  z-index: 10001;
  /* Above backdrop */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  color: #1a1a1a;
  display: none;
  text-align: left;
  /* Ensure text is left-aligned */
}

.balance-popup.is-active {
  display: block !important;
}

.balance-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: none;
}

.balance-backdrop.is-active {
  display: block !important;
}

/* #topBar {
  z-index: 10002 !important;
} */

.profile-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 8px;
  scrollbar-width: none;
  scrollbar-color: #cbd5e1 transparent;

  div:last-child {
    margin-right: 10px;
  }
}

.profile-chip.is-active {
  border-color: black;
}

.profile-chips::-webkit-scrollbar {
  height: 4px;
}

.profile-chips::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.profile-chip {
  display: flex;
  align-items: center;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 400;
  flex-shrink: 0;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-chip.is-active {
  border: 2px solid #1a1a1a;
}

.profile-chip .avatar-container {
  width: 30px !important;
  height: 30px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 8px;
}

.profile-chip img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block;
}

.profile-chip-img-only {
  padding: 2px;
}

.profile-chip-img-only .avatar-container {
  margin-right: 0;
}

.balance-popup-body {
  padding: 0 5px;
}

.balance-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 0;
  line-height: 1.1;
  color: #1a1a1a;
}

.balance-subtitle {
  font-size: 15px;
  color: #64748b;
  margin-bottom: 15px;
}

.progress-segments {
  display: flex;
  gap: 3px;
  margin-bottom: 25px;
}

.segment {
  height: 8px;
  flex: 1;
  background: #fff;
  border: 1px solid #059669;
  border-radius: 1px;
}

.segment.filled {
  background: #059669;
}

/* Solid Progress Bar Styles */
.progress-solid-container {
  height: 6px;
  background: #f1f5f9;
  border-radius: 10px;
  margin-bottom: 25px;
  overflow: hidden;
  display: none;
}

.progress-bar-fill {
  height: 100%;
  background: #059669;
  width: 0%;
  transition: width 0.3s ease;
}

/* Toggle Logic */
.balance-popup-body[data-view="solid"] #progress-segments {
  display: none;
}

.balance-popup-body[data-view="solid"] #progress-solid {
  display: block;
}

.balance-popup-body[data-view="segmented"] #progress-segments {
  display: flex;
}

.balance-popup-body[data-view="segmented"] #progress-solid {
  display: none;
}

/* Trial View Logic */
.balance-popup[data-view="trial"] .balance-popup-divider,
.balance-popup[data-view="trial"] .balance-popup-footer {
  display: none !important;
}

.balance-popup-body[data-view="trial"] .progress-bar-container {
  display: none !important;
}

.balance-popup-body[data-view="trial"] #transfer-lessons-btn {
  display: none !important;
}

.balance-popup-body[data-view="trial"] #try-another-teacher-btn {
  display: block !important;
}

/* Cancelled View Styles */
.subscription-cancelled-banner {
  background-color: #dcf1ff;
  color: #0369a1;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  display: none;
  /* Hidden by default */
}

.balance-popup-body[data-view="cancelled"] #subscription-cancelled-banner {
  display: flex !important;
}

/* Expired No Lessons View Styles */
.btn-resubscribe {
  background-color: rgba(255, 37, 0, 1) !important;
  border: 2px solid black !important;
  color: #fff !important;
  font-weight: 700 !important;
  padding: 10px !important;
  border-radius: 8px !important;
  width: 100% !important;
  margin: 0 !important;
  display: none;
}

.balance-popup-body[data-view="expired-no-lessons"] .progress-bar-container {
  display: none !important;
}

.balance-popup-body[data-view="expired-no-lessons"] .subscription-cancelled-banner {
  display: flex !important;
}

.balance-popup-body[data-view="expired-no-lessons"] .btn-balance-action {
  display: none !important;
}

.balance-popup-body[data-view="expired-no-lessons"] #resubscribe-btn {
  display: block !important;
}

.balance-popup[data-view="expired-no-lessons"] .manage-link {
  display: none !important;
}

.action-buttons {
  margin-bottom: 10px;
}

.btn-balance-action {
  display: block;
  width: 100%;
  border: 2px solid #1e293b;
  border-radius: 8px;
  padding: 10px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
  background: transparent;
  color: #1e293b;
  transition: all 0.2s;
  text-align: center;
  cursor: pointer;
  margin-left: 0px !important;
}

.navbar-nav.top-custom-menu .btn-balance-action:hover {
  background: #f1f1f1 !important;
  color: black !important;
  text-decoration: none !important;
  border-color: black !important;
}

.balance-popup-divider {
  height: 0;
  border-top: 1px dashed rgba(77, 76, 92, 1);
  margin: 15px 0;
}

.balance-popup-footer {
  display: flex;
  justify-content: space-between;
  /* align-items: flex-end; */
  padding: 0 5px;
}

.plan-info p {
  margin: 0;
}

.plan-text {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 2px;
}

.plan-date {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.manage-link {
  font-size: 15px;
  font-weight: 800;
  color: #1e293b;
  text-decoration: none;
}

.manage-link:hover {
  color: #000;
  text-decoration: underline;
}

/* Mobile Bottom Sheet Styling */
@media (max-width: 767.98px) {
  .balance-popup {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    max-height: 85vh !important;
    z-index: 10001 !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(100%);
    padding: 30px 20px 20px !important;
  }

  .balance-popup.is-active {
    display: block !important;
    animation: slideUpBalanceSheet 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
  }

  @keyframes slideUpBalanceSheet {
    from {
      transform: translateY(100%);
    }

    to {
      transform: translateY(0);
    }
  }

  /* Bottom sheet handle */
  .balance-popup::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 10px;
  }

  .balance-backdrop {
    z-index: 10000 !important;
  }
}