/**
 * Payment-Gated Calendly Booking Widget Styles
 * Version: 1.0.0
 */

/* ============================================================================
   Variables
   ============================================================================ */

:root {
  --pbw-primary-color: #6366f1;
  --pbw-primary-dark: #4f46e5;
  --pbw-success-color: #10b981;
  --pbw-error-color: #ef4444;
  --pbw-warning-color: #f59e0b;
  --pbw-text-primary: #e5e7eb;
  --pbw-text-secondary: #9ca3af;
  --pbw-border-color: #10b981;
  --pbw-background: #0f172a;
  --pbw-background-alt: #1e293b;
  --pbw-shadow: 0 1px 3px 0 rgba(16, 185, 129, 0.2), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --pbw-shadow-lg: 0 10px 15px -3px rgba(16, 185, 129, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
  --pbw-border-radius: 8px;
  --pbw-border-radius-lg: 12px;
  --pbw-transition: all 0.3s ease;
}

/* ============================================================================
   Container
   ============================================================================ */

.pbw-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--pbw-text-primary);
  background: var(--pbw-background);
  border: 1px solid var(--pbw-border-color);
  border-radius: var(--pbw-border-radius-lg);
  box-shadow: var(--pbw-shadow-lg);
}

/* ============================================================================
   Header
   ============================================================================ */

.pbw-header {
  text-align: center;
  margin-bottom: 32px;
}

.pbw-title {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--pbw-text-primary);
}

.pbw-description {
  margin: 0;
  font-size: 16px;
  color: var(--pbw-text-secondary);
  line-height: 1.5;
}

/* ============================================================================
   Payment Section
   ============================================================================ */

.pbw-payment-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.pbw-payment-info {
  text-align: center;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--pbw-background-alt);
  border-radius: var(--pbw-border-radius);
}

.pbw-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--pbw-background-alt);
  border-radius: var(--pbw-border-radius);
}

.pbw-price-amount {
  font-size: 48px;
  font-weight: 700;
  color: #10b981;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.pbw-price-currency {
  font-size: 24px;
  font-weight: 600;
  color: #10b981;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.pbw-payment-instructions {
  margin: 0;
  font-size: 14px;
  color: var(--pbw-text-secondary);
}

/* ============================================================================
   QR Code
   ============================================================================ */

.pbw-qr-container {
  display: flex;
  justify-content: center;
  margin: 24px 0;
  padding: 20px;
  background: #ffffff;
  border: 2px solid var(--pbw-border-color);
  border-radius: var(--pbw-border-radius);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.pbw-qr-code {
  display: flex;
  justify-content: center;
  align-items: center;
}

.pbw-qr-code img {
  display: block;
  max-width: 100%;
  height: auto;
}

.pbw-qr-fallback {
  padding: 20px;
  text-align: center;
}

.pbw-qr-fallback code {
  display: block;
  margin-top: 12px;
  padding: 12px;
  background: var(--pbw-background-alt);
  border-radius: var(--pbw-border-radius);
  font-size: 12px;
  word-break: break-all;
  overflow-wrap: break-word;
}

/* ============================================================================
   Pay Button
   ============================================================================ */

.pbw-pay-button {
  width: auto;
  min-width: 300px;
  max-width: 400px;
  padding: 18px 36px;
  font-size: 20px;
  font-weight: 700;
  color: #10b981;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #1e3a8a 70%, #1e40af 100%);
  background-size: 200% 200%;
  border: 2px solid #10b981;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3), 0 0 30px rgba(16, 185, 129, 0.2);
  position: relative;
  overflow: hidden;
  animation: gradient-shift 3s ease infinite;
  margin: 0 auto;
}

@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.pbw-pay-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.3), transparent);
  transition: left 0.6s ease;
}

.pbw-pay-button:hover::before {
  left: 100%;
}

.pbw-pay-button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.5), 0 0 50px rgba(16, 185, 129, 0.4);
  border-color: #34d399;
  color: #34d399;
}

.pbw-pay-button:active {
  transform: translateY(-1px) scale(1);
  box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4);
}

.pbw-pay-button-icon {
  font-size: 28px;
  animation: pulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.6));
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

.pbw-pay-button-text {
  font-weight: 700;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.8), 0 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.5px;
}

/* ============================================================================
   Payment Details
   ============================================================================ */

.pbw-payment-details {
  margin: 24px 0;
  padding: 16px;
  background: var(--pbw-background-alt);
  border-radius: var(--pbw-border-radius);
}

