/* Universal Form Component Styles */

/* Validation Error Styles */
.form-control.error {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.form-control.error:focus {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.form-error {
  display: none;
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  font-weight: 500;
}

.form-error.show {
  display: block !important;
}

/* Success state for valid fields */
.form-control.valid {
  border-color: #28a745 !important;
  box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Loading state */
.form-control.loading {
  border-color: #007bff !important;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}
/* Consolidated all form-related CSS from style.css */

/* ===========================================
   CONTACT FORM CARD STYLING
   =========================================== */

.contact-form-card {
  background: #f8f9fa;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  padding: 12px;
  margin: 0 auto;
  max-width: 360px;
  height: fit-content;
}

.contact-form-card h2,
.contact-form-card h3 {
  color: #2c3e50 !important;
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 8px;
  text-align: center;
  font-family: "Raleway", sans-serif;
  display: block;
}

.form-divider {
  width: 40px;
  height: 2px;
  background: #e03a3c;
  margin: 0 auto 10px;
  border-radius: 2px;
}

/* ===========================================
   FOOTER CONTACT FORM STYLING
   =========================================== */

.footer-contact-form {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  height: fit-content;
}

.footer-form-title {
  color: #2c3e50;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
  font-family: "Raleway", sans-serif;
}

/* ===========================================
   FORM ELEMENTS STYLING
   =========================================== */

/* Form Labels - Hidden to maintain original design */
.form-label {
  display: none; /* Hide labels to maintain original placeholder-only design */
}

/* Form Groups */
.form-group {
  margin-bottom: 8px;
  position: relative;
}

.footer-contact-form .form-group {
  margin-bottom: 8px;
}

/* Form Controls */
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  font-family: "Open Sans", sans-serif;
  background: #fff;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.footer-contact-form .form-control {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  width: 100%;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.footer-contact-form .form-control:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.form-control::placeholder {
  color: #999;
  font-size: 14px;
}

.footer-contact-form .form-control::placeholder {
  color: #999;
  font-size: 14px;
}

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

.footer-contact-form textarea.form-control {
  min-height: 60px;
  resize: vertical;
}

/* ===========================================
   CAPTCHA STYLING
   =========================================== */

.captcha-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-contact-form .captcha-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.captcha-question {
  font-size: 14px;
  color: #2c3e50;
  font-weight: 500;
  white-space: nowrap;
}

.footer-contact-form .captcha-question {
  font-size: 14px;
  color: #666;
  white-space: nowrap;
}

.captcha-input {
  width: 80px !important;
  text-align: center;
}

.footer-contact-form .captcha-input {
  width: 60px;
}

/* ===========================================
   RECAPTCHA STYLING
   =========================================== */

/* reCAPTCHA responsive styling */
.g-recaptcha {
  display: flex;
  justify-content: center;
  margin: 8px 0;
  overflow: hidden;
  max-width: 100%;
}

/* Scale down reCAPTCHA on mobile devices */
@media (max-width: 768px) {
  .g-recaptcha {
    transform: scale(0.85);
    transform-origin: center;
    margin: 6px 0;
  }
}

@media (max-width: 576px) {
  .g-recaptcha {
    transform: scale(0.88);
    transform-origin: center;
    margin: 12px auto;
    display: flex;
    justify-content: center;
  }
  
  /* Stack layout for mobile */
  .captcha-wrapper,
  .homepage-captcha-submit-wrapper {
    display: block !important;
    width: 100%;
    text-align: center;
  }
  
  .homepage-captcha-submit-wrapper .submit-btn {
    width: 100% !important;
    margin-top: 15px;
  }
}

@media (max-width: 480px) {
  .g-recaptcha {
    transform: scale(0.75);
    transform-origin: center;
    margin: 10px auto;
    width: 100%;
    display: flex;
    justify-content: center;
    max-width: 304px; /* Standard reCAPTCHA width */
  }
  
  .captcha-wrapper,
  .homepage-captcha-submit-wrapper {
    width: 100%;
    overflow: visible !important;
    display: block !important;
    text-align: center;
  }
  
  /* Stack button below captcha on mobile */
  .homepage-captcha-submit-wrapper {
    flex-direction: column !important;
    align-items: center !important;
  }
  
  .homepage-captcha-submit-wrapper .submit-btn {
    width: 100% !important;
    margin-top: 15px;
    display: block;
  }
  
  /* Ensure reCAPTCHA iframe doesn't get clipped */
  .g-recaptcha > div {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
  }
  
  /* Ensure form containers don't clip reCAPTCHA */
  .contact-form-card,
  .footer-contact-form {
    overflow: visible !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

/* Ensure reCAPTCHA doesn't overflow on very small screens */
@media (max-width: 360px) {
  .g-recaptcha {
    transform: scale(0.68);
    transform-origin: center;
    margin: 8px auto;
    width: 100%;
    display: flex;
    justify-content: center;
    max-width: 304px;
  }
  
  .captcha-wrapper,
  .homepage-captcha-submit-wrapper {
    width: 100%;
    overflow: visible !important;
  }
  
  .contact-form-card,
  .footer-contact-form {
    overflow: visible !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
}

/* Form group containing reCAPTCHA */
.form-group:has(.g-recaptcha) {
  overflow: visible !important;
  max-width: 100%;
  padding: 0 !important;
}

/* Fallback for browsers that don't support :has() */
.form-group .g-recaptcha {
  overflow: visible !important;
  max-width: 100%;
}

/* Mobile specific reCAPTCHA container */
@media (max-width: 768px) {
  .form-group:has(.g-recaptcha) {
    margin-left: auto !important;
    margin-right: auto !important;
    display: flex;
    justify-content: center;
  }
}

/* Additional reCAPTCHA iframe styling */
.g-recaptcha iframe {
  max-width: 100% !important;
  height: auto !important;
}

/* Ensure reCAPTCHA container doesn't break layout */
@media (max-width: 768px) {
  .contact-form-card .form-group:has(.g-recaptcha) {
    padding: 0 5px;
    overflow: visible !important;
  }
  
  .contact-form-card .g-recaptcha {
    margin: 10px auto;
    overflow: visible !important;
  }
  
  /* Ensure all form containers have visible overflow on mobile */
  .contact-form-card,
  .footer-contact-form,
  .contact-form,
  .sidebar,
  .col-lg-4 {
    overflow: visible !important;
  }
  
  /* Ensure proper centering and visibility */
  .form-group {
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .form-group input,
  .form-group textarea {
    width: 100%;
  }
  
  /* Prevent parent containers from clipping reCAPTCHA */
  form:has(.g-recaptcha),
  .form-group:has(.g-recaptcha) {
    overflow: visible !important;
  }
}

/* ===========================================
   SUBMIT BUTTON STYLING
   =========================================== */

.submit-btn {
  width: 100%;
  background: #0867c8a6;
  color: #fff;
  padding: 10px 25px;
  border: none;
  border-radius: 17px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Raleway", sans-serif;
}

.footer-contact-form .submit-btn {
  background: #0867c8a6;
  color: white;
  border: none;
  padding: 10px 30px;
  border-radius: 17px !important;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.submit-btn:hover:not(:disabled) {
  background: #0578ece3;
  color: #fff;
  text-decoration: none;
  transform: translateY(-2px);
}

.footer-contact-form .submit-btn:hover {
  background: #0578ece3;
  color: #fff;
  text-decoration: none;
  transform: translateY(-2px);
}

.submit-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(224, 58, 60, 0.1);
}

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

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

/* Apply same contact-form submit styles to homepage form */
.contact .contact-form button[type=submit],
#homepage-contact-form button[type=submit],
#homepage-contact-form .submit-btn {
  background: #0867c8a6;
  border: 0;
  padding: 10px 32px;
  color: #fff;
  transition: 0.4s;
  border-radius: 4px;
}

/* ===========================================
   FORM MESSAGES & STATES
   =========================================== */

.form-message {
  margin-top: 20px;
}

.form-message .loading,
.form-message .error-message,
.form-message .sent-message {
  display: none;
  padding: 10px 15px;
  border-radius: 5px;
  text-align: center;
  font-weight: 600;
}

.form-message .loading {
  background: #e3f2fd;
  color: #1976d2;
}

.form-message .error-message {
  background: #ffebee;
  color: #c62828;
}

.form-message .sent-message {
  color: #fff;
  background: #18d26e;
}

.form-message .loading.d-block,
.form-message .error-message.d-block,
.form-message .sent-message.d-block {
  display: block !important;
}

/* Error States - Disabled for backend validation */
.form-control.error,
.form-control[aria-invalid="true"] {
  border-color: #ced4da;
}

.form-control.error:focus,
.form-control[aria-invalid="true"]:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Error Messages */
.form-error {
  display: none;
  width: 100%;
  margin-top: 4px;
  font-size: 12px;
  color: #e03a3c;
  min-height: 16px;
  font-family: "Open Sans", sans-serif;
}

.form-error[style*="display: block"] {
  display: block !important;
}

.form-error[aria-live="assertive"] {
  display: none;
  font-weight: 500;
}

/* Help Text - Hidden to maintain original design */
.form-help {
  display: none;
}

/* Loading Animation */
.loading {
  display: none;
  padding: 10px;
  background-color: #d1ecf1;
  border: 1px solid #bee5eb;
  border-radius: 5px;
  color: #0c5460;
  text-align: center;
  font-weight: 500;
  font-size: 14px;
}

.loading:before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid #0c5460;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

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

.error-message {
  display: none;
  padding: 10px;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 5px;
  color: #721c24;
  font-weight: 500;
  font-size: 14px;
}

/* ===========================================
   SEARCH FORMS
   =========================================== */

.search-form {
  display: flex;
  gap: 10px;
}

.search-form .form-control {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
}

.search-btn {
  background: #e03a3c;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-btn:hover {
  background: #c23321;
}

/* ===========================================
   NEWSLETTER FORMS
   =========================================== */

#footer .footer-newsletter form {
  margin-top: 30px;
  background: #fff;
  padding: 5px 10px;
  position: relative;
  border-radius: 4px;
  text-align: left;
}

#footer .footer-newsletter form input[type=email] {
  border: 0;
  padding: 4px 8px;
  width: calc(100% - 100px);
}

#footer .footer-newsletter form input[type=submit] {
  position: absolute;
  top: 0;
  right: -1px;
  bottom: 0;
  border: 0;
  background: none;
  font-size: 16px;
  padding: 0 20px;
  background: #e03a3c;
  color: #fff;
  transition: 0.3s;
  border-radius: 0 4px 4px 0;
  box-shadow: 0px 2px 15px rgba(0, 0, 0, 0.1);
}

#footer .footer-newsletter form input[type=submit]:hover {
  background: #e35052;
}

/* ===========================================
   CONTACT SECTION FORMS
   =========================================== */

.contact-section {
  background: #f8f9fa;
}

.contact .contact-form {
  box-shadow: 0 0 30px rgba(214, 215, 216, 0.6);
  padding: 30px;
  border-radius: 5px;
}

.contact .contact-form .error-message {
  display: none;
  color: #fff;
  background: #ed3c0d;
  text-align: left;
  padding: 15px;
  font-weight: 600;
}

.contact .contact-form .error-message br+br {
  margin-top: 25px;
}

.contact .contact-form .sent-message {
  display: none;
  color: #fff;
  background: #18d26e;
  text-align: center;
  padding: 15px;
  font-weight: 600;
}

.contact .contact-form .loading {
  display: none;
  background: #fff;
  text-align: center;
  padding: 15px;
}

.contact .contact-form .loading:before {
  content: "";
  display: inline-block;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  margin: 0 10px -6px 0;
  border: 3px solid #18d26e;
  border-top-color: #eee;
  animation: animate-loading 1s linear infinite;
}

.contact .contact-form .form-group {
  margin-bottom: 25px;
}

.contact .contact-form input,
.contact .contact-form textarea,
#homepage-contact-form input,
#homepage-contact-form textarea {
  box-shadow: none;
  font-size: 14px;
  border-radius: 20px;
}

.contact .contact-form input:focus,
.contact .contact-form textarea:focus {
  border-color: transparent;
}

.contact .contact-form input {
  padding: 10px 15px;
}

.contact .contact-form textarea {
  padding: 12px 15px;
}

.contact .contact-form button[type=submit],
#homepage-contact-form button[type=submit] {
  background: #0867c8a6;
  border: 0;
  padding: 10px 32px; 
  color: #fff;
  transition: 0.4s;
  border-radius: 17px !important;
}

