/* ==========================================
   Forms Styles - Shared across all forms
   ========================================== */

/* Appointment Booking Page */
.appointment-booking-section {
  padding: 4rem 2rem;
  background: linear-gradient(135deg, #f0f9f4 0%, #ffffff 100%);
  min-height: 60vh;
}

.appointment-container {
  max-width: 700px;
  margin: 0 auto;
}

/* Header */
.appointment-header {
  text-align: center;
  margin-bottom: 3rem;
}

.appointment-title {
  font-size: 2.5rem;
  color: #1a3d2b;
  margin-bottom: 1rem;
  font-weight: 700;
}

.appointment-subtitle {
  color: #666;
  font-size: 1.1rem;
  line-height: 1.6;
}

/* Form Card */
.appointment-form-card {
  background: #ffffff;
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

/* Form Elements */
.appointment-form {
  background: transparent;
}

.form-group {
  margin-bottom: 1.5rem;
  background: transparent;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #1a3d2b;
  font-size: 0.95rem;
  background: transparent;
}

.form-error {
  color: #dc3545;
  margin-top: 0.25rem;
  font-size: 0.9rem;
  display: block;
  background: transparent;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
  background: transparent;
}

.form-row .form-group {
  margin-bottom: 0;
}

/* All Input Fields */
.form-control,
.appointment-form .form-control,
.appointment-form input,
.appointment-form select,
.appointment-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s ease;
  background-color: #ffffff;
  background-image: none;
  color: #333333;
  box-shadow: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Phone Number Field with Country Dropdown (SplitPhoneNumberField) */
/* Country code dropdown - ID ends with _phone_0 or _patient_phone_0 */
select#id_phone_0,
select#id_patient_phone_0,
select[id$="_phone_0"] {
  display: inline-block !important;
  width: 200px !important;
  min-width: 200px;
  max-width: 200px;
  margin-right: 0.5rem !important;
  vertical-align: middle;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s ease;
  background-color: #ffffff;
  color: #333333;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Phone number input field - ID ends with _phone_1 or _patient_phone_1 */
input#id_phone_1,
input#id_patient_phone_1,
input[id$="_phone_1"] {
  display: inline-block !important;
  width: calc(100% - 210px) !important;
  min-width: 150px;
  vertical-align: middle;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s ease;
  background-color: #ffffff;
  color: #333333;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Focus states for phone fields */
select#id_phone_0:focus,
select#id_patient_phone_0:focus,
select[id$="_phone_0"]:focus {
  outline: none;
  border-color: #2c7a4b;
  box-shadow: 0 0 0 3px rgba(44, 122, 75, 0.1);
}

input#id_phone_1:focus,
input#id_patient_phone_1:focus,
input[id$="_phone_1"]:focus {
  outline: none;
  border-color: #2c7a4b;
  box-shadow: 0 0 0 3px rgba(44, 122, 75, 0.1);
}

/* Focus States */
.form-control:focus,
.appointment-form .form-control:focus,
.appointment-form input:focus,
.appointment-form select:focus,
.appointment-form textarea:focus {
  outline: none;
  border-color: #2c7a4b;
  box-shadow: 0 0 0 3px rgba(44, 122, 75, 0.1);
  background-color: #ffffff;
  color: #333333;
}

/* Textarea Specific */
textarea,
textarea.form-control {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

/* Select Dropdown */
select,
select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-color: #ffffff;
  padding-right: 2.5rem;
}

/* Select option styling */
select option {
  background-color: #ffffff;
  color: #333333;
  padding: 0.5rem;
}

/* Date and Time inputs */
input[type="date"],
input[type="time"] {
  position: relative;
  background-color: #ffffff;
}

/* Chrome, Safari, Edge date/time picker */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(0.4);
}

/* Submit Button */
.appointment-submit-btn {
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  justify-content: center;
  background: linear-gradient(135deg, #2c7a4b 0%, #55bb88 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(44, 122, 75, 0.3);
}

.appointment-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(44, 122, 75, 0.4);
  background: linear-gradient(135deg, #1e4d35 0%, #2c7a4b 100%);
}

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

/* Appointment Info Section */
.appointment-info-section {
  margin-top: 2rem;
}

.info-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.info-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.info-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.info-title {
  font-size: 1.1rem;
  color: #1a3d2b;
  margin-bottom: 0.5rem;
  font-weight: 600;
  flex-shrink: 0;
}

.info-text {
  color: #666;
  font-size: 0.95rem;
  margin: 0;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  line-height: 1.4;
}

.info-link {
  color: #2c7a4b;
  text-decoration: none;
  font-weight: 600;
  word-break: break-all;
  display: inline-block;
  max-width: 100%;
  transition: color 0.3s ease;
}

.info-link:hover {
  color: #1e4d35;
  text-decoration: underline;
}

/* Notice Box */
.appointment-notice {
  background: #fff4e5;
  border-left: 4px solid #ffd166;
  padding: 1rem 1.5rem;
  border-radius: 6px;
  color: #856404;
  font-size: 0.95rem;
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: break-word;
}

.appointment-notice strong {
  font-weight: 700;
  color: #856404;
}

/* Error States */
.form-control.error,
input.error,
select.error,
textarea.error {
  border-color: #dc3545;
}

.form-control.error:focus,
input.error:focus,
select.error:focus,
textarea.error:focus {
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* Success States */
.form-control.success,
input.success,
select.success,
textarea.success {
  border-color: #28a745;
}

.form-control.success:focus,
input.success:focus,
select.success:focus,
textarea.success:focus {
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Disabled States */
.form-control:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
  opacity: 0.6;
  color: #999;
}

/* Placeholder Styling */
.form-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: #999;
  opacity: 1;
}

/* Autofill Override (Chrome) */
.form-control:-webkit-autofill,
input:-webkit-autofill,
select:-webkit-autofill,
textarea:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px white inset;
  -webkit-text-fill-color: #333;
  background-color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
  .appointment-booking-section {
    padding: 3rem 1rem;
  }

  .appointment-title {
    font-size: 2rem;
  }

  .appointment-subtitle {
    font-size: 1rem;
  }

  .appointment-form-card {
    padding: 2rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .form-row .form-group {
    margin-bottom: 1.5rem;
  }

  /* Phone field responsive - stack on mobile */
  select#id_phone_0,
  select#id_patient_phone_0,
  select[id$="_phone_0"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-right: 0 !important;
    margin-bottom: 0.75rem !important;
  }

  input#id_phone_1,
  input#id_patient_phone_1,
  input[id$="_phone_1"] {
    display: block !important;
    width: 100% !important;
  }

  .info-cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .info-card {
    min-height: auto;
    padding: 1.25rem;
  }

  .info-text {
    font-size: 0.9rem;
  }
}

@media (max-width: 576px) {
  .appointment-booking-section {
    padding: 2rem 1rem;
  }

  .appointment-title {
    font-size: 1.75rem;
  }

  .appointment-form-card {
    padding: 1.5rem;
  }

  .form-control,
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  input[type="time"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .appointment-submit-btn {
    font-size: 1rem;
  }

  .info-card {
    padding: 1rem;
  }

  .info-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
  }

  .info-title {
    font-size: 1rem;
  }

  .info-text {
    font-size: 0.85rem;
  }

  /* Make email address break properly on small screens */
  .info-link {
    font-size: 0.8rem;
    word-break: break-all;
  }
}

/* Print Styles */
@media print {
  .appointment-submit-btn,
  .appointment-info-section {
    display: none !important;
  }

  .appointment-form-card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
  .form-control,
  input,
  select,
  textarea,
  .info-link,
  .appointment-submit-btn,
  .info-card {
    transition: none;
  }
}

/* Focus Visible for Keyboard Navigation */
.form-control:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #2c7a4b;
  outline-offset: 2px;
}

/* Loading State for Submit Button */
.appointment-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #6c757d;
}

.appointment-submit-btn:disabled:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Required Field Indicator */
.form-label::after {
  content: '';
  /* You can add asterisk via HTML instead */
}

/* Invalid Form Feedback Animation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.form-control.error {
  animation: shake 0.5s;
}
