/* Contact Form Styles - Bootstrap 4 Compatible */
/* ============================================= */

/* CSS Variables for consistent theming */
:root {
  --contact-bg: #ffffff;
  --contact-text: #333333;
  --contact-text-muted: #6c757d;
  --contact-border: #e0e0e0;
  --contact-border-focus: #495057;
  --contact-input-bg: #f8f9fa;
  --contact-input-bg-focus: #ffffff;
  --contact-required-star: #e07878;
  --contact-btn-primary-bg: #1a1a1a;
  --contact-btn-primary-text: #ffffff;
  --contact-btn-secondary-bg: transparent;
  --contact-btn-secondary-text: #6c757d;
  --contact-btn-secondary-border: #dee2e6;
  --contact-success: #28a745;
  --contact-error: #dc3545;
  --contact-shadow: rgba(0, 0, 0, 0.05);
  --contact-shadow-focus: rgba(0, 0, 0, 0.1);
}

/* Main wrapper */
.contact-page-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px;
  background-color: var(--contact-bg);
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--contact-shadow);
}

/* Iframe mode - minimal padding, no shadow */
.contact-page-wrapper.iframe-mode {
  max-width: 100%;
  padding: 20px 16px;
  border-radius: 0;
  box-shadow: none;
}

/* When in iframe, apply to body */
body.in-iframe {
  background-color: var(--contact-bg);
  margin: 0;
  padding: 0;
}

body.in-iframe .navbar,
body.in-iframe .web-footer,
body.in-iframe footer,
body.in-iframe header {
  display: none !important;
}

body.in-iframe .contact-page-wrapper {
  max-width: 100%;
  padding: 16px;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

/* Header section */
.contact-header {
  margin-bottom: 32px;
}

.contact-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--contact-text);
  margin-bottom: 8px;
  line-height: 1.2;
}

.contact-subtitle {
  font-size: 1rem;
  color: var(--contact-text-muted);
  margin-bottom: 16px;
}

.contact-divider {
  border: 0;
  border-top: 1px solid var(--contact-border);
  margin: 24px 0;
}

/* Form styling */
.contact-form {
  width: 100%;
}

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

.contact-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--contact-text);
  margin-bottom: 8px;
  line-height: 1.4;
}

/* Required field indicator */
.required-star {
  color: var(--contact-required-star);
  font-weight: 400;
  margin-left: 2px;
}

/* Form controls */
.contact-form .form-control {
  display: block;
  width: 100%;
  padding: 2px 14px;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--contact-text);
  background-color: var(--contact-input-bg);
  background-clip: padding-box;
  border: 1px solid var(--contact-border);
  border-radius: 6px;
  transition:
    border-color 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out,
    background-color 0.2s ease-in-out;
}

.contact-form .form-control:hover {
  border-color: #c0c0c0;
}

.contact-form .form-control:focus {
  color: var(--contact-text);
  background-color: var(--contact-input-bg-focus);
  border-color: var(--contact-border-focus);
  outline: 0;
  box-shadow: 0 0 0 3px var(--contact-shadow-focus);
}

.contact-form .form-control::placeholder {
  color: #adb5bd;
  opacity: 1;
}

/* Textarea specific */
.contact-form textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

/* Select dropdown */
.contact-form select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236c757d' viewBox='0 0 12 12'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M2.5 4.5L6 8l3.5-3.5'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
}

.contact-form select.form-control:focus {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23333333' viewBox='0 0 12 12'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M2.5 4.5L6 8l3.5-3.5'/%3e%3c/svg%3e");
}

/* Custom file upload */
.custom-file-upload {
  position: relative;
}

.custom-file-upload .file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.custom-file-upload .file-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin-bottom: 0;
  font-weight: normal;
}

.custom-file-upload .file-label .btn {
  padding: 6px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid var(--contact-border);
  background-color: var(--contact-bg);
  color: var(--contact-text-muted);
  transition: all 0.2s ease;
}

.custom-file-upload .file-label .btn:hover {
  background-color: var(--contact-input-bg);
  border-color: #c0c0c0;
}

.custom-file-upload .file-name {
  font-size: 0.875rem;
  color: var(--contact-text-muted);
}

.custom-file-upload .file-input:focus + .file-label .btn {
  border-color: var(--contact-border-focus);
  box-shadow: 0 0 0 3px var(--contact-shadow-focus);
}

/* Validation states */
.contact-form .form-control.is-valid {
  border-color: var(--contact-success);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2328a745' viewBox='0 0 16 16'%3e%3cpath d='M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.contact-form .form-control.is-invalid {
  border-color: var(--contact-error);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23dc3545' viewBox='0 0 16 16'%3e%3cpath d='M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z'/%3e%3cpath d='M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.contact-form .form-control.is-valid:focus {
  border-color: var(--contact-success);
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.15);
}

.contact-form .form-control.is-invalid:focus {
  border-color: var(--contact-error);
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

/* Select validation - keep only dropdown arrow, no validation icon inside */
.contact-form select.form-control.is-valid,
.contact-form select.form-control.is-invalid {
  background-position: right 12px center !important;
  background-size: 12px !important;
  padding-right: 36px !important;
  background-repeat: no-repeat !important;
}

.contact-form select.form-control.is-valid {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2328a745' viewBox='0 0 12 12'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M2.5 4.5L6 8l3.5-3.5'/%3e%3c/svg%3e") !important;
}

.contact-form select.form-control.is-invalid {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M2.5 4.5L6 8l3.5-3.5'/%3e%3c/svg%3e") !important;
}

/* Invalid feedback message */
.invalid-feedback {
  display: none;
  width: 100%;
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--contact-error);
}

.form-control.is-invalid ~ .invalid-feedback {
  display: block;
}

/* Form actions / buttons */
.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--contact-border);
}

.contact-form .btn {
  padding: 10px 24px;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.contact-form .btn-discard {
  background-color: var(--contact-btn-secondary-bg);
  color: var(--contact-btn-secondary-text);
  border: 1px solid var(--contact-btn-secondary-border);
}

.contact-form .btn-discard:hover {
  background-color: var(--contact-input-bg);
  border-color: #c0c0c0;
}

.contact-form .btn-discard:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--contact-shadow-focus);
}

.contact-form .btn-submit {
  background-color: var(--contact-btn-primary-bg);
  color: var(--contact-btn-primary-text);
  border: 1px solid var(--contact-btn-primary-bg);
}

.contact-form .btn-submit:hover {
  background-color: #333333;
  border-color: #333333;
}

.contact-form .btn-submit:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.25);
}

.contact-form .btn-submit:active {
  background-color: #000000;
  border-color: #000000;
}

/* Form row adjustments for Bootstrap 4 */
.contact-form .form-row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -8px;
  margin-left: -8px;
}

.contact-form .form-row > .col,
.contact-form .form-row > [class*="col-"] {
  padding-right: 8px;
  padding-left: 8px;
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
  .contact-page-wrapper {
    padding: 24px 16px;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

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

  .contact-form .form-row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .form-actions {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .contact-form .btn {
    width: 100%;
  }
}

/* Print styles */
@media print {
  .contact-page-wrapper {
    box-shadow: none;
    padding: 0;
  }

  .form-actions {
    display: none;
  }
}

/* Accessibility - reduced motion */
@media (prefers-reduced-motion: reduce) {
  .contact-form .form-control,
  .contact-form .btn,
  .custom-file-upload .file-label .btn {
    transition: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .contact-form .form-control {
    border-width: 2px;
  }

  .required-star {
    color: #ff0000;
  }
}