/* Refined Modern Referral Form Styles */
:root {
  --primary: #7d3f98;
  --primary-light: #9a5cb4;
  --primary-dark: #5e2d73;
  --secondary: #4caf50;
  --secondary-light: #80e27e;
  --accent: #ff9800;
  --light: #f8f9fa;
  --dark: #343a40;
  --gray: #6c757d;
  --white: #ffffff;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Form Container */
.referal-section {
  background-color: #fff0f7;
  padding: 4rem 0;
  position: relative;
  overflow: hidden;
}

.referal-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 10% 20%, rgba(125, 63, 152, 0.03) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(125, 63, 152, 0.03) 0%, transparent 20%),
    radial-gradient(circle at 50% 50%, rgba(125, 63, 152, 0.03) 0%, transparent 30%);
  z-index: 0;
}

.referal-section .container { 
  position: relative;
  z-index: 1;
}

/* Floating Elements */
.referal-section::after {
  content: '';
  position: absolute;
  top: 10%;
  right: 5%;
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, rgba(125, 63, 152, 0.05) 0%, rgba(76, 175, 80, 0.05) 100%);
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  animation: float 15s infinite alternate ease-in-out;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -20px) scale(1.1); }
  100% { transform: translate(-20px, 20px) scale(0.9); }
}

/* Form Steps Progress - IMPROVED */
.referal-steps-wrapper {
  margin-bottom: 3rem;
  position: relative;
  padding: 1.5rem;
  background-color: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.referal-progress {
    height: 8px;
    background-color: rgba(125, 63, 152, 0.15);
    border-radius: 8px;
    margin-bottom: -8px;
    position: relative;
    z-index: 9;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#referral-stepper-progress-bar {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 8px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 0;
  box-shadow: 0 0 15px rgba(125, 63, 152, 0.6);
  left: 0;
  top: 0;
}

#referral-stepper-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 30px;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.5) 100%);
  animation: progressGlow 1.5s infinite;
}

@keyframes progressGlow {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

/* Stepper - IMPROVED */
.referal-stepper {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  position: relative;
}

.referal-stepper::before {
  content: '';
  position: absolute;
  top: 30px;
  left: 10%;
  width: 80%;
  height: 3px;
  background: rgba(125, 63, 152, 0.1);
  z-index: 0;
  border-radius: 3px;
}

.referal-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
  text-align: center;
  cursor: default;
  transition: var(--transition);
  z-index: 1;
  padding: 0 10px;
}

.referal-step-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--white);
  color: var(--gray);
  border-radius: 50%;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  position: relative;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 2px solid rgba(125, 63, 152, 0.1);
  z-index: 2;
}

.referal-step-label {
  color: var(--gray);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  margin-top: 0.5rem;
  z-index: 2;
}

/* Active Step - IMPROVED */
.referal-step.active .referal-step-icon {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  transform: scale(1.2);
  box-shadow: 0 8px 20px rgba(125, 63, 152, 0.5);
  border: 3px solid white;
}

.referal-step.active .referal-step-icon::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: rgba(125, 63, 152, 0.15);
  z-index: -1;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  70% { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

.referal-step.active .referal-step-label {
  color: var(--primary);
  font-weight: 700;
  transform: translateY(-5px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Completed Step - IMPROVED */
.referal-step.completed .referal-step-icon {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
  color: white;
  border: 3px solid white;
  box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.referal-step.completed .referal-step-label {
  color: var(--secondary);
  font-weight: 600;
}

/* Form Steps - IMPROVED */
.referal-form-step {
  display: none;
  background-color: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
  animation: fadeIn 0.5s ease;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.referal-form-step::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
}

.referal-form-step.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-15px); }
}

/* Form Elements - IMPROVED */
.referal-form-step h4 {
  color: var(--primary);
  margin-bottom: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.referal-form-step h4 i {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-right: 0.75rem;
  font-size: 1.5rem;
}

.form-label {
  font-weight: 500;
  color: var(--dark);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

/* Floating Labels - FIXED OVERLAPPING */
.form-floating {
  position: relative;
  margin-bottom: 0.5rem;
}

.form-floating > .form-control,
.form-floating > .form-select {
  height: 60px;
  padding: 1.25rem 1rem 0.25rem 3.25rem;
  font-size: 1rem;
  border-radius: var(--radius);
}

.form-floating > label {
  position: absolute;
  top: 0;
  left: 3.25rem;
  height: 100%;
  padding: 1.25rem 0 0.25rem 0;
  pointer-events: none;
  border: none;
  transform-origin: 0 0;
  transition: opacity .1s ease-in-out, transform .1s ease-in-out;
  color: var(--gray);
  font-size: 0.95rem;
  z-index: 2;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
  opacity: .65;
  transform: scale(.85) translateY(-0.75rem);
  color: var(--primary);
  font-weight: 500;
}

/* Input Styles - IMPROVED */
.form-control, .form-select {
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transition: all 0.3s;
  color: var(--dark);
  background-color: #fcfcfc;
  font-weight: 500;
}

.form-control:focus, 
.form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 0.25rem rgba(125, 63, 152, 0.15);
  background-color: white;
}

.form-control:hover, 
.form-select:hover {
  border-color: var(--primary);
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #dc3545;
  background-image: none;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.15);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
  padding-top: 1.5rem !important;
  padding-left: 3.25rem !important;
}

/* Input Icons - FIXED OVERLAPPING */
.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 1.2rem;
  opacity: 0.7;
  transition: all 0.3s;
  z-index: 3;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.textarea-icon {
  top: 30px;
}

.form-control:focus ~ .input-icon,
.form-select:focus ~ .input-icon,
.form-control:not(:placeholder-shown) ~ .input-icon {
  opacity: 1;
  color: var(--primary);
}

.textarea-icon.input-icon {
  top: 30px;
}

.form-control:focus ~ .textarea-icon.input-icon {
  color: var(--primary);
}

/* Tooltip - IMPROVED */
.tooltip-container {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.tooltip-icon {
  color: var(--primary-light);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.tooltip-icon:hover {
  color: var(--primary);
}

.tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: var(--dark);
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 10px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.8rem;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  pointer-events: none;
}

.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--dark) transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Form Progress Indicator - IMPROVED */
.form-progress-indicator {
  margin-top: 2rem;
  padding: 1rem;
  background-color: rgba(255,255,255,0.7);
  border-radius: var(--radius);
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.05);
}

