/* RentalFlow Widget - Stack Moves Inspired Design */
/* Clean, modern aesthetic with icons inside inputs */

:root {
  --rentalflow-border-color: #e5e5e5;
  --rentalflow-text-dark: #333333;
  --rentalflow-text-light: #999999;
  --rentalflow-bg-white: #ffffff;
  --rentalflow-bg-light: #f8f9fa;
  --rentalflow-focus-color: #4CAF50;
  --rentalflow-error-color: #d32f2f;
  --rentalflow-radius: 8px;
  --rentalflow-spacing: 24px;
  --rentalflow-btn-color: #4CAF50;
}

.rentalflow-widget-container {
  margin: 32px 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--rentalflow-text-dark);
}

.rentalflow-widget-loading {
  padding: 32px;
  text-align: center;
  color: var(--rentalflow-text-light);
  font-size: 16px;
}

.rentalflow-form {
  background: transparent;
  padding: 0;
}

/* Section Headings */
.rentalflow-section-heading {
  font-size: 20px;
  font-weight: 600;
  color: var(--rentalflow-text-dark);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rentalflow-section-heading .required {
  color: var(--rentalflow-error-color);
  font-size: 18px;
  font-weight: 600;
}

/* Form Grid Layout */
.rentalflow-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

.rentalflow-form-section {
  margin-bottom: 32px;
}

/* Same Address Checkbox */
.rentalflow-same-address-section {
  margin-top: 8px;
  margin-bottom: 32px;
}

.rentalflow-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
  color: var(--rentalflow-text-dark);
  padding: 12px 0;
}

.rentalflow-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--rentalflow-focus-color);
  cursor: pointer;
  flex-shrink: 0;
}

.rentalflow-checkbox-text {
  font-weight: 500;
  line-height: 1.3;
}

.rentalflow-checkbox:focus-visible {
  outline: 2px solid var(--rentalflow-focus-color);
  outline-offset: 2px;
}

/* Desktop: 2-column layout for addresses */
@media (min-width: 768px) {
  .rentalflow-addresses-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--rentalflow-spacing);
    margin-bottom: 40px;
  }

  .rentalflow-dates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--rentalflow-spacing);
  }
}

/* Address Sections */
.rentalflow-address-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Input Container with Icon */
.rentalflow-input-wrapper {
  position: relative;
  width: 100%;
}

.rentalflow-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: #999;
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rentalflow-input-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Input Styles */
.rentalflow-input,
.rentalflow-select,
.rentalflow-textarea {
  width: 100%;
  padding: 14px 14px 14px 48px;
  background: var(--rentalflow-bg-white);
  border: 1px solid var(--rentalflow-border-color);
  border-radius: var(--rentalflow-radius);
  font-size: 16px;
  font-family: inherit;
  color: var(--rentalflow-text-dark);
  transition: all 0.2s ease;
  min-height: 48px;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Input/textarea without icon */
.rentalflow-input.no-icon,
.rentalflow-textarea.no-icon {
  padding-left: 14px;
}

.rentalflow-input::placeholder,
.rentalflow-select::placeholder,
.rentalflow-textarea::placeholder {
  color: var(--rentalflow-text-light);
  opacity: 1;
}

.rentalflow-input:focus,
.rentalflow-select:focus,
.rentalflow-textarea:focus {
  outline: none;
  border-color: var(--rentalflow-focus-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rentalflow-focus-color) 8%, transparent);
}

/* Select Dropdown */
.rentalflow-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='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

/* Textarea */
.rentalflow-textarea {
  resize: vertical;
  min-height: 100px;
  padding-top: 14px;
  line-height: 1.5;
  text-align: left;
  vertical-align: top;
}

.rentalflow-textarea::placeholder {
  text-align: left;
  vertical-align: top;
}

/* Address Row (City, State, ZIP) */
.rentalflow-address-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 480px) {
  .rentalflow-address-row {
    grid-template-columns: 2fr 1fr 1.5fr;
  }
}

/* ZIP Validation Status */
.rentalflow-zip-container {
  position: relative;
}

.rentalflow-zip-status {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: bold;
  pointer-events: none;
  z-index: 1;
}

.rentalflow-zip-valid {
  color: var(--rentalflow-focus-color);
}

.rentalflow-zip-invalid {
  color: var(--rentalflow-error-color);
}

