/* ============================================================================
   NormaViva Pro · Mi Expediente · Fallos TTA browser
   Scoped under .mef-page; all colors/easings from /pro-site/_shared.css tokens.
   v=1 · 2026-04-26 · Wave 1B
   ============================================================================ */

.mef-hidden { display: none !important; }

.mef-page {
  background: var(--pro-bg);
  color: var(--pro-ink);
  min-height: 100vh;
}

/* ── Teaser (no-Pro state) ───────────────────────────────────────────── */
.mef-teaser {
  max-width: 580px;
  margin: 80px auto;
  padding: 40px 24px;
  text-align: center;
}
.mef-teaser-icon {
  color: var(--pro-navy-700);
  display: inline-flex;
  padding: 16px;
  background: var(--pro-navy-100);
  border-radius: 50%;
  margin-bottom: 18px;
}
.mef-teaser h1 {
  font-family: var(--pro-font-display);
  font-size: 32px;
  margin: 0 0 12px;
  color: #fff;
}
.mef-teaser p {
  color: var(--pro-body);
  margin: 0 0 24px;
  font-size: 15.5px;
  line-height: 1.55;
}
.mef-teaser-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.mef-teaser-err {
  margin-top: 20px;
  font-size: 13px;
  color: var(--pro-mute);
}
.mef-link-btn {
  background: none;
  border: 0;
  color: var(--pro-navy-700);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

/* ── Wrap ────────────────────────────────────────────────────────────── */
.mef-wrap {
  max-width: var(--pro-container-w);
  margin: 0 auto;
  padding: 0 24px 80px;
}
@media (max-width: 700px) {
  .mef-wrap { padding: 0 16px 60px; }
}

/* ── Hero ────────────────────────────────────────────────────────────── */
.mef-hero {
  padding: 28px 0 22px;
  border-bottom: 1px solid var(--pro-line);
  margin-bottom: 18px;
}
.mef-hero-inner {
  max-width: 920px;
}
.mef-back {
  display: inline-block;
  font-size: 13px;
  color: var(--pro-mute);
  text-decoration: none;
  margin-bottom: 8px;
  transition: color var(--pro-dur-fast) ease;
}
.mef-back:hover { color: var(--pro-navy-700); }
.mef-eyebrow {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--pro-navy-700);
  margin-bottom: 6px;
}
.mef-title {
  font-family: var(--pro-font-display);
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 6px;
  color: #fff;
  letter-spacing: -.02em;
}
.mef-sub {
  margin: 0;
  color: var(--pro-mute);
  font-size: 15px;
}
.mef-sub .pro-counter {
  color: #fff;
  font-weight: 700;
}

/* ── Sticky filter bar (glass) ───────────────────────────────────────── */
.mef-filterbar {
  position: -webkit-sticky;
  position: sticky;
  top: var(--pro-nav-h); /* flush — Option A: padding moved to inner */
  z-index: 30;
  border-radius: var(--pro-r-md);
  padding: 0;
  margin-bottom: 18px;
  /* .pro-glass already provides bg/blur/shadow */
}
.mef-filterbar-inner {
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.mef-search {
  position: relative;
  flex: 1 1 280px;
  min-width: 240px;
}
.mef-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pro-mute);
  pointer-events: none;
}
.mef-input,
.mef-select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--pro-line);
  border-radius: var(--pro-r-sm);
  background: var(--pro-surface);
  color: var(--pro-ink);
  font: inherit;
  font-size: 14px;
  padding: 0 14px;
  transition: border-color var(--pro-dur-fast) ease, box-shadow var(--pro-dur-fast) ease;
}
.mef-input { padding-left: 38px; }
.mef-input:focus,
.mef-select:focus {
  outline: none;
  border-color: var(--pro-navy-500);
  box-shadow: var(--pro-shadow-focus);
}
.mef-select {
  flex: 0 1 auto;
  min-width: 170px;
  max-width: 240px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='%2364748b'><path fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 111.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
@media (max-width: 700px) {
  .mef-select { min-width: 0; max-width: none; flex: 1 1 calc(50% - 6px); }
}

/* Active filter chips */
.mef-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  min-height: 0;
}
.mef-chips:empty { display: none; }
.mef-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pro-navy-100);
  color: var(--pro-navy-700);
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 500;
  padding: 4px 8px 4px 10px;
  border-radius: 999px;
  line-height: 1.4;
}
.mef-chip-x {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--pro-navy-500);
  padding: 0;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--pro-dur-fast) ease;
}
.mef-chip-x:hover { background: rgba(27,58,107,.12); }