.form-progress-indicator .progress-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

.form-progress-indicator .progress-label::after {
  content: '';
  flex-grow: 1;
  height: 1px;
  background-color: rgba(0,0,0,0.05);
  margin-left: 0.5rem;
}

.form-progress-indicator .progress {
  height: 10px;
  background-color: rgba(125, 63, 152, 0.1);
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.form-progress-indicator .progress-bar {
  background: linear-gradient(90deg, var(--secondary) 0%, var(--secondary-light) 100%);
  border-radius: 5px;
  position: relative;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.form-progress-indicator .progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 20px;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.5) 100%);
  animation: progressGlow 1.5s infinite;
}

/* Step Progress Indicator - IMPROVED */
#referral-step-progress-indicator {
  color: var(--primary);
  font-weight: 600;
  background-color: rgba(125, 63, 152, 0.1);
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  display: inline-block;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  margin: 0 auto;
  display: table;
  margin-bottom: 2rem;
}

/* Support Type Cards - IMPROVED */
.support-type-selector {
  margin-top: 1.5rem;
}

.support-type-card {
  background-color: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  height: 100%;
  transition: all 0.3s ease;
  position: relative;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.support-type-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  border-color: var(--primary-light);
}

.support-type-card.selected {
  border-color: var(--primary);
  box-shadow: 0 10px 25px rgba(125, 63, 152, 0.2);
}

.support-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, rgba(125, 63, 152, 0.1) 0%, rgba(125, 63, 152, 0.2) 100%);
  color: var(--primary);
  font-size: 1.75rem;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.support-type-card:hover .support-icon {
  transform: scale(1.1);
}

.support-type-card.selected .support-icon {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 5px 15px rgba(125, 63, 152, 0.3);
}

.support-type-card h5 {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--dark);
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.support-type-card.selected h5 {
  color: var(--primary);
}

.support-type-card p {
  color: var(--gray);
  font-size: 0.9rem;
  margin-bottom: 0;
}

.selected-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.support-type-card.selected .selected-indicator {
  opacity: 1;
  transform: scale(1);
}

/* Consent Container - IMPROVED */
.consent-container {
  background-color: rgba(125, 63, 152, 0.05);
  border-radius: var(--radius);
  padding: 1.5rem !important;
  border: 1px solid rgba(125, 63, 152, 0.1) !important;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
}

.consent-container:hover {
  background-color: rgba(125, 63, 152, 0.08);
}

.form-check-label {
  cursor: pointer;
  padding-left: 0.5rem;
}

/* Form Switch - IMPROVED */
.form-check-input[type="checkbox"] {
  cursor: pointer;
  height: 1.25rem;
  width: 2.5rem;
}

