/**
 * Freebo Checkout Widget - Styles v1
 */

/* Modal Overlay */
.freebo-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.freebo-modal-active {
  opacity: 1;
  visibility: visible;
}

.freebo-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

/* Modal Container */
.freebo-modal-container {
  position: relative;
  width: 90%;
  max-width: 1200px;
  height: 90%;
  max-height: 900px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.freebo-modal-active .freebo-modal-container {
  transform: scale(1);
}

/* Close Button */
.freebo-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(0, 0, 0, 0.1);
  color: #333;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background-color 0.2s ease, color 0.2s ease;
  padding: 0;
}

.freebo-modal-close:hover {
  background: rgba(0, 0, 0, 0.2);
  color: #000;
}

.freebo-modal-close:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Modal Content */
.freebo-modal-content {
  flex: 1;
  overflow: auto;
  position: relative;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.freebo-modal-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Custom Scrollbar Styling */
.freebo-modal-content::-webkit-scrollbar {
  width: 8px;
}

.freebo-modal-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.freebo-modal-content::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.freebo-modal-content::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .freebo-modal-container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .freebo-modal-close {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .freebo-modal-close:hover {
    background: rgba(255, 255, 255, 1);
  }
}

/* Inline Mode */
[data-freebo-checkout][data-mode="inline"],
[data-freebo-checkout][data-freebo-style="inline"] {
  position: relative;
  width: 100%;
  min-height: 400px;
}

[data-freebo-checkout][data-mode="inline"] iframe,
[data-freebo-checkout][data-freebo-style="inline"] iframe {
  width: 100%;
  border: none;
  display: block;
}

/* Loading State (Optional Enhancement) */
.freebo-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #666;
}

.freebo-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: freebo-spin 0.8s linear infinite;
}

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

/* Accessibility */
.freebo-modal-container:focus {
  outline: none;
}

/* Print - Hide modals when printing */
@media print {
  .freebo-modal {
    display: none !important;
  }
}
