.tsubs-rs-section {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  position: relative;
  animation: tsubsFadeInUp 0.3s ease-out;
  margin: auto;
}

@media (max-width: 767px) {
  .tsubs-rs-section {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    animation: tsubs-slide-up 0.3s ease-out;
    margin: 0;
  }

  #tsubs-resubscribe-modal-backdrop .tsubs-rs-section,
  #theme-tsubs-resubscribe-modal-backdrop .tsubs-rs-section {
    min-height: 100%;
    border-radius: 0;
  }
}

/* Shared Backdrop and Animations (extracted from base_modals.css) */
[id^="tsubs-"][id$="-backdrop"],
[id^="theme-tsubs-"][id$="-backdrop"] {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1060;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.tutor-subscribe-modal-backdrop.is-open {
  display: flex;
}

.tutor-subscribe-modal-main,
.subscribe-modal-main {
  width: 100%;
  background: #fff;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.25);
  position: relative;
}

.subscribe-modal-main::-webkit-scrollbar {
  width: 0;
  display: none;
}

@media (max-width: 767px) {
  [id^="tsubs-"][id$="-backdrop"] {
    align-items: flex-end;
    padding: 0;
  }
}

@keyframes tsubs-fade-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes tsubs-slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes tsubsFadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Shared Component Styles for this modal (from base_modals.css) */
.tsubs-rs-confirm-btn {
  width: 100%;
  padding: 14px;
  background: #ff2500;
  color: #fff;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tsubs-rs-confirm-btn:hover {
  background: #e02100;
}

.tsubs-rs-header {
  padding: 24px 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tsubs-rs-tutor-avatar img {
  width: 48px;
  height: 48px;
  border-radius: 4px;
}

.tsubs-rs-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  color: #121117;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tsubs-rs-content {
  padding: 24px;
}

.tsubs-rs-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  color: #121117;
}

.tsubs-rs-plan-card {
  border-radius: 12px;
  border: 1px solid lightgray;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.tsubs-rs-plan-details {
  display: flex;
  flex-direction: column;
}

.tsubs-rs-plan-name {
  font-size: 16px;
  font-weight: 700;
  color: #121117;
}

.tsubs-rs-plan-period {
  font-size: 14px;
  color: #8d8c9b;
}

.tsubs-rs-change-plan-btn {
  background: #fff;
  border: 1px solid #dcdce5;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  color: black;
}

.tsubs-rs-change-plan-btn:hover {
  background: #f4f4f8;
}

.tsubs-rs-breakdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.tsubs-rs-breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: #121117;
}

.tsubs-rs-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4d4c5c;
}

.tsubs-rs-credit span:last-child {
  color: #10b981;
}

.tsubs-rs-total {
  border-top: 1.5px solid #f4f4f8;
  padding-top: 12px;
  font-weight: 700;
  font-size: 16px;
}

.tsubs-rs-renewal-info {
  margin-bottom: 24px;
}

.tsubs-rs-renewal-title {
  font-size: 15px;
  font-weight: 700;
  color: #121117;
  margin-bottom: 4px;
}

.tsubs-rs-renewal-desc {
  font-size: 13px;
  color: #8d8c9b;
  line-height: 1.4;
}

.tsubs-rs-payment-method label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #121117;
}

.tsubs-rs-payment-selector {
  display: none; /* Hide old selector if any */
}

/* Custom Dropdown Container and Button */
.tsubs-rs-dropdown-container {
  position: relative;
  width: 100%;
}

.tsubs-rs-payment-dropdown {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid #dcdce5;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.tsubs-rs-payment-info {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.tsubs-rs-card-details {
  font-size: 14px;
  color: #121117;
  font-weight: 500;
}

/* Dropdown List Styles */
.tsubs-rs-dropdown-list {
  position: absolute;
  bottom: 100%; /* Open upwards */
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #dcdce5;
  border-radius: 12px;
  list-style: none;
  padding: 8px 0;
  margin: 0 0 4px; /* Move margin to bottom */
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1); /* Shadow upwards */
  display: none;
  z-index: 100;
  animation: tsubs-fade-in-up 0.2s ease-out;
}

.tsubs-rs-dropdown-list.is-open {
  display: block;
}

.tsubs-rs-dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
}

.tsubs-rs-dropdown-item:hover {
  background: #f8f8fb;
}

.tsubs-rs-dropdown-item.selected {
  background: #f0f0f5;
}

.tsubs-rs-dropdown-item .tsubs-rs-payment-info {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.tsubs-rs-visa-icon {
  height: 20px;
  width: auto;
  object-fit: contain;
}

/* Make Apple/Google Pay icons black on white backgrounds */
.tsubs-rs-visa-icon[alt*="Pay"] {
  filter: brightness(0);
}

.tsubs-dropdown-arrow {
  transition: transform 0.3s ease;
}

.tsubs-rs-payment-dropdown[aria-expanded="true"] .tsubs-dropdown-arrow {
  transform: rotate(180deg);
}

/* Confirm Button Icons (Make white on black button) */
.tsubs-confirm-apple-logo,
.tsubs-confirm-google-logo {
  filter: brightness(0) invert(1);
}

/* New Card Panel Styles - Figma Alignment */
.tsubs-rs-new-card-panel {
  margin-top: 24px;
  animation: tsubs-fade-in 0.3s ease-out;
}

.tsubs-rs-form-group {
  margin-bottom: 24px; /* Increased spacing */
}

.tsubs-rs-form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.tsubs-rs-form-col {
  flex: 1;
}

/* Outlined Floating Label Logic */
.tsubs-rs-input-wrapper {
  position: relative;
  width: 100%;
}

.tsubs-rs-form-label {
  position: absolute;
  top: -10px;
  left: 12px;
  background: #fff;
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #8d8c9b; /* Muted color in Figma */
  z-index: 1;
  pointer-events: none;
  transition: all 0.2s ease;
}

.tsubs-rs-form-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #dcdce5;
  border-radius: 12px;
  font-size: 14px;
  color: #121117;
  transition: all 0.2s ease;
  background: transparent;
  position: relative;
}

.tsubs-rs-form-input:focus {
  outline: none;
  border-color: #ff2500;
  box-shadow: 0 0 0 4px rgba(255, 37, 0, 0.05);
}

.tsubs-rs-form-input:focus + .tsubs-rs-form-label {
  color: #ff2500;
}

.tsubs-rs-input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.tsubs-rs-input-icon {
  position: absolute;
  right: 14px;
  pointer-events: auto;
  cursor: help;
}

.tsubs-rs-form-checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-top: 16px;
}

.tsubs-rs-form-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #ff2500;
}

.tsubs-rs-form-checkbox-label {
  font-size: 13px;
  color: #4d4c5c;
  cursor: pointer;
  user-select: none;
}

.tsubs-rs-footer {
  padding: 0 24px 24px;
}

.tsubs-rs-confirm-btn {
  width: 100%;
  padding: 14px;
  background: #ff2500;
  color: #fff;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tsubs-rs-confirm-btn:hover {
  background: #e02100;
}

.tsubs-rs-footer-text {
  font-size: 11px;
  color: #4d4c5c;
  margin-top: 12px;
  line-height: 1.5;
  text-align: left;
}

.tsubs-rs-footer-text a {
  color: #4d4c5c;
  text-decoration: underline;
}

@keyframes tsubs-fade-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tsubs-fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