/* ── Buttons (scoped, mirror pro-btn but page-prefixed) ──────────────── */
.mef-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--pro-r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--pro-dur-fast) ease, border-color var(--pro-dur-fast) ease,
              color var(--pro-dur-fast) ease, transform var(--pro-dur-fast) var(--pro-ease-out);
  white-space: nowrap;
}
.mef-btn:active { transform: translateY(1px); }
.mef-btn--sm { height: 36px; padding: 0 12px; font-size: 13px; }
.mef-btn--primary {
  background: var(--pro-navy-700);
  color: #fff;
  border-color: var(--pro-navy-700);
}
.mef-btn--primary:hover { background: var(--pro-navy-800); border-color: var(--pro-navy-800); }
.mef-btn--gold {
  background: var(--pro-gold-500);
  color: #fff;
  border-color: var(--pro-gold-500);
}
.mef-btn--gold:hover { background: var(--pro-gold-600); border-color: var(--pro-gold-600); color: #fff; }
.mef-btn--ghost {
  background: transparent;
  color: var(--pro-body);
  border-color: var(--pro-line);
}
.mef-btn--ghost:hover { background: var(--pro-bg-alt); border-color: var(--pro-line-strong); color: var(--pro-navy-700); }

/* ── Stats summary ───────────────────────────────────────────────────── */
.mef-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  font-size: 13.5px;
  color: var(--pro-mute);
  padding: 4px 4px 14px;
}
.mef-summary strong {
  color: #fff;
  font-weight: 700;
}
.mef-summary-sep { color: var(--pro-line-strong); }

/* ── Results grid ────────────────────────────────────────────────────── */
.mef-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 600px) {
  .mef-results { grid-template-columns: 1fr; }
}

/* Card (extends pro-lift via JS) */
.mef-card {
  background: var(--pro-surface);
  border: 1px solid var(--pro-line);
  border-radius: var(--pro-r-md);
  padding: 16px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.mef-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--pro-line);
  transition: background var(--pro-dur-fast) ease;
}
.mef-card[data-tag="ACOGE"]::before { background: var(--pro-success); }
.mef-card[data-tag="RECHAZA"]::before { background: var(--pro-danger); }
.mef-card[data-tag="PARCIAL"]::before { background: var(--pro-warn); }
.mef-card:focus-visible { outline: 2px solid var(--pro-navy-500); outline-offset: 2px; }

.mef-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.mef-card-trib {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--pro-navy-700);
  line-height: 1.35;
}
.mef-card-rit {
  display: block;
  font-family: var(--pro-font-mono);
  font-size: 11px;
  color: var(--pro-mute);
  margin-top: 2px;
  font-weight: 500;
}
.mef-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.mef-badge--acoge { background: var(--pro-success-50); color: var(--pro-success-700); }
.mef-badge--rechaza { background: var(--pro-danger-50); color: var(--pro-danger-700); }
.mef-badge--parcial { background: var(--pro-warn-50); color: var(--pro-warn-700); }
.mef-badge--neutral { background: var(--pro-bg-alt); color: var(--pro-mute); }

.mef-card-caratula {
  font-family: var(--pro-font-display);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.32;
  color: #fff;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mef-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--pro-mute);
  margin-top: auto;
}
.mef-card-meta-item { display: inline-flex; align-items: center; gap: 4px; }
.mef-card-materia {
  font-size: 12.5px;
  color: var(--pro-body);
  background: var(--pro-bg-alt);
  padding: 2px 8px;
  border-radius: 4px;
  align-self: flex-start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mef-card-cta {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--pro-navy-700);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--pro-line);
  margin-top: 4px;
}

/* Skeleton card during load */
.mef-skeleton-card {
  background: var(--pro-surface);
  border: 1px solid var(--pro-line);
  border-radius: var(--pro-r-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Empty state ─────────────────────────────────────────────────────── */
.mef-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--pro-mute);
  background: var(--pro-surface);
  border: 1px dashed var(--pro-line-strong);
  border-radius: var(--pro-r-md);
  margin-bottom: 24px;
}
.mef-empty svg { color: var(--pro-subtle); margin-bottom: 12px; }
.mef-empty h3 {
  font-family: var(--pro-font-display);
  font-size: 18px;
  margin: 0 0 6px;
  color: #fff;
}
.mef-empty p { margin: 0 0 16px; font-size: 14px; }

