/* =====================================================
   Astrofla Forms — Public Frontend Styles
   ===================================================== */

/* ---------- Reset & Base ---------- */
.afl-form-wrap *,
.afl-form-wrap *::before,
.afl-form-wrap *::after {
  box-sizing: border-box;
}

.afl-form-wrap {
  width: 100%;
  max-width: 100%;
  font-family: inherit;
  color: inherit;
}

/* ---------- Form Layout ---------- */
.afl-form {
  width: 100%;
}

.afl-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 0;
}

.afl-form-row + .afl-form-row {
  margin-top: 0;
}

.afl-field-wrap {
  flex: 1 1 100%;
  min-width: 0;
}

/* Column widths */
.afl-col-1-2 { flex: 1 1 calc(50% - 8px); min-width: 200px; }
.afl-col-1-3 { flex: 1 1 calc(33.333% - 11px); min-width: 160px; }

@media (max-width: 600px) {
  .afl-col-1-2,
  .afl-col-1-3 {
    flex: 1 1 100%;
  }
}

/* ---------- Labels ---------- */
.afl-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: inherit;
  line-height: 1.4;
}

.afl-required {
  color: #ef4444;
  margin-left: 3px;
  font-weight: 700;
}

/* ---------- Inputs & Textareas ---------- */
.afl-input,
.afl-textarea,
.afl-select {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9375rem;
  font-family: inherit;
  line-height: 1.5;
  color: inherit;
  background-color: transparent;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.afl-input:focus,
.afl-textarea:focus,
.afl-select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.afl-input::placeholder,
.afl-textarea::placeholder {
  color: #9ca3af;
  opacity: 1;
}

.afl-textarea {
  resize: vertical;
  min-height: 100px;
}

/* Select arrow */
.afl-select-wrap {
  position: relative;
}

.afl-select-wrap::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #6b7280;
  pointer-events: none;
}

.afl-select-wrap .afl-select {
  padding-right: 36px;
  cursor: pointer;
}

/* ---------- Checkboxes & Radios ---------- */
.afl-checkbox-group,
.afl-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.afl-checkbox-label,
.afl-radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.4;
  margin-bottom: 0;
}

.afl-checkbox-label input[type="checkbox"],
.afl-radio-label input[type="radio"],
.afl-single-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

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

.afl-checkbox-label input[type="checkbox"]:checked,
.afl-single-checkbox input[type="checkbox"]:checked {
  background-color: #6366f1;
  border-color: #6366f1;
}

.afl-checkbox-label input[type="checkbox"]:checked::after,
.afl-single-checkbox input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.afl-radio-label input[type="radio"]:checked {
  border-color: #6366f1;
  background-color: #fff;
}

.afl-radio-label input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 8px;
  height: 8px;
  background: #6366f1;
  border-radius: 50%;
}

.afl-single-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.afl-single-checkbox span {
  font-size: 0.9375rem;
  line-height: 1.4;
  padding-top: 1px;
}

/* ---------- Date & Time ---------- */
.afl-input[type="date"],
.afl-input[type="time"] {
  cursor: pointer;
}

/* ---------- File Upload ---------- */
.afl-file-wrap {
  position: relative;
}

.afl-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.afl-file-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px dashed #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  color: #6b7280;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.afl-file-label:hover {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.04);
  color: #6366f1;
}

.afl-file-label svg {
  flex-shrink: 0;
}

.afl-file-name {
  font-size: 0.8125rem;
  color: #6b7280;
  margin-top: 4px;
}

/* ---------- Star Rating ---------- */
.afl-rating {
  display: flex;
  gap: 4px;
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.afl-rating input {
  display: none;
}

.afl-rating label {
  font-size: 2rem;
  color: #d1d5db;
  cursor: pointer;
  transition: color 0.15s ease;
  line-height: 1;
  margin: 0;
  padding: 0;
}

.afl-rating label:hover,
.afl-rating label:hover ~ label,
.afl-rating input:checked ~ label {
  color: #f59e0b;
}

/* ---------- Layout Elements ---------- */
.afl-heading {
  margin: 0;
  line-height: 1.3;
}

.afl-paragraph {
  margin: 0;
  line-height: 1.6;
  font-size: 0.9375rem;
}

.afl-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 4px 0;
}

/* ---------- Booking Section ---------- */
.afl-booking-section {
  background: rgba(99, 102, 241, 0.04);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  padding: 20px;
  margin-top: 8px;
}

.afl-booking-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.afl-booking-title::before {
  content: '📅';
}

.afl-slots-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.afl-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.afl-slot-btn {
  display: block;
  padding: 8px 6px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  color: inherit;
  font-family: inherit;
}

.afl-slot-btn:hover:not(:disabled) {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
}

.afl-slot-btn.selected {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.afl-slot-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

.afl-slots-loading,
.afl-slots-empty,
.afl-slots-error {
  font-size: 0.875rem;
  color: #6b7280;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.afl-slots-error {
  color: #ef4444;
}

/* ---------- Error States ---------- */
.afl-field-wrap.has-error .afl-input,
.afl-field-wrap.has-error .afl-textarea,
.afl-field-wrap.has-error .afl-select {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.afl-field-error {
  display: block;
  margin-top: 5px;
  font-size: 0.8125rem;
  color: #ef4444;
  font-weight: 500;
}

/* ---------- Honeypot ---------- */
.afl-honey {
  position: absolute;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
  tabindex: -1;
}

/* ---------- Submit Button ---------- */
.afl-submit-wrap {
  margin-top: 8px;
}

.afl-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  line-height: 1;
  background-color: #6366f1;
  color: #fff;
}

.afl-submit:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.afl-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.afl-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Spinner inside button */
.afl-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: afl-spin 0.65s linear infinite;
  flex-shrink: 0;
}

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

/* ---------- Notices ---------- */
.afl-notice {
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.afl-notice::before {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1.5;
}

.afl-notice-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.afl-notice-success::before {
  content: '✓';
  font-weight: 700;
}

.afl-notice-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.afl-notice-error::before {
  content: '✕';
  font-weight: 700;
}

/* ---------- Form Messages ---------- */
.afl-form-messages {
  margin-bottom: 16px;
}

/* ---------- Loading Skeleton ---------- */
.afl-loading {
  text-align: center;
  padding: 32px;
  color: #9ca3af;
  font-size: 0.9375rem;
}

/* ---------- Accessibility ---------- */
.afl-input:focus-visible,
.afl-textarea:focus-visible,
.afl-select:focus-visible,
.afl-submit:focus-visible,
.afl-slot-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.afl-checkbox-label input:focus-visible,
.afl-radio-label input:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* ---------- Print ---------- */
@media print {
  .afl-submit-wrap {
    display: none;
  }
}
