/**
 * Modal & Overlay Styles
 * Email capture, confirmation dialogs, and overlays
 */

/* ========== MODAL OVERLAY ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--spacing-lg);
  opacity: 0;
  animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.modal-overlay.closing {
  animation: fadeOut 0.3s forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
  }
}

/* ========== MODAL CONTAINER ========== */
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  animation: modalSlideIn 0.3s forwards;
}

@keyframes modalSlideIn {
  to {
    transform: scale(1) translateY(0);
  }
}

.modal.closing {
  animation: modalSlideOut 0.3s forwards;
}

@keyframes modalSlideOut {
  to {
    transform: scale(0.9) translateY(20px);
  }
}

.modal-header {
  padding: var(--spacing-xl);
  border-bottom: 1px solid #e0e0e0;
  position: relative;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--dark);
}

.modal-subtitle {
  font-size: 0.875rem;
  color: var(--gray);
  margin-top: var(--spacing-sm);
}

.modal-close {
  position: absolute;
  top: var(--spacing-lg);
  right: var(--spacing-lg);
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-gray);
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--gray);
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--light-gray);
  color: var(--dark);
  transform: rotate(90deg);
}

.modal-body {
  padding: var(--spacing-xl);
}

.modal-footer {
  padding: var(--spacing-xl);
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-end;
}

/* ========== EMAIL CAPTURE MODAL ========== */
.email-capture-modal .modal-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  border: none;
}

.email-capture-modal .modal-title {
  color: var(--white);
}

.email-capture-modal .modal-subtitle {
  color: rgba(255, 255, 255, 0.9);
}

.email-capture-modal .modal-close {
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.email-capture-modal .modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.email-benefit-list {
  list-style: none;
  margin: var(--spacing-lg) 0;
}

.email-benefit-item {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  padding: var(--spacing-md) 0;
}

.email-benefit-icon {
  width: 24px;
  height: 24px;
  background: var(--success);
  color: var(--white);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.email-benefit-text {
  font-size: 0.9375rem;
  color: var(--dark);
  line-height: 1.6;
}

.email-form {
  margin-top: var(--spacing-lg);
}

.email-input-group {
  display: flex;
  gap: var(--spacing-sm);
}

.email-input {
  flex: 1;
  padding: 14px 18px;
  font-size: 1rem;
  border: 2px solid var(--light-gray);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.email-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

.email-submit {
  padding: 14px 24px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.email-submit:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.email-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.email-privacy {
  font-size: 0.75rem;
  color: var(--gray);
  margin-top: var(--spacing-md);
  text-align: center;
}

.email-privacy a {
  color: var(--primary);
  text-decoration: underline;
}

/* ========== SUCCESS STATE ========== */
.modal-success {
  text-align: center;
  padding: var(--spacing-2xl);
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--spacing-lg);
  background: var(--success);
  color: var(--white);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scaleIn {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}

.success-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
}

.success-message {
  color: var(--gray);
  margin-bottom: var(--spacing-lg);
}

/* ========== CONFIRMATION MODAL ========== */
.confirm-modal .modal-body {
  text-align: center;
  padding: var(--spacing-2xl);
}

.confirm-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--spacing-lg);
  background: var(--warning);
  color: var(--white);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.confirm-message {
  font-size: 1.125rem;
  color: var(--dark);
  margin-bottom: var(--spacing-lg);
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
  position: fixed;
  top: var(--spacing-lg);
  right: var(--spacing-lg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  pointer-events: none;
}

.toast {
  background: var(--white);
  color: var(--dark);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  min-width: 300px;
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  pointer-events: all;
  transform: translateX(400px);
  animation: slideInRight 0.3s forwards;
}

/* Toast type-specific backgrounds and colors */
.toast-success {
  background: #00b894;
  color: #ffffff;
}

.toast-error {
  background: #d63031;
  color: #ffffff;
}

.toast-warning {
  background: #fdcb6e;
  color: #2d3436;
}

.toast-info {
  background: #0984e3;
  color: #ffffff;
}

@keyframes slideInRight {
  to {
    transform: translateX(0);
  }
}

.toast.removing {
  animation: slideOutRight 0.3s forwards;
}

@keyframes slideOutRight {
  to {
    transform: translateX(400px);
  }
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.875rem;
}

.toast-success .toast-icon {
  background: var(--success);
  color: var(--white);
}

.toast-error .toast-icon {
  background: var(--error);
  color: var(--white);
}

.toast-warning .toast-icon {
  background: var(--warning);
  color: var(--white);
}

.toast-info .toast-icon {
  background: var(--info);
  color: var(--white);
}

.toast-message {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--dark);
}

.toast-close {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--gray);
  cursor: pointer;
  font-size: 1.125rem;
  transition: color 0.2s;
}

.toast-close:hover {
  color: var(--dark);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .modal {
    margin: var(--spacing-md);
    max-width: calc(100% - var(--spacing-xl));
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: var(--spacing-lg);
  }
  
  .email-input-group {
    flex-direction: column;
  }
  
  .toast-container {
    left: var(--spacing-md);
    right: var(--spacing-md);
  }
  
  .toast {
    min-width: auto;
  }
}

/* ========== GLOPIX IMAGE COMPARISON ========== */
.glopix-compare-container {
  position: relative;
  width: 100%;
  max-height: 70vh;
  overflow: hidden;
  border-radius: 12px;
  background: #0a060e;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Image Wrapper - Contains both images and controls */
.glopix-image-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 70vh;
}

/* After Image (background layer) */
.glopix-after-image {
  position: relative;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  display: block;
  z-index: 1;
}

/* Before Image Clipping Mask */
.glopix-before-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  z-index: 2;
  transition: width 0.05s ease-out;
}

