/* ============================================================
   DANGOFE OS LIQUID V2 — glass-combobox.css  (Fase 3A.2)
   Estilos del selector desplegable «Liquid Glass» que reemplaza
   los <select> nativos. Usa las variables globales del sistema:
   --accent-rgb, --font-family-ui, --glass-rgb, --text-primary…
   ============================================================ */

.gc-wrapper {
  position: relative;
  width: 100%;
}

/* ---- Disparador (botón visible) ---- */
.gc-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(var(--glass-rgb), 0.28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--text-primary, #fff);
  font-family: var(--font-family-ui, inherit);
  font-size: var(--fs-sm, 0.82rem);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.gc-trigger:hover {
  border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--glass-rgb), 0.38);
}

.gc-wrapper[aria-expanded="true"] .gc-trigger {
  border-color: rgba(var(--accent-rgb), 0.65);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14);
}

.gc-trigger:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.6);
  outline-offset: 2px;
}

.gc-wrapper.is-disabled { opacity: 0.5; pointer-events: none; }

.gc-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gc-value.is-placeholder { opacity: 0.5; }

.gc-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
  opacity: 0.6;
}
.gc-wrapper[aria-expanded="true"] .gc-chevron { transform: rotate(180deg); }

/* ---- Popover (adjunto a body, posición fija por JS) ---- */
.gc-popover {
  position: fixed;
  z-index: 1000;
  border-radius: 12px;
  padding: 6px;
  min-width: 200px;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
  animation: gc-open 0.15s ease;
}
@keyframes gc-open {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.gc-popover--above { animation: gc-open-above 0.15s ease; }
@keyframes gc-open-above {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Buscador ---- */
.gc-search-wrap { padding: 4px 4px 8px; flex-shrink: 0; }
.gc-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(var(--glass-rgb), 0.35);
  color: var(--text-primary, #fff);
  font-family: var(--font-family-ui, inherit);
  font-size: var(--fs-sm, 0.82rem);
  box-sizing: border-box;
}
.gc-search:focus { outline: none; border-color: rgba(var(--accent-rgb), 0.5); }

/* ---- Lista de opciones ---- */
.gc-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 0;
  margin: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-rgb), 0.3) transparent;
}
.gc-list::-webkit-scrollbar { width: 8px; }
.gc-list::-webkit-scrollbar-thumb { background: rgba(var(--accent-rgb), 0.3); border-radius: 8px; }

.gc-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: var(--fs-sm, 0.82rem);
  color: var(--text-primary, #fff);
  transition: background 0.12s, color 0.12s;
  user-select: none;
}
.gc-option--focused { background: rgba(var(--accent-rgb), 0.14); }
.gc-option--selected {
  color: rgb(var(--accent-rgb));
  background: rgba(var(--accent-rgb), 0.10);
}
.gc-option--selected.gc-option--focused { background: rgba(var(--accent-rgb), 0.18); }

.gc-option__check {
  width: 16px;
  flex-shrink: 0;
  opacity: 0;
  font-size: 0.8rem;
  color: rgb(var(--accent-rgb));
}
.gc-option--selected .gc-option__check { opacity: 1; }
.gc-option__label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Estado vacío ---- */
.gc-empty {
  padding: 16px;
  text-align: center;
  font-size: var(--fs-sm, 0.82rem);
  opacity: 0.5;
}

/* ---- Ajustes de tema claro ---- */
[data-theme="light"] .gc-trigger {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text-primary, #111);
}
[data-theme="light"] .gc-trigger:hover { background: rgba(0, 0, 0, 0.06); }
[data-theme="light"] .gc-popover { border-color: rgba(0, 0, 0, 0.12); }
[data-theme="light"] .gc-option { color: var(--text-primary, #111); }
[data-theme="light"] .gc-search {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text-primary, #111);
}

/* ---- Capa oscura del panel inferior (solo móvil) ---- */
.gc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(1px);
  backdrop-filter: blur(1px);
  animation: gc-overlay-in 0.2s ease;
}
@keyframes gc-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---- Móvil: panel inferior (bottom sheet) + objetivos táctiles ---- */
@media (max-width: 600px) {
  .gc-trigger { min-height: 44px; }
  .gc-popover {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 60vh;
    border-radius: 20px 20px 0 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    animation: gc-open-bottom 0.2s ease;
  }
  @keyframes gc-open-bottom {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .gc-option { min-height: 44px; padding: 12px 16px; }
}