/* ── Pagination ──────────────────────────────────────────────────────── */
.mef-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}
.mef-pg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pro-surface);
  color: var(--pro-body);
  border: 1px solid var(--pro-line);
  border-radius: var(--pro-r-sm);
  padding: 8px 14px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--pro-dur-fast) ease, border-color var(--pro-dur-fast) ease, color var(--pro-dur-fast) ease;
}
.mef-pg-btn:not([disabled]):hover {
  background: var(--pro-bg-alt);
  border-color: var(--pro-navy-300);
  color: var(--pro-navy-700);
}
.mef-pg-btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
}
.mef-pg-pos {
  font-size: 13px;
  color: var(--pro-mute);
  font-variant-numeric: tabular-nums;
}

/* ── Disclaimer ──────────────────────────────────────────────────────── */
.mef-disclaimer {
  text-align: center;
  font-size: 12px;
  color: var(--pro-subtle);
  margin: 16px auto 0;
  max-width: 720px;
}

/* ── Detail drawer (slide-in from right) ─────────────────────────────── */
.mef-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 30, 63, .42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  transition: opacity var(--pro-dur-med) var(--pro-ease-out);
}
.mef-drawer-backdrop[data-open="true"] {
  opacity: 1;
}
.mef-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(720px, 100vw);
  background: var(--pro-surface);
  box-shadow: var(--pro-shadow-lg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .32s var(--pro-ease-out);
  visibility: hidden;
}
.mef-drawer[data-open="true"] {
  transform: translateX(0);
  visibility: visible;
}
.mef-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--pro-line);
  flex-shrink: 0;
}
.mef-drawer-head-l { min-width: 0; }
.mef-drawer-eyebrow {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--pro-navy-700);
  margin-bottom: 4px;
}
.mef-drawer-title {
  font-family: var(--pro-font-display);
  font-size: 20px;
  margin: 0;
  color: #fff;
  line-height: 1.3;
  word-wrap: break-word;
}
.mef-drawer-close {
  background: none;
  border: 0;
  color: var(--pro-mute);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: background var(--pro-dur-fast) ease, color var(--pro-dur-fast) ease;
  flex-shrink: 0;
}
.mef-drawer-close:hover { background: var(--pro-bg-alt); color: var(--pro-navy-700); }
.mef-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.mef-drawer-body::-webkit-scrollbar { width: 8px; }
.mef-drawer-body::-webkit-scrollbar-thumb { background: var(--pro-line-strong); border-radius: 4px; }
.mef-drawer-foot {
  border-top: 1px solid var(--pro-line);
  padding: 14px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  background: var(--pro-bg);
  flex-shrink: 0;
}
.mef-drawer-foot:empty { display: none; }

/* Detail content */
.mef-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--pro-line);
  margin-bottom: 18px;
}
.mef-detail-meta-item {
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mef-detail-meta-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--pro-mute);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.mef-detail-meta-value {
  color: var(--pro-ink);
  font-weight: 500;
  word-break: break-word;
}
.mef-detail-section {
  margin-bottom: 18px;
}
.mef-detail-section h3 {
  font-family: var(--pro-font-display);
  font-size: 15px;
  margin: 0 0 8px;
  color: #fff;
  font-weight: 700;
}
.mef-detail-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--pro-body);
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--pro-bg);
  padding: 14px 16px;
  border-radius: var(--pro-r-sm);
  border: 1px solid var(--pro-line);
  max-height: 420px;
  overflow-y: auto;
}
.mef-detail-text--collapsed {
  max-height: 280px;
  position: relative;
}
.mef-detail-text--collapsed::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(180deg, transparent, var(--pro-bg));
  pointer-events: none;
}
.mef-detail-toggle {
  display: inline-block;
  margin-top: 8px;
  background: none;
  border: 0;
  color: var(--pro-navy-700);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.mef-detail-tag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

/* ── Reduce motion ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .mef-drawer { transition: none; }
  .mef-drawer-backdrop { transition: none; }
}

/* ── Mobile tweaks ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .mef-title { font-size: 28px; }
  .mef-filterbar { padding: 0; top: var(--pro-nav-h); }
  .mef-filterbar-inner { padding: 12px; }
  .mef-drawer-head { padding: 16px 16px 12px; }
  .mef-drawer-body { padding: 16px; }
  .mef-drawer-foot { padding: 12px 16px; }
}

/* 2026-04-26 eyebrow consistency · gold pill matching home/sii/leyes */
.mef-eyebrow {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: linear-gradient(135deg, rgba(252,211,77,.18), rgba(252,211,77,.08)) !important;
  color: var(--pro-gold-600) !important;
  padding: 4px 12px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(217,119,6,.22) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: .14em !important;
  text-transform: uppercase !important;
  margin-bottom: 12px !important;
}