.form-check-input:checked[type="checkbox"] {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Date Selector - IMPROVED */
.referral-date-picker {
  background-color: rgba(255,255,255,0.7);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  margin-top: 1rem;
}

.date-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.form-check-input[type="radio"] {
  cursor: pointer;
  width: 1.25rem;
  height: 1.25rem;
}

.form-check-input[type="radio"]:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.specific-date-container {
  margin-top: 1rem;
  width: 100%;
}

/* Success Animation - IMPROVED */
.success-animation {
  margin: 0 auto;
  width: 80px;
  height: 80px;
  position: relative;
  margin-bottom: 1.5rem;
}

.checkmark-circle {
  width: 80px;
  height: 80px;
  position: relative;
  display: block;
  border-radius: 50%;
  box-shadow: 0 0 0 rgba(76, 175, 80, 0.4);
  animation: checkmark-circle-fill 0.5s ease-in-out forwards;
  opacity: 0;
  background: linear-gradient(135deg, var(--secondary-light) 0%, var(--secondary) 100%);
}

@keyframes checkmark-circle-fill {
  0% {
    opacity: 0;
    transform: scale(0.1);
    box-shadow: 0 0 0 rgba(76, 175, 80, 0);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.4);
  }
}

.checkmark {
  border-radius: 5px;
}

.checkmark.draw:after {
  content: '';
  position: absolute;
  border: 3px solid #fff;
  border-top: none;
  border-right: none;
  opacity: 1;
  height: 15px;
  width: 30px;
  left: 25px;
  top: 30px;
  transform: rotate(-45deg);
  animation: checkmark-draw 0.5s ease-in-out forwards;
  animation-delay: 0.5s;
  opacity: 0;
}

@keyframes checkmark-draw {
  0% {
    width: 0;
    height: 0;
    opacity: 0;
  }
  100% {
    width: 30px;
    height: 15px;
    opacity: 1;
  }
}

#success-message {
  background-color: white;
  border-radius: var(--radius-lg);
  padding: 3rem !important;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

#success-message i.fas.fa-check-circle {
  font-size: 3rem;
  color: var(--secondary);
  margin-bottom: 1.5rem;
  animation: successPulse 2s infinite;
  display: none; /* Hide this since we have the animated checkmark */
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

#success-message h3 {
  color: var(--secondary);
  font-weight: 700;
  margin-bottom: 1rem;
  font-size: 1.75rem;
}

#success-message p {
  color: var(--gray);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

#success-message .btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.3s ease;
}

#success-message .btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}

#success-message .btn-outline-primary:hover {
  background-color: var(--primary);
  color: white;
}

#success-message .btn-outline-secondary:hover {
  background-color: var(--gray);
  color: white;
}

/* Error Message Styling - IMPROVED */
.form-error {
  color: #dc3545;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
  height: 20px;
}

.form-error:not(:empty)::before {
  content: "\f071";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  margin-right: 0.5rem;
  font-size: 0.8rem;
}

/* Responsive Styles - IMPROVED */
@media (max-width: 768px) {
  .referal-section {
    padding: 2rem 0;
  }
  
  .referal-steps-wrapper {
    padding: 1rem;
  }

  .referal-form-step {
    padding: 1.5rem;
  }

  .referal-step-icon {
    width: 50px;
    height: 50px;
    font-size: 1rem;
  }

  .referal-step-label {
    font-size: 0.8rem;
  }

  .referal-step.active .referal-step-icon {
    transform: scale(1.1);
  }
  
  .input-icon {
    font-size: 1rem;
  }
}

@media (max-width: 576px) {
  .referal-section {
    padding: 1.5rem 0;
  }

  .referal-form-step {
    padding: 1.25rem;
  }

  .referal-step-icon {
    width: 45px;
    height: 45px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }

  .referal-stepper::before {
    top: 22px;
  }

  .referal-step-label {
    font-size: 0.75rem;
  }

  .referal-form-step h4 {
    font-size: 1.2rem;
  }

  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .input-icon {
    left: 0.75rem;
    font-size: 0.9rem;
  }
  
  .form-floating > .form-control,
  .form-floating > .form-select {
    padding-left: 2.5rem;
  }
  
  .form-floating > label {
    left: 2.5rem;
  }
  
  .support-type-card {
    padding: 1.25rem;
  }
  
  .support-icon {
    width: 55px;
    height: 55px;
    font-size: 1.4rem;
  }
  
  .support-type-card h5 {
    font-size: 1rem;
  }
  
  .support-type-card p {
    font-size: 0.8rem;
  }
  
  .referal-steps-wrapper {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .referal-progress {
    margin-bottom: 1.5rem;
  }
} 

.btn-primary 
 {
    --bs-btn-color: #fff;
    --bs-btn-bg: #7d3f98;
    --bs-btn-border-color: #7d3f98;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #7d3f98;
    --bs-btn-hover-border-color: #7d3f98;
    --bs-btn-focus-shadow-rgb: 49, 132, 253;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #7d3f98;
    --bs-btn-active-border-color: #7d3f98;
    --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #7d3f98;
    --bs-btn-disabled-border-color: #7d3f98;
}