/* ========================================= */
/* CONTACT PAGE CONFIGURATIONS               */
/* ========================================= */
:root {
  /* Section */
  --contact-section-bg: linear-gradient(180deg, #e4e8eb 0%, #eef1f3 100%);

  /* Body Text - Matching Bootstrap secondary */
  --body-text-color: rgba(33, 37, 41, 0.75);
  --body-text-size: clamp(0.95rem, 0.5vw + 0.6rem, 1.1rem);
  --body-line-height: 1.7;

  /* Section Header */
  --section-title-size: clamp(1.6rem, 2vw, 2.25rem);
  --section-subtitle-size: clamp(0.9rem, 0.2vw + 0.8rem, 1rem);
  --section-subtitle-max-width: 480px;

  /* Form Card */
  --form-card-bg: var(--bg-white);
  --form-card-radius: 1rem;
  --form-card-padding: 2rem;
  --form-card-border: #d5dbe0;
  --form-card-shadow: 0 4px 25px rgba(0, 0, 0, 0.1);

  /* Form Controls */
  --form-control-bg: #f5f7f8;
  --form-control-bg-focus: var(--bg-white);
  --form-control-border: #d5dbe0;
  --form-control-border-hover: #bcc4cb;
  --form-control-border-focus: var(--primary);
  --form-control-radius: 10px;
  --form-control-padding: 0.75rem 1rem;
  --form-control-transition: 0.3s ease;

  /* Validation */
  --form-error-color: #dc3545;
  --form-error-bg: #fef8f8;

  /* Submit Button */
  --btn-submit-min-width: 200px;
  --btn-submit-height: 50px;
  --btn-submit-padding: 0 2rem;
  --btn-submit-font-size: 1rem;
  --btn-submit-radius: 50px;
  --btn-submit-shadow: 0 4px 15px rgba(71, 94, 106, 0.2);
  --btn-submit-shadow-hover: 0 8px 25px rgba(71, 94, 106, 0.35);
  --btn-submit-transition: 0.3s ease;
}

/* Desktop only */
@media (min-width: 992px) {
  body[data-page='contact'] {
    margin-top: -6rem;
  }
}

/* ========================================= */
/* ANIMATIONS                                */
/* ========================================= */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

@keyframes slideInStart {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes spinnerRotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes slideInStartRTL {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========================================= */
/* CONTACT SECTION                           */
/* ========================================= */
.contact-section {
  background: var(--contact-section-bg);
  min-height: 100vh;
  padding-top: calc(var(--nav-height) + 2rem);
  padding-bottom: 3rem;

  /* Remove flex centering - just use normal flow */
  display: block;
}

/* ========================================= */
/* SECTION HEADER                            */
/* ========================================= */
.section-header {
  margin-bottom: 1.5rem;
  animation: fadeInUp 0.5s ease-out forwards;
}

.section-title {
  font-size: var(--section-title-size);
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0;
  position: relative;
  display: inline-block;
  padding-bottom: 0.75rem;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  height: 3px;
  width: 70px;
  background-color: var(--primary-light);
  border-radius: 2px;
}

html[dir='rtl'] .section-title::after {
  transform: translateX(50%);
}

.section-subtitle {
  font-size: var(--section-subtitle-size);
  color: var(--body-text-color);
  max-width: var(--section-subtitle-max-width);
  margin: 0.5rem auto 0;
  line-height: 1.6;
}

/* ========================================= */
/* FORM CARD                                 */
/* ========================================= */
.contact-form {
  background-color: var(--form-card-bg);
  padding: var(--form-card-padding);
  border-radius: var(--form-card-radius);
  box-shadow: var(--form-card-shadow);
  border: 1px solid var(--form-card-border);
  animation: fadeInUp 0.5s ease-out 0.1s forwards;
  opacity: 0;
}

/* ========================================= */
/* FORM ROW GAPS                             */
/* ========================================= */
.contact-form .row.g-4 {
  --bs-gutter-y: 1rem;
  --bs-gutter-x: 1rem;
}

/* ========================================= */
/* FORM LABELS                               */
/* ========================================= */
.contact-form .form-label {
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  display: block;
  text-align: start;
}

/* ========================================= */
/* FORM CONTROLS                             */
/* ========================================= */
.contact-form .form-control {
  padding: var(--form-control-padding);
  border: 2px solid var(--form-control-border);
  border-radius: var(--form-control-radius);
  font-size: 0.95rem;
  background-color: var(--form-control-bg);
  text-align: start;
  transition: border-color var(--form-control-transition), box-shadow var(--form-control-transition), background-color var(--form-control-transition);
}

@media (hover: hover) {
  .contact-form .form-control:hover {
    border-color: var(--form-control-border-hover);
  }
}

.contact-form .form-control:focus {
  border-color: var(--form-control-border-focus);
  box-shadow: 0 0 0 4px rgba(71, 94, 106, 0.12);
  background-color: var(--form-control-bg-focus);
  outline: none;
}

/* Force LTR for specific inputs */
.contact-form .form-control[type='tel'],
.contact-form .form-control[type='email'] {
  direction: ltr;
  text-align: left;
}

/* Textarea */
.contact-form textarea.form-control {
  resize: vertical;
  min-height: 120px;
  text-align: start;
}

/* ========================================= */
/* VALIDATION STATES                         */
/* ========================================= */
.contact-form .form-control.is-invalid {
  border-color: var(--form-error-color);
  background-color: var(--form-error-bg);
  animation: shake 0.4s ease-out;
}

.contact-form .form-control.is-invalid:focus {
  box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.12);
}

.contact-form .invalid-feedback {
  display: none;
  font-size: 0.8rem;
  color: var(--form-error-color);
  margin-top: 0.35rem;
  text-align: start;
  padding-inline-start: 0.25rem;
}

.contact-form .form-control.is-invalid ~ .invalid-feedback {
  display: block;
  animation: slideInStart 0.3s ease-out forwards;
}

html[dir='rtl'] .contact-form .form-control.is-invalid ~ .invalid-feedback {
  animation-name: slideInStartRTL;
}

/* ========================================= */
/* SUBMIT BUTTON WRAPPER                     */
/* ========================================= */
.contact-form .col-12.text-center.mt-2 {
  margin-top: 1rem !important;
}

/* ========================================= */
/* SUBMIT BUTTON                             */
/* ========================================= */
.btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--btn-submit-min-width);
  height: var(--btn-submit-height);
  padding: var(--btn-submit-padding);
  font-size: var(--btn-submit-font-size);
  font-weight: 700;

  color: #ffffff !important;
  background-color: var(--primary) !important;
  border: 2px solid var(--primary) !important;

  border-radius: var(--btn-submit-radius);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--btn-submit-shadow);
  transition: transform var(--btn-submit-transition), box-shadow var(--btn-submit-transition), background-color var(--btn-submit-transition), border-color var(--btn-submit-transition);
}