.rentalflow-zip-validating {
  color: var(--rentalflow-text-light);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.rentalflow-zip-error {
  color: #ff9800;
}

/* Date Inputs */
.rentalflow-date-field {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rentalflow-input.rentalflow-input-locked {
  opacity: 0.75;
  cursor: not-allowed;
}

.rentalflow-length-note {
  font-size: 13px;
  color: var(--rentalflow-text-light);
  margin: 8px 0 0;
}

.rentalflow-addon {
  display: grid;
  grid-template-columns: 1fr auto 72px;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rentalflow-border-color);
}

.rentalflow-addon:last-child {
  border-bottom: 0;
}

.rentalflow-addon-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rentalflow-addon-name {
  font-weight: 500;
}

.rentalflow-addon-price {
  font-size: 13px;
  color: var(--rentalflow-text-light);
}

.rentalflow-addon .rentalflow-addon-choice {
  min-width: 0;
  appearance: auto;
  -webkit-appearance: menulist;
}

.rentalflow-addon:not(:has(.rentalflow-addon-choice)) .rentalflow-addon-qty {
  grid-column: 3;
}

@media (max-width: 480px) {
  .rentalflow-addon {
    grid-template-columns: 1fr 72px;
  }
  .rentalflow-addon .rentalflow-addon-qty,
  .rentalflow-addon:not(:has(.rentalflow-addon-choice)) .rentalflow-addon-qty {
    grid-column: 2;
    grid-row: 1;
  }
  .rentalflow-addon .rentalflow-addon-choice {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

.rentalflow-date-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--rentalflow-text-light);
  margin: 0;
}

input[type="date"].rentalflow-input {
  position: relative;
}

/* Contact Section */
.rentalflow-contact-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Form Actions */
.rentalflow-form-actions {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--rentalflow-border-color);
  display: flex;
  justify-content: center;
}

.rentalflow-submit-btn {
  background: var(--rentalflow-btn-color) !important;
  color: white !important;
  border: none;
  padding: 16px 48px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--rentalflow-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 52px;
  width: 100%;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--rentalflow-btn-color) 20%, transparent);
  letter-spacing: 0.02em;
}

.rentalflow-submit-btn:hover:not(:disabled) {
  filter: brightness(0.9);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--rentalflow-btn-color) 30%, transparent);
}

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

.rentalflow-submit-btn:disabled {
  background: #ccc !important;
  color: #666 !important;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Error Container */
.rentalflow-error-container {
  margin-top: 20px;
  padding: 16px 20px;
  background: #ffebee;
  border: 1px solid #ef5350;
  border-radius: var(--rentalflow-radius);
  color: var(--rentalflow-error-color);
  font-size: 15px;
  text-align: center;
  font-weight: 500;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Responsive */
@media (max-width: 767px) {
  .rentalflow-widget-container {
    margin: 24px 0;
  }

  .rentalflow-section-heading {
    font-size: 18px;
    margin-top: 48px;
    margin-bottom: 12px;
  }

  /* First section heading shouldn't have extra top margin */
  .rentalflow-addresses-grid .rentalflow-section-heading:first-of-type,
  .rentalflow-form-section:first-child .rentalflow-section-heading {
    margin-top: 0;
  }

  /* Ensure proper spacing between address sections on mobile */
  .rentalflow-address-section:last-child .rentalflow-section-heading {
    margin-top: 48px;
  }

  .rentalflow-form-grid {
    gap: 28px;
  }

  .rentalflow-address-section {
    gap: 14px;
  }

  .rentalflow-submit-btn {
    width: 100%;
    min-width: unset;
  }

  .rentalflow-input,
  .rentalflow-select,
  .rentalflow-textarea {
    font-size: 16px; /* Prevent iOS zoom */
  }
}

/* Accessibility - High Contrast Mode */
@media (prefers-contrast: high) {
  .rentalflow-input,
  .rentalflow-select,
  .rentalflow-textarea {
    border-width: 2px;
  }

  .rentalflow-submit-btn {
    border: 2px solid transparent;
  }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .rentalflow-input,
  .rentalflow-select,
  .rentalflow-textarea,
  .rentalflow-submit-btn,
  .rentalflow-error-container {
    transition: none;
    animation: none;
  }
}

/* Print Styles */
@media print {
  .rentalflow-widget-container {
    display: none;
  }
}

/* Focus Visible for Keyboard Navigation */
.rentalflow-input:focus-visible,
.rentalflow-select:focus-visible,
.rentalflow-textarea:focus-visible,
.rentalflow-submit-btn:focus-visible {
  outline: 2px solid var(--rentalflow-focus-color);
  outline-offset: 2px;
}
