/* =========================================================
   SIMI SEARCH · Command Palette ⌘K  (.pal-*)
   ---------------------------------------------------------
   Estética "Aurora Glass": glassmorphism real (backdrop-filter
   saturado), borde luminoso animado tipo aurora, elevación
   por capas y micro-interacciones con spring easing.
   ========================================================= */

/* ---------- overlay con desenfoque del fondo ---------- */
.pal-overlay {
  position: fixed; inset: 0; z-index: 12000;
  background: rgba(8, 15, 34, .45);
  -webkit-backdrop-filter: blur(6px) saturate(1.1);
  backdrop-filter: blur(6px) saturate(1.1);
  display: flex; align-items: flex-start; justify-content: center;
  padding: min(14vh, 130px) 16px 16px;
  opacity: 0; transition: opacity .18s ease;
}
.pal-overlay.show { opacity: 1; }

/* ---------- caja principal con borde aurora ---------- */
.pal-box {
  width: 100%; max-width: 640px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
  box-shadow:
    0 24px 70px rgba(8, 15, 34, .4),
    0 2px 8px rgba(8, 15, 34, .18),
    inset 0 1px 0 rgba(255, 255, 255, .7);
  overflow: hidden;
  position: relative;
  transform: translateY(-8px) scale(.98);
  transition: transform .22s cubic-bezier(.2, 1.4, .4, 1);
}
.pal-overlay.show .pal-box { transform: none; }

/* borde luminoso animado (aurora) */
.pal-box::before {
  content: ''; position: absolute; inset: 0; border-radius: 20px; padding: 1.5px;
  background: linear-gradient(120deg, #2563eb, #06b6d4, #10b981, #f5b301, #2563eb);
  background-size: 300% 300%;
  animation: palAurora 8s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none; opacity: .8;
}
@keyframes palAurora { to { background-position: 300% 0; } }

/* ---------- fila de input ---------- */
.pal-input-row {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid rgba(10, 42, 94, .08);
}
.pal-glass { color: #2563eb; font-size: 16px; }
#pal-input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font: 600 16.5px/1.3 'Inter', sans-serif; color: #10203c;
  caret-color: #2563eb;
}
#pal-input::placeholder { color: #93a3c0; font-weight: 500; }
.pal-mic {
  border: 0; background: rgba(37, 99, 235, .08); color: #2563eb;
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.pal-mic:hover { transform: scale(1.08); background: rgba(37, 99, 235, .16); }
.pal-mic.is-rec { background: #dc2626; color: #fff; animation: palRec 1s ease infinite; }
@keyframes palRec { 50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, .18); } }
.pal-esc {
  font: 700 10px/1 'Inter', sans-serif; color: #7a8aa8;
  border: 1px solid rgba(10, 42, 94, .16); border-bottom-width: 2px;
  border-radius: 6px; padding: 4px 7px; background: rgba(255,255,255,.6);
}

/* ---------- lista de resultados ---------- */
.pal-list { max-height: min(52vh, 430px); overflow-y: auto; padding: 8px; scrollbar-width: thin; }
.pal-cat {
  font: 800 10px/1 'Inter', sans-serif; letter-spacing: 1.4px; text-transform: uppercase;
  color: #8494b4; padding: 12px 12px 6px;
}
.pal-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  transition: background .1s ease;
}
.pal-row.is-sel {
  background: linear-gradient(90deg, rgba(37, 99, 235, .12), rgba(6, 182, 212, .08));
  box-shadow: inset 2.5px 0 0 #2563eb;
}
.pal-ic {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-size: 14px;
  background: rgba(37, 99, 235, .1); color: #2563eb;
}
.pal-row.is-sel .pal-ic { background: #2563eb; color: #fff; transform: scale(1.05); }
.pal-row-txt { flex: 1; min-width: 0; }
.pal-row-txt strong { display: block; font: 700 13.5px/1.3 'Inter', sans-serif; color: #10203c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-row-txt small { display: block; font: 500 11.5px/1.35 'Inter', sans-serif; color: #7a8aa8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-enter { color: #b9c6de; font-size: 11px; opacity: 0; transform: translateX(-4px); transition: all .12s ease; }
.pal-row.is-sel .pal-enter { opacity: 1; transform: none; color: #2563eb; }
.pal-rec { color: #b9c6de; font-size: 11px; }
.pal-empty { text-align: center; color: #7a8aa8; font: 500 13.5px/1.5 'Inter', sans-serif; padding: 34px 14px; }
.pal-empty i { display: block; font-size: 26px; margin-bottom: 10px; opacity: .5; }

/* ---------- pie ---------- */
.pal-foot {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; border-top: 1px solid rgba(10, 42, 94, .08);
  font: 600 11px/1 'Inter', sans-serif; color: #8494b4;
}
.pal-foot kbd {
  font: 700 9.5px/1 'Inter', sans-serif; border: 1px solid rgba(10, 42, 94, .16);
  border-bottom-width: 2px; border-radius: 5px; padding: 3px 5px; margin-right: 3px;
  background: rgba(255,255,255,.6);
}
.pal-brand { margin-left: auto; color: #2563eb; display: inline-flex; gap: 5px; align-items: center; font-weight: 800; }

/* ---------- FAB flotante ---------- */
.pal-fab {
  position: fixed; right: 18px; top: 18px; z-index: 9500;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid rgba(37, 99, 235, .25); cursor: pointer;
  background: rgba(255, 255, 255, .8);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: #2563eb; font-size: 13px;
  padding: 9px 12px; border-radius: 99px;
  box-shadow: 0 4px 14px rgba(8, 15, 34, .12);
  transition: transform .15s ease, box-shadow .15s ease;
}
.pal-fab:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(37, 99, 235, .25); }
.pal-fab-kbd { font: 800 10.5px/1 'Inter', sans-serif; letter-spacing: .5px; opacity: .75; }
@media (max-width: 720px) {
  .pal-fab { top: auto; bottom: 84px; right: 14px; padding: 12px; }
  .pal-fab-kbd { display: none; }
  .pal-overlay { padding-top: 8vh; }
}

/* ---------- DARK MODE ---------- */
[data-theme="dark"] .pal-overlay { background: rgba(2, 6, 18, .6); }
[data-theme="dark"] .pal-box {
  background: rgba(13, 24, 48, .88);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
}
[data-theme="dark"] #pal-input { color: #e7ecf6; }
[data-theme="dark"] #pal-input::placeholder { color: #5c6f93; }
[data-theme="dark"] .pal-input-row, [data-theme="dark"] .pal-foot { border-color: rgba(255, 255, 255, .08); }
[data-theme="dark"] .pal-esc, [data-theme="dark"] .pal-foot kbd { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: #8fa0be; }
[data-theme="dark"] .pal-row-txt strong { color: #e7ecf6; }
[data-theme="dark"] .pal-row.is-sel { background: linear-gradient(90deg, rgba(37, 99, 235, .22), rgba(6, 182, 212, .12)); }
[data-theme="dark"] .pal-ic { background: rgba(37, 99, 235, .18); color: #7ea2e0; }
[data-theme="dark"] .pal-cat { color: #5c6f93; }
[data-theme="dark"] .pal-fab { background: rgba(13, 24, 48, .85); border-color: rgba(126, 162, 224, .3); color: #7ea2e0; }

/* ---------- accesibilidad: reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .pal-box::before { animation: none; }
  .pal-box, .pal-overlay, .pal-row, .pal-ic, .pal-fab { transition: none; }
  .pal-mic.is-rec { animation: none; }
}
