/* Modern HubSpot Forms Styling - No legacy browser support */
/* Using CSS Grid, Custom Properties, and modern selectors */

/* ============================================
   HubSpot Form Container
   ============================================ */

.hs-form,
.hbspt-form {
  --form-spacing: 1.5rem;
  --field-height: 3rem;
  --border-width: 2px;
  --focus-color: var(--color-primary, #007bff);
  --error-color: var(--color-danger, #dc3545);
  --success-color: var(--color-success, #28a745);
  
  display: grid;
  gap: var(--form-spacing);
  max-width: 600px;
  margin: 2rem auto;
}

/* Form fields container */
.hs-form-field {
  display: grid;
  gap: 0.5rem;
}

/* Modern field group layout */
.hs-form .hs-fieldtype-radio,
.hs-form .hs-fieldtype-checkbox,
.hs-form .hs-fieldtype-booleancheckbox {
  display: grid;
  gap: 0.75rem;
}

/* ============================================
   Labels - Modern floating effect
   ============================================ */

.hs-form label {
  font-weight: 500;
  color: var(--color-text, #333);
  font-size: 0.875rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Required field indicator */
.hs-form label .hs-form-required {
  color: var(--error-color);
  margin-inline-start: 0.25rem;
}

/* Floating label container */
.field-wrapper {
  position: relative;
}

.field-wrapper label {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  pointer-events: none;
  background: white;
  padding-inline: 0.25rem;
  transition: all 0.2s;
}

.field-wrapper.focused label,
.field-wrapper:has(input:not(:placeholder-shown)) label {
  top: 0;
  font-size: 0.75rem;
  color: var(--focus-color);
}

/* ============================================
   Input Fields - Modern styling
   ============================================ */

.hs-form input[type="text"],
.hs-form input[type="email"],
.hs-form input[type="tel"],
.hs-form input[type="url"],
.hs-form input[type="number"],
.hs-form input[type="date"],
.hs-form input[type="password"],
.hs-form textarea,
.hs-form select {
  width: 100%;
  min-height: var(--field-height);
  padding: 0.75rem 1rem;
  font: inherit;
  border: var(--border-width) solid #e0e0e0;
  border-radius: 0.5rem;
  background: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Remove default appearance */
  appearance: none;
  -webkit-appearance: none;
}

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

/* Select with custom arrow */
.hs-form select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23333' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* Focus states */
.hs-form input:focus,
.hs-form textarea:focus,
.hs-form select:focus {
  outline: none;
  border-color: var(--focus-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Valid state */
.hs-form input:valid:not(:placeholder-shown),
.hs-form textarea:valid:not(:placeholder-shown) {
  border-color: var(--success-color);
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10L9 12L13 8' stroke='%2328a745' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

/* Invalid state */
.hs-form input.error,
.hs-form input:invalid:not(:placeholder-shown):not(:focus),
.hs-form textarea.error,
.hs-form textarea:invalid:not(:placeholder-shown):not(:focus) {
  border-color: var(--error-color);
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 6V10M10 14H10.01' stroke='%23dc3545' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

/* ============================================
   Checkboxes and Radio Buttons - Custom design
   ============================================ */

.hs-form input[type="checkbox"],
.hs-form input[type="radio"] {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: var(--border-width) solid #e0e0e0;
  border-radius: 0.25rem;
  margin-right: 0.5rem;
  flex-shrink: 0;
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.hs-form input[type="radio"] {
  border-radius: 50%;
}

/* Checked state */
.hs-form input[type="checkbox"]:checked {
  background: var(--focus-color);
  border-color: var(--focus-color);
}

.hs-form input[type="checkbox"]:checked::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  background: white;
  clip-path: polygon(20% 45%, 40% 65%, 75% 30%, 85% 40%, 40% 85%, 10% 55%);
}

.hs-form input[type="radio"]:checked {
  border-color: var(--focus-color);
}

.hs-form input[type="radio"]:checked::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  background: var(--focus-color);
  border-radius: 50%;
}

/* Checkbox/Radio label alignment */
.hs-form .hs-form-checkbox-display,
.hs-form .hs-form-radio-display {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.hs-form .hs-form-checkbox-display:hover input,
.hs-form .hs-form-radio-display:hover input {
  border-color: var(--focus-color);
}

/* ============================================
   Submit Button - Modern design
   ============================================ */

.hs-form input[type="submit"],
.hs-form .hs-button,
.hs-form button {
  appearance: none;
  width: 100%;
  min-height: var(--field-height);
  padding: 0.75rem 2rem;
  background: var(--focus-color);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  margin-top: 1rem;
}

/* Hover effect */
.hs-form input[type="submit"]:hover,
.hs-form .hs-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Active/Loading state */
.hs-form input[type="submit"]:active,
.hs-form input[type="submit"].loading {
  transform: scale(0.98);
}

.hs-form input[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Loading animation */
.hs-form input[type="submit"].loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  margin: auto;
  border: 2px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  inset: 0;
}

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

/* ============================================
   Error Messages - Modern styling
   ============================================ */

.hs-form .hs-error-msgs {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.hs-form .hs-error-msg {
  color: var(--error-color);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hs-form .hs-error-msg::before {
  content: "⚠";
  font-size: 1rem;
}

/* ============================================
   Multi-step Forms - Progress indicator
   ============================================ */

.form-progress {
  margin-bottom: 2rem;
}

.progress-bar {
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--focus-color);
  width: var(--progress);
  transition: width 0.3s;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
}

.progress-steps .step {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #e0e0e0;
  display: grid;
  place-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.3s;
}

.progress-steps .step.active {
  background: var(--focus-color);
  color: white;
}

.progress-steps .step.completed {
  background: var(--success-color);
  color: white;
}

/* ============================================
   Rich Text in Forms
   ============================================ */

.hs-form .hs-richtext {
  line-height: 1.6;
  color: var(--color-text-secondary, #666);
}

.hs-form .hs-richtext h3,
.hs-form .hs-richtext h4 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--color-text, #333);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (min-width: 768px) {
  /* Two column layout for related fields */
  .hs-form .hs-form-field-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
  }
  
  /* Side-by-side for short fields */
  .hs-form .hs-fieldtype-number,
  .hs-form .hs-fieldtype-date {
    max-width: 200px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .hs-form input,
  .hs-form textarea,
  .hs-form select {
    background: #2a2a2a;
    border-color: #444;
    color: #f0f0f0;
  }
  
  .field-wrapper label {
    background: #2a2a2a;
  }
  
  .hs-form label {
    color: #f0f0f0;
  }
}