.glopix-before-image {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
}

/* Divider Line */
.glopix-divider {
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: 100%;
  background: #7f0df2;
  box-shadow: 0 0 10px rgba(127, 13, 242, 0.5);
  z-index: 4;
  transform: translateX(-50%);
  pointer-events: none;
  transition: left 0.05s ease-out;
}

/* Slider Handle */
.glopix-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.05s ease-out;
}

.glopix-handle-circle {
  width: 40px;
  height: 40px;
  background: #7f0df2;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.glopix-handle-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: #7f0df2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.glopix-handle-arrow .material-symbols-outlined {
  font-size: 16px;
  color: #fff;
}

.glopix-handle-left {
  left: -30px;
}

.glopix-handle-right {
  right: -30px;
}

/* Labels */
.glopix-label {
  position: absolute;
  top: 16px;
  padding: 6px 12px;
  background: rgba(10, 6, 14, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(127, 13, 242, 0.3);
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 3;
  pointer-events: none;
}

.glopix-label-before {
  left: 16px;
}

.glopix-label-after {
  right: 16px;
}

/* Invisible Slider Overlay */
.glopix-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 10;
  -webkit-appearance: none;
  appearance: none;
}

.glopix-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 100%;
  cursor: ew-resize;
}

.glopix-slider::-moz-range-thumb {
  width: 100px;
  height: 100%;
  cursor: ew-resize;
  border: none;
  background: transparent;
}

/* Hover Effects */
.glopix-compare-container:hover .glopix-divider {
  background: #9d4ef7;
  box-shadow: 0 0 15px rgba(127, 13, 242, 0.7);
}

.glopix-compare-container:hover .glopix-handle-circle {
  background: #9d4ef7;
  transform: scale(1.1);
  transition: transform 0.2s;
}

/* Responsive */
@media (max-width: 768px) {
  .glopix-handle {
    width: 50px;
    height: 50px;
  }
  
  .glopix-handle-circle {
    width: 32px;
    height: 32px;
  }
  
  .glopix-handle-arrow {
    width: 20px;
    height: 20px;
  }
  
  .glopix-handle-arrow .material-symbols-outlined {
    font-size: 14px;
  }
  
  .glopix-label {
    font-size: 9px;
    padding: 4px 8px;
  }
}