.contact .contact-form button[type=submit]:hover,
.contact .footer-contact-form button[type=submit]:hover,
#homepage-contact-form button[type=submit]:hover{
  background: #0578ece3;
}

@keyframes animate-loading {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ===========================================
   BLOG REPLY FORMS
   =========================================== */

.blog .blog-comments .reply-form {
  margin-top: 30px;
  padding: 30px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.blog .blog-comments .reply-form h4 {
  font-weight: bold;
  font-size: 22px;
}

.blog .blog-comments .reply-form p {
  font-size: 14px;
}

.blog .blog-comments .reply-form input {
  border-radius: 4px;
  padding: 10px 10px;
  font-size: 14px;
}

.blog .blog-comments .reply-form input:focus {
  box-shadow: none;
  border-color: transparent;
}

.blog .blog-comments .reply-form textarea {
  border-radius: 4px;
  padding: 10px 10px;
  font-size: 14px;
}

.blog .blog-comments .reply-form textarea:focus {
  box-shadow: none;
  border-color: transparent;
}

.blog .blog-comments .reply-form .form-group {
  margin-bottom: 25px;
}

.blog .blog-comments .reply-form .btn-primary {
  border-radius: 4px;
  padding: 10px 20px;
  border: 0;
  background-color: #111111;
}

.blog .blog-comments .reply-form .btn-primary:hover {
  background-color: #1e1e1e;
}

/* ===========================================
   ACCESSIBILITY & UTILITIES
   =========================================== */

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===========================================
   RESPONSIVE DESIGN
   =========================================== */

/* Responsive adjustments for contact form cards */
@media (max-width: 992px) {
  .contact-form-card {
    padding: 12px 15px;
    max-width: 320px;
  }
}

@media (max-width: 768px) {
  .contact-form-card {
    padding: 10px 12px;
    max-width: 332px;
  }
  
  .contact-form-card h3 {
    font-size: 18px;
  }
  
  .captcha-group {
    gap: 8px;
  }
  
  .captcha-input {
    width: 70px !important;
  }
}

@media (max-width: 576px) {
  .contact-form-card {
    padding: 12px 15px;
    max-width: 280px;
  }
  
  .contact-form-card h3 {
    font-size: 20px;
  }
  
  .form-divider {
    width: 30px;
    margin-bottom: 12px;
  }
  
  .form-group {
    margin-bottom: 12px;
  }
  
  .form-control {
    padding: 8px 10px;
    font-size: 13px;
  }
  
  textarea.form-control {
    min-height: 70px;
  }
  
  .captcha-group {
    gap: 4px;
  }
  
  .captcha-question {
    font-size: 13px;
  }
  
  .captcha-input {
    width: 60px !important;
  }
  
  .submit-btn {
    padding: 10px 20px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .contact-form-card {
    padding: 10px 12px;
    max-width: 364px;
  }
  
  .contact-form-card h3 {
    font-size: 18px;
  }
  
  .form-divider {
    width: 25px;
    margin-bottom: 10px;
  }
  
  .form-group {
    margin-bottom: 10px;
  }
  
  .form-control {
    padding: 6px 8px;
    font-size: 12px;
  }
  
  textarea.form-control {
    min-height: 60px;
  }
  
  .captcha-group {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  
  .captcha-question {
    text-align: center;
    font-size: 12px;
  }
  
  .captcha-input {
    width: 100% !important;
  }
  
  .submit-btn {
    padding: 8px 15px;
    font-size: 12px;
  }
}

/* Footer contact form responsive */
@media (max-width: 768px) {
  .footer-contact-form {
    padding: 25px 20px;
  }
}

/* Search form responsive */
@media (max-width: 768px) {
  .search-form {
    flex-direction: column;
    gap: 8px;
  }
  
  .search-form .form-control {
    width: 100%;
  }
}

/* Newsletter form responsive */
@media (max-width: 768px) {
  #footer .footer-newsletter form {
    padding: 3px 8px;
  }
  
  #footer .footer-newsletter form input[type=email] {
    width: calc(100% - 80px);
    padding: 3px 6px;
  }
  
  #footer .footer-newsletter form input[type=submit] {
    padding: 0 15px;
    font-size: 14px;
  }
}

/* Contact section form responsive */
@media (max-width: 768px) {
  .contact .contact-form {
    padding: 20px;
  }
  
  .contact .contact-form .form-group {
    margin-bottom: 20px;
  }
  
  .contact .contact-form input,
  .contact .contact-form textarea {
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* Blog reply form responsive */
@media (max-width: 768px) {
  .blog .blog-comments .reply-form {
    padding: 20px;
  }
  
  .blog .blog-comments .reply-form .form-group {
    margin-bottom: 20px;
  }
  
  .blog .blog-comments .reply-form input,
  .blog .blog-comments .reply-form textarea {
    padding: 8px 10px;
    font-size: 13px;
  }
}

