/* =============================================================================
   fh-core.css v14.0.1  — UI/UX Redesign + Dropdown polish
   --------------------------------------------------------------------------
   v14.0.0 changes:
   • House cards refined, mobile-first responsive, touch-friendly targets.
   • 16px form-input font (no iOS zoom), 44px touch targets on mobile.
   v14.0.1 changes:
   • Universal custom dropdown arrow on every <select> inside the family-house
     plugin (scoped: never affects the WordPress admin or theme selects).
   • Compact arrow variant for in-header filter selects.
   • Disabled-state arrow greyed out.
   ============================================================================= */

:root {
  --gp-fh-r-card: 12px;
  --gp-fh-r-btn: 8px;
  --gp-fh-r-pill: 999px;
}

/* ── Card / Grid ───────────────────────────────────────────────────────── */
.gp-fh-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gp-fh-card-body   { padding: 20px; }
.gp-fh-subtitle    { color: #64748b; font-size: 14px; }

.gp-fh-houses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ── House Cards ───────────────────────────────────────────────────────── */
.gp-fh-house-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--gp-fh-r-card);
  overflow: hidden;
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.gp-fh-house-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -8px rgba(15, 23, 42, .12),
              0 4px 8px -4px rgba(15, 23, 42, .06);
  border-color: #cbd5e1;
}

.gp-fh-house-inner { padding: 20px; position: relative; }

.gp-fh-house-name {
  margin: 0 0 8px;
  font-size: 16.5px; font-weight: 650; color: #0f172a;
  letter-spacing: -.01em;
  padding-right: 70px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
}

