/* =========================================================
   Falcon — UI compartida
   - Tipografía SF Pro
   - Custom select integrado (.fx-select wrapper)
   - Botones, inputs, focus rings consistentes
   ========================================================= */

:root {
  --falcon: #083f59;
  --falcon-dark: #062f44;
  --falcon-light: #0e5476;
  --accent: #f6921e;
  --accent-dark: #e07d0a;
  --ink: #1d1d1f;
  --soft: #f5f5f7;
  --line: rgba(0, 0, 0, 0.08);
}

html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
               'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
  color: var(--ink);
}
h1, h2, h3, h4, .display { letter-spacing: -0.025em; }

input, select, textarea, button { font-family: inherit; }
input:focus, select:focus, button:focus, textarea:focus { outline: none; }

.ring-focus:focus,
.fx-input:focus,
.fx-textarea:focus {
  box-shadow: 0 0 0 3px rgba(8, 63, 89, 0.15);
  border-color: rgba(8, 63, 89, 0.55) !important;
}

.nav-blur {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.glass {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

/* =========================================================
   Inputs / Textareas / Native fallback selects
   ========================================================= */

.fx-input,
.fx-textarea,
.fx-select-native {
  width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  color: #1d1d1f;
  transition: border-color .15s, box-shadow .15s;
}
.fx-input::placeholder, .fx-textarea::placeholder { color: #9ca3af; }
.fx-textarea { min-height: 110px; resize: vertical; line-height: 1.45; }

/* Native <select> fallback (en caso de no enriquecerse) */
select.fx-select-native {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%23083f59' stroke-width='1.5' d='M1 1l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
}

/* =========================================================
   Custom Select (.fx-select)
   Marcado:
     <div class="fx-select" data-name="..." data-value="...">
       <button class="fx-select__btn">…</button>
       <div class="fx-select__panel">…</div>
     </div>
   El JS de ui.js construye el panel automáticamente desde
   un <select class="fx-select-source"> oculto.
   ========================================================= */

.fx-select {
  position: relative;
}
.fx-select__btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  color: #1d1d1f;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.fx-select__btn:hover { border-color: #cbd5e1; }
.fx-select.is-open .fx-select__btn,
.fx-select__btn:focus {
  border-color: rgba(8, 63, 89, 0.55);
  box-shadow: 0 0 0 3px rgba(8, 63, 89, 0.12);
}
.fx-select__placeholder { color: #9ca3af; }
.fx-select__chevron {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: #94a3b8;
  transition: transform .2s;
}
.fx-select.is-open .fx-select__chevron { transform: rotate(180deg); color: var(--falcon); }

.fx-select__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  box-shadow:
    0 1px 2px rgba(8, 63, 89, 0.04),
    0 12px 36px -10px rgba(8, 63, 89, 0.18);
  padding: 6px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 60;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
}
.fx-select.is-open .fx-select__panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.fx-select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  color: #1d1d1f;
  cursor: pointer;
  transition: background .12s;
  user-select: none;
}
.fx-select__option:hover,
.fx-select__option.is-active {
  background: rgba(8, 63, 89, 0.06);
}
.fx-select__option.is-selected {
  color: var(--falcon);
  font-weight: 600;
}
.fx-select__option.is-selected::after {
  content: '';
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23083f59' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
}
.fx-select__group {
  padding: 8px 12px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #94a3b8;
}

/* =========================================================
   Autocomplete (input con panel desplegable, reusa estilos
   de .fx-select__panel y .fx-select__option)
   ========================================================= */
.fx-autocomplete { position: relative; }
.fx-autocomplete.is-open > .fx-select__panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.fx-autocomplete .fx-select__option__meta {
  color: #94a3b8;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* =========================================================
   Botones utilitarios
   ========================================================= */
.fx-btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--falcon); color: #fff;
  border-radius: 9999px; padding: 12px 22px;
  font-size: 14px; font-weight: 500;
  transition: background .15s, transform .15s;
}
.fx-btn-primary:hover { background: var(--falcon-dark); }
.fx-btn-accent {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff;
  border-radius: 9999px; padding: 12px 22px;
  font-size: 14px; font-weight: 600;
  transition: background .15s;
}
.fx-btn-accent:hover { background: var(--accent-dark); }
.fx-btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: #f5f5f7; color: var(--falcon);
  border-radius: 9999px; padding: 12px 22px;
  font-size: 14px; font-weight: 500;
  transition: background .15s;
}
.fx-btn-ghost:hover { background: #e5e7eb; }

/* =========================================================
   Toast
   ========================================================= */
.fx-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: #1d1d1f; color: #fff; padding: 12px 20px;
  border-radius: 9999px; font-size: 13.5px;
  box-shadow: 0 12px 30px -6px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 200;
}
.fx-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
