/* Modal Base Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.modal.active {
  display: block;
}

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

.modal-container {
  position: relative;
  max-width: 540px;
  max-height: 90vh;
  margin: 5vh auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  animation: slideUp 0.4s ease;
}

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Header */
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 36px;
  color: #6B7280;
  cursor: pointer;
  line-height: 1;
  font-weight: 300;
  transition: all 0.2s ease;
  z-index: 10;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close:hover {
  color: #1F2937;
  background: #F3F4F6;
  transform: rotate(90deg);
}

.modal-content {
  padding: 2.5rem;
}

.modal-header {
  text-align: center;
  margin-bottom: 2rem;
}

.modal-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #1F2937;
  margin: 0 0 0.5rem 0;
}

.modal-subtitle {
  font-size: 1rem;
  color: #6B7280;
  margin: 0;
}

/* Form Styles */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  color: #1F2937;
  font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.875rem 1rem;
  border: 2px solid #E5E7EB;
  border-radius: 10px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
  background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #9CA3AF;
}

/* Checkbox Groups */
.checkbox-group {
  margin: 0.5rem 0;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 400;
  line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 0.25rem;
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #10B981;
}

.checkbox-label span {
  flex: 1;
  color: #374151;
  font-size: 0.95rem;
}

.checkbox-label a {
  color: #10B981;
  text-decoration: none;
  font-weight: 500;
}

.checkbox-label a:hover {
  text-decoration: underline;
}

/* Plan Description */
.plan-description {
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background: #F0F9FF;
  border-left: 3px solid #10B981;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #1F2937;
  display: none;
}

.plan-description.active {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.plan-description strong {
  color: #059669;
  font-weight: 600;
}

.modal-submit-btn {
  background: #FF8000;
  color: white;
  padding: 1rem 2rem;
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 0.5rem;
  box-shadow: 0 4px 12px rgba(255, 128, 0, 0.3);
}

.modal-submit-btn:hover {
  background: #e76f00;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 128, 0, 0.4);
}

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

.modal-submit-btn:disabled {
  background: #9CA3AF;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.form-footer {
  text-align: center;
  font-size: 0.875rem;
  color: #6B7280;
  margin: 1rem 0 0 0;
  line-height: 1.5;
}

.form-footer a {
  color: #10B981;
  text-decoration: none;
  font-weight: 500;
}

.form-footer a:hover {
  text-decoration: underline;
}

/* Success State */
.form-success {
  text-align: center;
  padding: 2rem 0;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: bold;
  margin: 0 auto 1.5rem;
  animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.form-success h3 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1F2937;
  margin: 0 0 1rem 0;
}

.form-success p {
  font-size: 1.1rem;
  color: #6B7280;
  line-height: 1.6;
  margin: 0 0 2rem 0;
}

.modal-close-btn {
  background: #10B981;
  color: white;
  padding: 0.875rem 2.5rem;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-close-btn:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
  .modal-container {
    max-width: calc(100% - 2rem);
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }
  
  .modal-content {
    padding: 2rem 1.5rem;
  }
  
  .modal-header h2 {
    font-size: 1.5rem;
  }
  
  .modal-close {
    top: 15px;
    right: 15px;
    font-size: 32px;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .modal-submit-btn {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .modal-content {
    padding: 1.5rem 1rem;
  }
  
  .modal-header h2 {
    font-size: 1.35rem;
  }
  
  .modal-subtitle {
    font-size: 0.9rem;
  }
  
  .success-icon {
    width: 64px;
    height: 64px;
    font-size: 2.5rem;
  }
  
  .form-success h3 {
    font-size: 1.5rem;
  }
  
  .form-success p {
    font-size: 1rem;
  }
}

/* Loading State */
.modal-form.loading .modal-submit-btn::after {
  content: "";
  width: 16px;
  height: 16px;
  margin-left: 10px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.6s linear infinite;
}

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

/* Error State */
.form-error {
  background: #FEE2E2;
  color: #991B1B;
  padding: 0.875rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  border-left: 4px solid #DC2626;
  display: none;
}

.form-error.active {
  display: block;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.form-group.error input,
.form-group.error select,
.form-group.error textarea {
  border-color: #DC2626;
}

.form-group.error.checkbox-group {
  background: #FEE2E2;
  padding: 0.75rem;
  border-radius: 8px;
  border-left: 3px solid #DC2626;
}

.form-group .error-message {
  color: #DC2626;
  font-size: 0.875rem;
  display: none;
}

.form-group.error .error-message {
  display: block;
}