.gp-fh-member-count {
  margin: 0 0 12px;
  font-size: 13px; color: #64748b;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.gp-fh-house-desc {
  margin: 0 0 14px;
  font-size: 13px; color: #475569; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.gp-fh-card-buttons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.gp-fh-view-btn {
  background: #f1f5f9; color: #0f172a;
  border: 0; border-radius: var(--gp-fh-r-btn);
  padding: 10px 14px;
  font-size: 13px; font-weight: 550;
  cursor: pointer;
  transition: background .15s, transform .15s;
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px;
}
.gp-fh-view-btn:hover { background: #e2e8f0; }
.gp-fh-view-btn:active { transform: scale(.985); }

/* System house tints */
.gp-fh-mother_house         { border-left: 4px solid #ec4899; }
.gp-fh-grandmother_house    { border-left: 4px solid #8b5cf6; }
.gp-fh-grand_maternal_house { border-left: 4px solid #06b6d4; }

/* Custom house themes */
.gp-fh-custom-default { border-left: 4px solid #64748b; }
.gp-fh-custom-purple  { border-left: 4px solid #8b5cf6; background: linear-gradient(180deg, #faf7ff 0%, #fff 60%); }
.gp-fh-custom-teal    { border-left: 4px solid #14b8a6; background: linear-gradient(180deg, #f0fdfa 0%, #fff 60%); }
.gp-fh-custom-amber   { border-left: 4px solid #f59e0b; background: linear-gradient(180deg, #fffbeb 0%, #fff 60%); }
.gp-fh-custom-rose    { border-left: 4px solid #f43f5e; background: linear-gradient(180deg, #fff1f2 0%, #fff 60%); }

/* ── Card Actions (top-right icons) ────────────────────────────────────── */
.gp-uh-card-actions {
  position: absolute; top: 14px; right: 14px;
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity .15s;
  z-index: 2;
}
.gp-fh-house-card:hover .gp-uh-card-actions,
.gp-fh-house-card:focus-within .gp-uh-card-actions { opacity: 1; }

.gp-uh-icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px; border: 0;
  background: rgba(255, 255, 255, .92);
  color: #475569;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all .15s;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
.gp-uh-icon-btn:hover {
  background: #fff; color: #0f172a;
  box-shadow: 0 4px 12px -2px rgba(15, 23, 42, .15);
  transform: translateY(-1px);
}
.gp-uh-icon-btn:active { transform: translateY(0); }

.gp-uh-pending-badge {
  background: #fef3c7; color: #92400e;
  padding: 3px 9px;
  border-radius: var(--gp-fh-r-pill);
  font-size: 11px; font-weight: 600;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.gp-btn {
  background: #0f172a; color: #fff;
  border: 0; border-radius: var(--gp-fh-r-btn);
  padding: 9px 16px;
  font-size: 13px; font-weight: 550;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, transform .15s;
  min-height: 38px;
  white-space: nowrap;
}
.gp-btn:hover { background: #1e293b; }
.gp-btn:active { transform: scale(.985); }
.gp-btn-secondary { background: #f1f5f9; color: #0f172a; }
.gp-btn-secondary:hover { background: #e2e8f0; }
.gp-btn-sm { padding: 6px 11px; font-size: 12px; min-height: 32px; }
.gp-btn-success { background: #16a34a !important; color: #fff !important; }
.gp-btn-success:hover { background: #15803d !important; }
.gp-btn[disabled], .gp-btn.disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.gp-btn-finalize { background: #7c3aed !important; color: #fff !important; }
.gp-btn-finalize:hover { background: #6d28d9 !important; }
.gp-btn-carry-forward { background: #ea580c !important; color: #fff !important; }
.gp-btn-carry-forward:hover { background: #c2410c !important; }

/* ── Form rows ─────────────────────────────────────────────────────────── */
.gp-uh-form-row { margin-bottom: 14px; }
.gp-uh-form-row label {
  display: block;
  font-size: 11.5px; font-weight: 650; color: #475569;
  margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .05em;
}
.gp-uh-form-row input,
.gp-uh-form-row textarea,
.gp-uh-form-row select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--gp-fh-r-btn);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
  transition: border-color .15s, box-shadow .15s;
}
.gp-uh-form-row input:focus,
.gp-uh-form-row textarea:focus,
.gp-uh-form-row select:focus {
  outline: 0;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}

.gp-fh-form-err {
  padding: 10px 12px; margin-top: 12px;
  background: #fef2f2; border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: var(--gp-fh-r-btn);
  font-size: 13px;
}

/* ═════════════════════════════════════════════════════════════════════════
   v14.0.1 — CUSTOM DROPDOWN ARROW (universal)
   Scoped to `.gp-fh-content` (the page) and `.gp-fh-modal-overlay` (all
   modals) so WordPress admin + theme selects are NOT affected.
   The chevron is an inline SVG data-URI — zero extra HTTP requests.
   ═════════════════════════════════════════════════════════════════════════ */
.gp-fh-content select,
.gp-fh-modal-overlay select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2 4.5l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  padding-right: 36px;
  cursor: pointer;
  text-overflow: ellipsis;
}

/* IE / Edge legacy — kill native arrow */
.gp-fh-content select::-ms-expand,
.gp-fh-modal-overlay select::-ms-expand { display: none; }

/* Hover & focus tints for ANY select inside the plugin */
.gp-fh-content select:hover,
.gp-fh-modal-overlay select:hover { border-color: #94a3b8; }
.gp-fh-content select:focus,
.gp-fh-modal-overlay select:focus {
  outline: 0;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}

/* Disabled — greyed chevron */
.gp-fh-content select:disabled,
.gp-fh-modal-overlay select:disabled {
  cursor: not-allowed;
  opacity: .55;
  background-color: #f8fafc;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2 4.5l4 4 4-4' stroke='%23cbd5e1' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}

/* Compact variant — for inline filter selects in module headers */
.gp-fh-content select.gp-ln-view-sel,
.gp-fh-content select.gp-bgt-view-sel,
.gp-fh-content select.gp-kd-view-sel,
.gp-fh-content select.gp-cm-view-sel,
.gp-fh-modal-overlay select.gp-ln-view-sel,
.gp-fh-modal-overlay select.gp-bgt-view-sel,
.gp-fh-modal-overlay select.gp-kd-view-sel,
.gp-fh-modal-overlay select.gp-cm-view-sel {
  background-position: right 8px center;
  background-size: 10px 10px;
  padding-right: 26px;
}

/* Placeholder option (empty value) renders muted; real values render in ink.
   Style the SELECT itself muted while placeholder is the active selection,
   via the .gp-fh-select-placeholder helper class — see fh-members.js bindings. */
.gp-fh-content select option[value=""],
.gp-fh-modal-overlay select option[value=""] { color: #94a3b8; }
.gp-fh-content select option:not([value=""]),
.gp-fh-modal-overlay select option:not([value=""]) { color: #0f172a; }
.gp-fh-content select.gp-fh-select-placeholder,
.gp-fh-modal-overlay select.gp-fh-select-placeholder { color: #94a3b8; }

/* ── Badges ────────────────────────────────────────────────────────────── */
.gp-fh-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; padding: 2px 9px;
  border-radius: var(--gp-fh-r-pill);
  background: #f1f5f9; color: #475569;
  font-weight: 550;
  white-space: nowrap;
}
.gp-fh-badge-pending  { background: #fef3c7; color: #92400e; }
.gp-fh-badge-contact  { background: #ede9fe; color: #5b21b6; }
.gp-fh-badge-source   { background: #e0f2fe; color: #075985; }
.gp-fh-badge-self,
.gp-fh-badge-mother   { background: #fce7f3; color: #9d174d; }
.gp-fh-badge-father   { background: #dbeafe; color: #1e40af; }
.gp-fh-badge-spouse   { background: #fef3c7; color: #92400e; }
.gp-fh-badge-son,
.gp-fh-badge-daughter,
.gp-fh-badge-child    { background: #d1fae5; color: #065f46; }
.gp-fh-badge-creator  { background: #fce7f3; color: #9d174d; }
.gp-fh-badge-admin    { background: #e0f2fe; color: #075985; }
.gp-fh-badge-system   { background: #ede9fe; color: #5b21b6; }
.gp-fh-badge-registered,
.gp-fh-badge-guest    { background: #d1fae5; color: #065f46; }

/* ── States ────────────────────────────────────────────────────────────── */
.gp-fh-state-msg {
  padding: 36px 20px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}
.gp-fh-state-msg i { font-size: 1.75em; margin-bottom: 12px; display: block; opacity: .5; }
.gp-fh-state-msg p { margin: 0; }
.gp-fh-state-error { color: #dc2626; }
.gp-fh-state-error i { color: #dc2626; opacity: .7; }
.gp-fh-empty {
  padding: 36px 20px;
  text-align: center;
  color: #94a3b8;
  background: #f8fafc;
  border-radius: var(--gp-fh-r-card);
  border: 1px dashed #e2e8f0;
  font-size: 14px;
}
.gp-fh-empty p { margin: 0; }
.gp-fh-link-btn {
  background: none; border: 0;
  color: #4f46e5; font-size: 12px;
  cursor: pointer; text-decoration: underline;
  padding: 2px 6px;
}
.gp-fh-link-btn:hover { color: #3730a3; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .gp-fh-houses-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
}

@media (max-width: 768px) {
  .gp-fh-houses-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .gp-fh-house-inner { padding: 16px; }
  .gp-fh-house-name { font-size: 15.5px; padding-right: 0; margin-bottom: 6px; }
  .gp-fh-member-count { font-size: 12.5px; margin-bottom: 10px; }

  .gp-uh-card-actions {
    opacity: 1;
    position: static;
    margin-bottom: 12px;
    justify-content: flex-end;
  }
  .gp-uh-icon-btn { width: 36px; height: 36px; font-size: 13px; }

  .gp-fh-card-buttons { flex-direction: column; }
  .gp-fh-card-buttons button { width: 100%; justify-content: center; min-height: 44px; }

  /* Inputs: 16px to prevent iOS zoom on focus */
  .gp-uh-form-row input,
  .gp-uh-form-row textarea,
  .gp-uh-form-row select { font-size: 16px; padding: 11px 12px; }

  /* On mobile, the dropdown arrow gets more breathing room (touch) */
  .gp-fh-content select,
  .gp-fh-modal-overlay select {
    padding-right: 40px;
    background-size: 14px 14px;
    background-position: right 14px center;
  }

  .gp-btn { min-height: 44px; padding: 11px 16px; }
  .gp-btn-sm { min-height: 36px; }
}

@media (max-width: 480px) {
  .gp-fh-houses-grid { grid-template-columns: 1fr; gap: 12px; }
  .gp-fh-house-inner { padding: 14px; }
}

/* Reduced-motion accessibility */
@media (prefers-reduced-motion: reduce) {
  .gp-fh-house-card, .gp-fh-view-btn, .gp-btn, .gp-uh-icon-btn,
  .gp-uh-card-actions { transition: none !important; animation: none !important; }
  .gp-fh-house-card:hover { transform: none !important; }
}