.pbw-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.pbw-detail-row:not(:last-child) {
  border-bottom: 1px solid var(--pbw-border-color);
}

.pbw-detail-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--pbw-text-secondary);
}

.pbw-detail-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--pbw-text-primary);
  text-align: right;
}

.pbw-wallet-address {
  font-family: monospace;
  font-size: 13px;
}

/* ============================================================================
   Status
   ============================================================================ */

.pbw-status {
  text-align: center;
  margin-top: 24px;
  padding: 20px;
  background: var(--pbw-background-alt);
  border-radius: var(--pbw-border-radius);
}

.pbw-status-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: pbw-pulse 2s ease-in-out infinite;
}

@keyframes pbw-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

.pbw-status-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--pbw-text-primary);
  margin-bottom: 8px;
}

.pbw-countdown {
  font-size: 14px;
  font-weight: 500;
  color: var(--pbw-text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
   Success Section
   ============================================================================ */

.pbw-success-section {
  text-align: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-radius: var(--pbw-border-radius);
  margin-bottom: 12px;
}

.pbw-success-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  background: var(--pbw-success-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  font-weight: bold;
  animation: pbw-success-pop 0.5s ease-out;
}

@keyframes pbw-success-pop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.pbw-success-title {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--pbw-success-color);
}

.pbw-success-message {
  margin: 0;
  font-size: 14px;
  color: #065f46;
}

/* ============================================================================
   Error Section
   ============================================================================ */

.pbw-error-section {
  text-align: center;
  padding: 32px 20px;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-radius: var(--pbw-border-radius);
}

.pbw-error-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--pbw-error-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
  font-weight: bold;
}

.pbw-error-title {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--pbw-error-color);
}

.pbw-error-message {
  margin: 0 0 20px 0;
  font-size: 16px;
  color: #991b1b;
}

.pbw-retry-button {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: var(--pbw-primary-color);
  border: none;
  border-radius: var(--pbw-border-radius);
  cursor: pointer;
  transition: var(--pbw-transition);
}

.pbw-retry-button:hover {
  background: var(--pbw-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--pbw-shadow);
}

.pbw-retry-button:active {
  transform: translateY(0);
}

/* ============================================================================
   Calendly Section
   ============================================================================ */

.pbw-calendly-section {
  margin-top: 24px;
  border-radius: var(--pbw-border-radius);
  overflow: hidden;
  animation: pbw-slide-in 0.5s ease-out;
  min-height: 800px;
}

#pbw-calendly-container {
  min-height: 800px !important;
  height: 800px !important;
}

#pbw-calendly-container iframe,
.pbw-calendly-section iframe,
.calendly-inline-widget,
.calendly-inline-widget iframe {
  min-height: 800px !important;
  height: 800px !important;
}

@keyframes pbw-slide-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#pbw-calendly-container iframe {
  border-radius: var(--pbw-border-radius);
  box-shadow: var(--pbw-shadow);
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 640px) {
  .pbw-container {
    padding: 16px;
    border-radius: var(--pbw-border-radius);
  }

  .pbw-title {
    font-size: 20px;
  }

  .pbw-description {
    font-size: 14px;
  }

  .pbw-price-amount {
    font-size: 28px;
  }

  .pbw-price-currency {
    font-size: 16px;
  }

  .pbw-qr-container {
    padding: 16px;
  }

  .pbw-detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .pbw-detail-value {
    text-align: left;
  }

  .pbw-success-title,
  .pbw-error-title {
    font-size: 20px;
  }

  #pbw-calendly-container iframe {
    height: 600px !important;
  }
}

/* ============================================================================
   Loading States
   ============================================================================ */

.pbw-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--pbw-border-color);
  border-top-color: var(--pbw-primary-color);
  border-radius: 50%;
  animation: pbw-spin 1s linear infinite;
}

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

/* ============================================================================
   Utilities
   ============================================================================ */

.pbw-hidden {
  display: none !important;
}

.pbw-fade-in {
  animation: pbw-fade-in 0.3s ease-in;
}

@keyframes pbw-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ============================================================================
   Print Styles
   ============================================================================ */

@media print {
  .pbw-container {
    box-shadow: none;
    border: 1px solid #000;
  }

  .pbw-qr-code {
    break-inside: avoid;
  }

  .pbw-retry-button {
    display: none;
  }
}
