/*
 * Whop Checkout Overlay - UNIVERSAL
 * Works on Chrome, Edge, Firefox, Safari
 */

/* Lock body when modal open */
html.whop-open,
body.whop-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  top: 0 !important;
  left: 0 !important;
}

/* Overlay */
.whop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
}

.whop-overlay[style*="flex"] {
  display: flex;
}

/* Dark backdrop */
.whop-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
}

/* Modal */
.whop-modal {
  position: relative;
  background: #fff;
  border-radius: 12px;
  max-width: 440px;
  width: 94%;
  max-height: 85vh;
  z-index: 1;
  display: flex;
  display: -webkit-flex;
  flex-direction: column;
  -webkit-flex-direction: column;
  overflow: hidden;
}

/* Header */
.whop-price-header {
  display: flex;
  display: -webkit-flex;
  align-items: center;
  -webkit-align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #2563eb;
  color: #fff;
  border-radius: 12px 12px 0 0;
  flex-shrink: 0;
  -webkit-flex-shrink: 0;
}

.whop-price-header-icon {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex;
  display: -webkit-flex;
  align-items: center;
  -webkit-align-items: center;
  justify-content: center;
  -webkit-justify-content: center;
}

.whop-price-header-icon svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

.whop-price-header-text {
  display: flex;
  display: -webkit-flex;
  flex-direction: column;
  -webkit-flex-direction: column;
}

.whop-price-title {
  font-size: 0.85rem;
  font-weight: 600;
}

.whop-price-amount {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Close button */
.whop-close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: rgba(255,255,255,0.2);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  color: #fff;
  display: flex;
  display: -webkit-flex;
  align-items: center;
  -webkit-align-items: center;
  justify-content: center;
  -webkit-justify-content: center;
  z-index: 5;
  line-height: 1;
  padding: 0;
}

/* CONTENT AREA - Universal scrolling */
.whop-container {
  flex: 1 1 auto;
  -webkit-flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* iOS smooth scroll */
  min-height: 250px;
  max-height: calc(85vh - 60px);
  /* Universal scrollbar */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #ccc transparent; /* Firefox */
}

/* Webkit scrollbar (Chrome, Edge, Safari) */
.whop-container::-webkit-scrollbar {
  width: 6px;
}

.whop-container::-webkit-scrollbar-track {
  background: transparent;
}

.whop-container::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.whop-container::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Whop embed */
#whop-embedded-checkout {
  width: 100%;
  min-height: 250px;
}

/* Footer - Hide (Whop has its own) */
.whop-powered-by {
  display: none !important;
}

/* ===== MOBILE ===== */
@media screen and (max-width: 600px) {
  .whop-modal {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .whop-price-header {
    border-radius: 0;
    padding-top: 12px;
    padding-top: max(12px, env(safe-area-inset-top, 12px));
  }

  .whop-container {
    max-height: none;
    flex: 1;
    -webkit-flex: 1;
  }

  .whop-close {
    top: 8px;
    top: max(8px, env(safe-area-inset-top, 8px));
  }
}

/* Loading spinner */
.whop-container:empty::after {
  content: '';
  display: block;
  width: 28px;
  height: 28px;
  margin: 60px auto;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  -webkit-animation: whop-spin 0.7s linear infinite;
  animation: whop-spin 0.7s linear infinite;
}

@-webkit-keyframes whop-spin {
  to { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

@keyframes whop-spin {
  to { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}
