/* Modern Quick Buy Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show {
  opacity: 1;
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  transform: scale(0.9) translateY(50px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.modal-overlay.show .modal-content {
  transform: scale(1) translateY(0);
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1;
}

.close-btn:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 5px 15px rgba(240, 147, 251, 0.4);
}

.modal-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-product-title {
  color: #6c757d;
  font-size: 1rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 12px;
  border-left: 4px solid #667eea;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #4a5568;
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 0.875rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: #fff;
}

.form-control:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

.form-control.error {
  border-color: #f56565;
  box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.1);
}

.error-message {
  color: #f56565;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: none;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.submit-btn {
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 1rem;
  position: relative;
  overflow: hidden;
}

.submit-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.submit-btn:hover::before {
  left: 100%;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

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

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Loading state */
.submit-btn.loading {
  opacity: 0.8;
  cursor: wait;
}

.submit-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Success message */
.success-message {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
  padding: 1rem;
  border-radius: 12px;
  margin-top: 1rem;
  text-align: center;
  font-weight: 600;
  display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .modal-content {
    padding: 1.5rem;
    margin: 1rem;
    max-width: none;
    width: calc(100% - 2rem);
  }
  
  .modal-title {
    font-size: 1.5rem;
  }
  
  .form-control {
    padding: 0.75rem;
  }
  
  .submit-btn {
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .modal-content {
    padding: 1rem;
    margin: 0.5rem;
    width: calc(100% - 1rem);
    border-radius: 16px;
  }
  
  .modal-title {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
  }
  
  .modal-product-title {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
  }
  
  .close-btn {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-content,
  .form-control,
  .submit-btn,
  .close-btn {
    transition: none;
  }
  
  .submit-btn::before {
    display: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .modal-content {
    border: 2px solid #000;
  }
  
  .form-control {
    border-width: 2px;
  }
  
  .form-control:focus {
    border-color: #000;
  }
}

/* Focus management for keyboard navigation */
.modal-overlay:focus-within .close-btn:focus,
.modal-overlay:focus-within .form-control:focus,
.modal-overlay:focus-within .submit-btn:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}


/* Ensure modal scrolls fully on all devices */
#quickBuyModal.modal-overlay { overflow-y: auto; }
#quickBuyModal .modal-content {
  max-height: calc(100vh - 48px);
  margin: 24px;
  overflow-y: auto;
}
@media (max-width: 768px) {
  #quickBuyModal .modal-content {
    max-height: calc(100vh - 24px);
    margin: 12px;
  }
}
