.tapin-purchase-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.tapin-purchase-modal.is-open {
  display: flex;
}

.tapin-purchase-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 0;
}

.tapin-purchase-modal__dialog {
  position: relative;
  width: min(520px, 92vw);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
  padding: 28px 30px 24px;
  direction: rtl;
  text-align: right;
  z-index: 1;
}

.tapin-purchase-modal__title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #1f2937;
  margin: 0;
}

.tapin-purchase-modal__subtitle {
  margin: 6px 0 24px;
  color: #475569;
  font-size: 0.95rem;
}

.tapin-quantity-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.tapin-quantity-step[hidden] {
  display: none;
}

.tapin-quantity-step__controls {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.06);
}

.tapin-quantity-step__btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #cbd5f5;
  background: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1f2937;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.tapin-quantity-step__btn:hover,
.tapin-quantity-step__btn:focus {
  background: #f1f5f9;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.tapin-quantity-step__btn:active {
  transform: scale(0.96);
}

.tapin-quantity-step__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}


.tapin-ticket-step {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 24px;
}

.tapin-ticket-step__list {
  display: grid;
  gap: 16px;
}

@media (min-width: 640px) {
  .tapin-ticket-step__list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

.tapin-ticket-card {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.05);
}

.tapin-ticket-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.tapin-ticket-card__titles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tapin-ticket-card__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.tapin-ticket-card__description {
  font-size: 0.85rem;
  color: #64748b;
}

.tapin-ticket-card__price {
  font-weight: 700;
  font-size: 1rem;
  color: #0f172a !important;
}

.tapin-ticket-card__price .woocommerce-Price-amount,
.tapin-ticket-card__price .woocommerce-Price-amount *,
.tapin-ticket-card__price .woocommerce-Price-currencySymbol {
  color: inherit !important;
}

.tapin-ticket-card__meta {
  font-size: 0.85rem;
  color: #475569;
}

.tapin-ticket-card__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  direction: ltr;
}

.tapin-ticket-card__actions [data-ticket-action='decrease'] {
  order: 0;
}

.tapin-ticket-card__actions [data-ticket-quantity] {
  order: 1;
}

.tapin-ticket-card__actions [data-ticket-action='increase'] {
  order: 2;
}

.tapin-ticket-card__btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid #cbd5f5;
  background: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1f2937;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tapin-ticket-card__btn:hover,
.tapin-ticket-card__btn:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.tapin-ticket-card__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tapin-ticket-card__quantity {
  font-weight: 700;
  font-size: 1.1rem;
  min-width: 36px;
  text-align: center;
}

.tapin-ticket-card--soldout {
  opacity: 0.6;
}

.tapin-ticket-card__soldout {
  font-size: 0.82rem;
  color: #ef4444;
}

.tapin-ticket-step__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.tapin-ticket-step__total {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #0f172a;
}

.tapin-ticket-step__error {
  color: #b91c1c;
  font-size: 0.85rem;
  margin: 0;
}

.tapin-ticket-hint {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #334155;
}

.tapin-quantity-step__value {
  min-width: 48px;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.tapin-purchase-modal__close {
  position: absolute;
  inset-inline-start: 12px;
  top: 12px;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: #64748b;
}

.tapin-field {
  margin-bottom: 18px;
}

.tapin-field label {
  display: block;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 6px;
}

.tapin-field input,
.tapin-field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  font-size: 1rem;
  background-color: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tapin-field select {
  direction: rtl;
  text-align: right;
}

.tapin-field--choice .tapin-choice {
  display: flex;
  gap: 10px;
}

.tapin-choice__option {
  flex: 1 1 0;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #1f2937;
  font-weight: 600;
  font-size: 1rem;
  min-width: 0;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.tapin-choice__option:hover {
  border-color: #cbd5f5;
  background: #e2e8f0;
}

.tapin-choice__option.is-selected {
  background: #16a34a;
  color: #fff;
  border-color: #15803d;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.25);
}

.tapin-choice__option:focus {
  outline: none;
  border-color: #2a1a5e;
  box-shadow: 0 0 0 3px rgba(42, 26, 94, 0.18);
}

.tapin-choice--locked .tapin-choice__option {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.tapin-choice--locked .tapin-choice__option.is-selected {
  background: #16a34a;
  color: #fff;
}

.tapin-choice--invalid .tapin-choice__option {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.tapin-field input:focus,
.tapin-field select:focus {
  outline: none;
  border-color: #2a1a5e;
  box-shadow: 0 0 0 3px rgba(42, 26, 94, 0.15);
}

.tapin-field input.tapin-field--locked,
.tapin-field select.tapin-field--locked {
  background-color: #f8fafc;
  color: #475569;
  cursor: not-allowed;
}

.tapin-field--invalid,
.tapin-field input.tapin-field--invalid,
.tapin-field select.tapin-field--invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.tapin-field__error {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: #b91c1c;
  min-height: 18px;
}

.tapin-required {
  color: #ef4444;
}

.tapin-purchase-modal__actions {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 18px;
}

.tapin-btn {
  padding: 12px 22px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: opacity 0.2s ease;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tapin-btn:hover {
  opacity: 0.85;
}

.tapin-btn--primary {
  background: #16a34a;
  color: #fff;
}

.tapin-btn--ghost {
  background: #f1f5f9;
  color: #1f2937;
}

@media (max-width: 540px) {
  .tapin-purchase-modal__dialog {
    padding: 24px 20px 20px;
    width: min(94vw, 520px);
  }

  .tapin-quantity-step {
    margin-bottom: 20px;
  }

  .tapin-quantity-step__controls {
    gap: 12px;
    padding: 12px 16px;
  }

  .tapin-quantity-step__btn {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .tapin-quantity-step__value {
    min-width: 44px;
    font-size: 1.4rem;
  }

  .tapin-purchase-modal__actions {
    flex-direction: column-reverse;
  }

  .tapin-btn {
    width: 100%;
  }

  .tapin-field--choice .tapin-choice {
    flex-direction: column;
  }
}