/* Hover State */
@media (hover: hover) {
  .btn-submit:hover {
    color: #ffffff !important;
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    transform: translateY(-2px);
    box-shadow: var(--btn-submit-shadow-hover);
  }

  .btn-submit:hover .btn-content i {
    transform: translateX(5px);
  }

  html[dir='rtl'] .btn-submit:hover .btn-content i {
    transform: translateX(-5px);
  }
}

/* Active State */
.btn-submit:active {
  transform: translateY(0);
  background-color: var(--primary-dark) !important;
}

/* Focus State */
.btn-submit:focus,
.btn-submit:focus-visible {
  color: #ffffff !important;
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  outline: 3px solid rgba(71, 94, 106, 0.4);
  outline-offset: 3px;
}

/* Button Content */
.btn-submit .btn-content {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-submit .btn-content i {
  transition: transform var(--btn-submit-transition);
  color: #ffffff;
}

html[dir='rtl'] .btn-submit .btn-content {
  flex-direction: row-reverse;
}

/* Button Loading State */
.btn-submit .btn-loading {
  display: none;
  align-items: center;
  gap: 0.6rem;
  color: #ffffff;
}

.btn-submit.is-loading {
  pointer-events: none;
  opacity: 0.85;
  background-color: var(--primary) !important;
}

.btn-submit.is-loading .btn-content {
  display: none;
}

.btn-submit.is-loading .btn-loading {
  display: inline-flex;
}

/* Spinner */
.btn-submit .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spinnerRotate 0.7s linear infinite;
}

/* Button Disabled */
.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
}

/* ========================================= */
/* RESPONSIVE - Tablet                       */
/* ========================================= */
@media (max-width: 991.98px) {
  .contact-section {
    min-height: auto;
    padding: calc(var(--mobile-nav-height) + 1.5rem) 0 2.5rem;
  }

  .section-header {
    margin-bottom: 1.5rem;
  }

  .contact-form {
    padding: 1.75rem;
  }
}

/* ========================================= */
/* RESPONSIVE - Mobile                       */
/* ========================================= */
@media (max-width: 767.98px) {
  .contact-section {
    padding: calc(var(--mobile-nav-height) + 1rem) 0 2rem;
  }

  .section-header {
    margin-bottom: 1.25rem;
  }

  .section-title {
    padding-bottom: 0.6rem;
  }

  .section-title::after {
    width: 60px;
  }

  .contact-form {
    padding: 1.5rem;
  }

  .contact-form .form-control {
    padding: 0.7rem 0.9rem;
  }

  .contact-form textarea.form-control {
    min-height: 100px;
  }

  .btn-submit {
    width: 100%;
    min-width: unset;
    height: 48px;
  }
}

/* ========================================= */
/* RESPONSIVE - Small Mobile                 */
/* ========================================= */
@media (max-width: 575.98px) {
  .contact-section {
    padding: calc(var(--mobile-nav-height) + 0.75rem) 0 1.5rem;
  }

  .section-header {
    margin-bottom: 1rem;
  }

  .contact-form {
    padding: 1.25rem;
    border-radius: 12px;
  }

  .contact-form .form-label {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
  }

  .contact-form .form-control {
    font-size: 0.9rem;
    padding: 0.65rem 0.85rem;
  }

  .contact-form .row.g-4 {
    --bs-gutter-y: 0.75rem;
  }

  .contact-form textarea.form-control {
    min-height: 90px;
  }

  .contact-form .col-12.text-center.mt-2 {
    margin-top: 0.75rem !important;
  }
}

/* ========================================= */
/* SWEETALERT CUSTOMIZATION                  */
/* ========================================= */
.swal2-popup {
  font-family: 'Cairo', sans-serif !important;
  border-radius: var(--form-card-radius) !important;
}

.swal2-title {
  font-weight: 700 !important;
  color: var(--primary-dark) !important;
}

.swal2-html-container {
  font-size: 1rem !important;
  line-height: 1.6 !important;
  color: var(--body-text-color) !important;
}

.swal2-confirm {
  font-weight: 600 !important;
  border-radius: var(--btn-submit-radius) !important;
  padding: 0.75rem 2rem !important;
  background-color: var(--primary) !important;
}

.swal2-confirm:hover {
  background-color: var(--primary-dark) !important;
}

html[dir='rtl'] .swal2-popup {
  direction: rtl;
}

/* ========================================= */
/* RTL SUPPORT                               */
/* ========================================= */
html[dir='rtl'] .contact-form .form-control[type='tel'],
html[dir='rtl'] .contact-form .form-control[type='email'] {
  text-align: right;
}
