/**
 * HRO Suite – shared public forms & components (mobile-first)
 * CSS variables injected from branding settings.
 */

/* Base form controls */
.hro-form,
.hro-contact-form,
.hro-donate-form form,
.hro-events-list form,
.hro-campaigns-list form,
.hro-find-unit form {
  width: 100%;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.hro-form input[type="text"],
.hro-form input[type="email"],
.hro-form input[type="tel"],
.hro-form input[type="number"],
.hro-form input[type="url"],
.hro-form input[type="password"],
.hro-form input[type="date"],
.hro-form input[type="datetime-local"],
.hro-form select,
.hro-form textarea,
.hro-contact-form input,
.hro-contact-form select,
.hro-contact-form textarea,
.hro-donate-form input,
.hro-donate-form select,
.hro-donate-form textarea,
.hro-events-list input,
.hro-events-list select,
.hro-campaigns-list input,
.hro-campaigns-list textarea,
.hro-find-unit input,
.hro-find-unit select {
  width: 100% !important;
  max-width: 100% !important;
  padding: 12px 14px !important;
  font-size: 16px !important; /* prevents iOS zoom */
  line-height: 1.4 !important;
  border: 1px solid var(--hro-border, #e2e8f0) !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: var(--hro-text, #1a202c) !important;
  box-sizing: border-box !important;
  -webkit-appearance: none;
  appearance: none;
}

.hro-form textarea,
.hro-contact-form textarea {
  min-height: 120px;
  resize: vertical;
}

.hro-form label,
.hro-contact-form label,
.hro-donate-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--hro-text, #1a202c);
}

.hro-form p,
.hro-contact-form p,
.hro-donate-form p {
  margin: 0 0 14px;
}

/* Buttons */
.hro-btn,
.hro-form button[type="submit"],
.hro-contact-form button[type="submit"],
.hro-donate-form button[type="submit"],
.hro-events-list button[type="submit"],
.hro-campaigns-list button[type="submit"],
.hro-find-unit button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  color: #fff !important;
  background: var(--hro-primary, #1a365d) !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer;
  text-decoration: none !important;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.hro-btn:hover,
.hro-form button[type="submit"]:hover,
.hro-contact-form button[type="submit"]:hover {
  opacity: 0.92;
}

.hro-btn:active {
  transform: scale(0.98);
}

.hro-btn--secondary {
  background: var(--hro-accent, #2b6cb0) !important;
}

.hro-btn--outline {
  background: transparent !important;
  color: var(--hro-primary, #1a365d) !important;
  border: 2px solid var(--hro-primary, #1a365d) !important;
}

/* Notices */
.hro-notice {
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.hro-notice-success {
  background: #c6f6d5;
  color: var(--hro-success, #276749);
}

.hro-notice-error {
  background: #fed7d7;
  color: var(--hro-danger, #c53030);
}

.hro-notice-info {
  background: #ebf8ff;
  color: var(--hro-accent, #2b6cb0);
}

/* Cards / lists used on public pages */
.hro-card,
.hro-event-card,
.hro-campaign-card {
  background: var(--hro-card, #fff);
  border: 1px solid var(--hro-border, #e2e8f0);
  border-radius: var(--hro-radius, 12px);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

/* Find unit grid */
.hro-find-unit > div[style*="grid"] {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 12px !important;
}

@media (min-width: 600px) {
  .hro-find-unit > div[style*="grid"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (min-width: 900px) {
  .hro-find-unit > div[style*="grid"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .hro-btn,
  .hro-form button[type="submit"],
  .hro-contact-form button[type="submit"],
  .hro-donate-form button[type="submit"] {
    width: auto;
    min-width: 160px;
  }
}

/* Touch-friendly details/summary */
details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* —— Donation amount: never white-on-white —— */
.hro-donate-form input[type="number"],
.hro-donate-form input#hro_amount,
.hro-donate-form input[name="amount"] {
  color: #1a202c !important;
  background-color: #ffffff !important;
  -webkit-text-fill-color: #1a202c !important;
  caret-color: #1a202c !important;
}

.hro-donate-form .hro-amt-btn,
button.hro-amt-btn {
  color: #1a202c !important;
  background: #f7fafc !important;
  border: 1px solid #cbd5e0 !important;
  border-radius: 6px !important;
  padding: 8px 14px !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  min-height: 40px;
}

.hro-donate-form .hro-amt-btn:hover,
button.hro-amt-btn:hover {
  background: #ebf8ff !important;
  border-color: var(--hro-accent, #2b6cb0) !important;
  color: #1a202c !important;
}

/* —— Unit picker —— */
.hro-unit-picker {
  margin: 0 0 16px;
  width: 100%;
}

.hro-up-label {
  display: block;
  margin-bottom: 8px;
}

.hro-up-search-wrap {
  position: relative;
  margin-bottom: 12px;
}

.hro-up-search {
  width: 100% !important;
  padding: 12px 14px !important;
  font-size: 16px !important;
  border: 1px solid var(--hro-border, #e2e8f0) !important;
  border-radius: 8px !important;
  color: #1a202c !important;
  background: #fff !important;
  -webkit-text-fill-color: #1a202c !important;
}

.hro-up-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--hro-border, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 240px;
  overflow-y: auto;
  margin-top: 4px;
}

.hro-up-result {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid #f7fafc;
  background: #fff;
  color: #1a202c !important;
  cursor: pointer;
  font-size: 0.95rem;
}

.hro-up-result span {
  color: #718096;
  font-size: 0.8rem;
  margin-left: 6px;
}

.hro-up-result:hover {
  background: #edf2f7;
}

.hro-up-empty {
  padding: 12px 14px;
  color: #718096;
  font-size: 0.9rem;
}

.hro-up-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.hro-up-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 4px;
}

.hro-up-field select {
  width: 100% !important;
  padding: 11px 12px !important;
  font-size: 16px !important;
  border: 1px solid var(--hro-border, #e2e8f0) !important;
  border-radius: 8px !important;
  color: #1a202c !important;
  background: #fff !important;
  -webkit-text-fill-color: #1a202c !important;
}

.hro-up-field select:disabled {
  opacity: 0.55;
  background: #f7fafc !important;
}

@media (min-width: 600px) {
  .hro-up-filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .hro-up-filters {
    grid-template-columns: repeat(4, 1fr);
  }
}
