/**
 * Modal System - Standardized Z-Index Hierarchy & Styles
 * 
 * Z-Index Levels:
 * - 9000: Base overlays
 * - 9100: Standard modals
 * - 9200: Shopping bag (higher than regular modals)
 * - 9300: Checkout overlay (highest priority)
 * - 9400: Email popup (engagement modal)
 * - 9500: Android popup (one-time announcements)
 */

/* =============================================================================
   BASE MODAL OVERLAY STYLES
   ============================================================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
  pointer-events: none;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s 0s;
  pointer-events: auto;
}

/* =============================================================================
   STANDARD MODAL STYLES
   ============================================================================= */

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background-color: white;
  border-radius: 16px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
  z-index: 9100;
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

.modal.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.modal-close-btn {
  position: absolute;
  top: var(--space-sm, 1rem);
  right: var(--space-sm, 1rem);
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
}

/* =============================================================================
   TESTIMONIAL MODAL
   ============================================================================= */

.testimonial-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9000;
  display: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.testimonial-modal-overlay[style*="display: block"] {
  pointer-events: auto;
  opacity: 1;
}

.testimonial-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 9100;
  display: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

.testimonial-modal-close {
  position: absolute;
  top: var(--space-sm, 1rem);
  right: var(--space-sm, 1rem);
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.testimonial-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
}

/* =============================================================================
   FRAME HELP MODAL
   ============================================================================= */

.frame-help-modal {
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 9100;
}

/* =============================================================================
   EMAIL POPUP (ENGAGEMENT MODAL)
   ============================================================================= */

.email-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9400;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
  pointer-events: none;
}

.email-popup-overlay.visible {
  display: flex;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s 0s;
  pointer-events: auto;
}

.email-popup-content {
  background: white;
  padding: 1.5rem;
  border-radius: 16px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

.email-popup-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.email-popup-close:hover {
  background: #f5f5f5;
  color: #333;
}

.email-popup-header {
  margin-bottom: 1.25rem;
}

.email-popup-header h2 {
  color: #2c3e50;
  font-size: 1.5rem;
  margin: 0 0 0.5rem 0;
  font-family: 'Outfit', sans-serif;
}

.email-popup-header > p {
  color: #666;
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.3;
}

.email-popup-coupon {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 2px dashed var(--forest-green, #2d5a3d);
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  position: relative;
  text-align: center;
}

.coupon-perforation {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  border: 2px solid var(--forest-green, #2d5a3d);
}

.coupon-perforation-left {
  left: -8px;
}

.coupon-perforation-right {
  right: -8px;
}

.coupon-amount {
  font-size: 2rem;
  font-weight: bold;
  color: var(--forest-green, #2d5a3d);
  margin: 0.25rem 0;
  font-family: 'Outfit', sans-serif;
}

.coupon-subtitle {
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
}

.email-popup-form {
  margin: 1.25rem 0;
}

.email-popup-input {
  width: 100%;
  padding: 0.875rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  transition: border-color 0.3s ease;
  font-family: 'Outfit', sans-serif;
  box-sizing: border-box;
}

.email-popup-input:focus {
  outline: none;
  border-color: var(--forest-green, #2d5a3d);
}

.email-popup-btn {
  width: 100%;
  background: var(--forest-green, #2d5a3d);
  color: white;
  border: none;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Outfit', sans-serif;
  box-sizing: border-box;
}

.email-popup-btn:hover {
  background: var(--dark-forest-green, #1e3d29);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(44, 74, 60, 0.2);
}

.email-popup-btn:active {
  transform: translateY(0);
}

.email-popup-benefits {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem 0;
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0;
  font-size: 0.875rem;
  color: #333;
}

.benefit-item svg {
  color: var(--forest-green, #2d5a3d);
  flex-shrink: 0;
}

.email-popup-disclaimer {
  font-size: 0.75rem;
  color: #999;
  margin: 0.75rem 0 0 0;
  font-style: italic;
}

.email-popup-message {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  display: none;
}

.email-popup-message[style*="display: block"] {
  display: block;
}

/* =============================================================================
   ANDROID POPUP (ONE-TIME ANNOUNCEMENT)
   ============================================================================= */

.android-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9500;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
  pointer-events: none;
}

.android-popup-overlay.visible {
  display: flex;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s 0s;
  pointer-events: auto;
}

.android-popup {
  background: white;
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: popupSlideIn 0.3s ease-out;
}

@keyframes popupSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.popup-header h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.3rem;
}

.popup-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.popup-close:hover {
  background: #f5f5f5;
  color: #333;
}

.popup-content {
  padding: 1rem 1.5rem;
}

.popup-content p {
  margin: 0 0 1rem 0;
  color: #555;
  line-height: 1.5;
}

.popup-eta {
  background: #f8f9fa;
  padding: 0.8rem;
  border-radius: 8px;
  border-left: 4px solid #10b981;
}

.popup-features {
  margin: 1rem 0;
}

.popup-features p {
  margin: 0.5rem 0;
  color: #10b981;
  font-weight: 500;
}

.popup-note {
  font-style: italic;
  color: #666 !important;
  font-size: 0.9rem;
}

.popup-actions {
  padding: 1rem 1.5rem 1.5rem 1.5rem;
  display: flex;
  justify-content: flex-end;
}

.popup-btn {
  background: #2c3e50;
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.popup-btn:hover {
  background: #34495e;
  transform: translateY(-1px);
}

.popup-btn.secondary {
  background: #f8f9fa;
  color: #666;
  border: 1px solid #e0e0e0;
}

.popup-btn.secondary:hover {
  background: #e9ecef;
  color: #333;
}

/* =============================================================================
   MOBILE RESPONSIVENESS
   ============================================================================= */

@media (max-width: 768px) {
  .modal {
    display: flex;
    flex-direction: column;
    width: 95% !important;
  }
  
  .testimonial-modal {
    width: 95%;
    max-height: 90vh;
  }
  
  .frame-help-modal {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: calc(100vw - 2rem) !important;
    max-width: calc(100vw - 2rem) !important;
    margin: 0 !important;
    max-height: calc(100vh - 2rem) !important;
  }
  
  .android-popup {
    margin: 1rem;
    width: calc(100% - 2rem);
  }
}

@media (max-width: 600px) {
  .email-popup-content {
    width: 95%;
    padding: 1.25rem;
  }
  
  .email-popup-header h2 {
    font-size: 1.3rem;
  }
  
  .coupon-amount {
    font-size: 1.75rem;
  }
  
  .email-popup-form {
    margin: 1rem 0;
  }
}

