/**
 * Estilos - Buscador de Jurisprudencia y Sentencias de Tribunales de España (CENDOJ - CGPJ)
 * Fijate Tools • Canon 2026
 */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tema Claro */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-subtle: #eff6ff;
  --primary-border: #bfdbfe;

  /* Jurisdicciones */
  --juris-civil-text: #0369a1;
  --juris-civil-bg: #e0f2fe;
  --juris-civil-border: #bae6fd;

  --juris-laboral-text: #047857;
  --juris-laboral-bg: #d1fae5;
  --juris-laboral-border: #a7f3d0;

  --juris-penal-text: #b91c1c;
  --juris-penal-bg: #fee2e2;
  --juris-penal-border: #fecaca;

  --juris-contencioso-text: #6d28d9;
  --juris-contencioso-bg: #ede9fe;
  --juris-contencioso-border: #ddd6fe;

  /* Sentidos del Fallo */
  --fallo-estimatorio-text: #15803d;
  --fallo-estimatorio-bg: #dcfce7;
  --fallo-desestimatorio-text: #b91c1c;
  --fallo-desestimatorio-bg: #fee2e2;
  --fallo-parcial-text: #b45309;
  --fallo-parcial-bg: #fef3c7;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"],
body.theme-dark {
  --bg-page: #0b0f17;
  --bg-surface: #131926;
  --bg-surface-elevated: #1a2234;
  --bg-card-subtle: #172033;
  --border-subtle: #232d42;
  --border-strong: #334155;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-subtle: rgba(59, 130, 246, 0.12);
  --primary-border: rgba(59, 130, 246, 0.3);

  /* Jurisdicciones Dark */
  --juris-civil-text: #38bdf8;
  --juris-civil-bg: rgba(56, 189, 248, 0.14);
  --juris-civil-border: rgba(56, 189, 248, 0.3);

  --juris-laboral-text: #34d399;
  --juris-laboral-bg: rgba(52, 211, 153, 0.14);
  --juris-laboral-border: rgba(52, 211, 153, 0.3);

  --juris-penal-text: #f87171;
  --juris-penal-bg: rgba(248, 113, 113, 0.14);
  --juris-penal-border: rgba(248, 113, 113, 0.3);

  --juris-contencioso-text: #c084fc;
  --juris-contencioso-bg: rgba(192, 132, 252, 0.14);
  --juris-contencioso-border: rgba(192, 132, 252, 0.3);

  /* Sentidos del Fallo Dark */
  --fallo-estimatorio-text: #4ade80;
  --fallo-estimatorio-bg: rgba(74, 222, 128, 0.14);
  --fallo-desestimatorio-text: #f87171;
  --fallo-desestimatorio-bg: rgba(248, 113, 113, 0.14);
  --fallo-parcial-text: #fbbf24;
  --fallo-parcial-bg: rgba(251, 191, 36, 0.14);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
}

/* -------------------------------------------------------------
   Contención básica obligatoria
   ------------------------------------------------------------- */
body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
}

.text-mono {
  font-family: var(--font-mono);
}

.tool-layout {
  max-width: 1200px;
  margin: 1.25rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* -------------------------------------------------------------
   Sección Hero & Buscador Principal
   ------------------------------------------------------------- */
.cendoj-hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.85rem 1.75rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.cendoj-badge-source {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.cendoj-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary);
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
  animation: pulse-ring 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.cendoj-hero-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.65rem 0;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.cendoj-hero-desc {
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 1.5rem 0;
  max-width: 860px;
}

/* Barra de búsqueda */
.cendoj-search-bar {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  margin-bottom: 1.25rem;
}

.cendoj-search-input-wrap {
  position: relative;
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  align-items: center;
}

.cendoj-search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-light);
  pointer-events: none;
}

.cendoj-search-input {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 2.75rem 0.75rem 2.75rem;
  font-size: 0.96rem;
  font-family: var(--font-main);
  color: var(--text-main);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.cendoj-search-input:focus {
  outline: none;
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

.cendoj-btn-clear {
  position: absolute;
  right: 0.85rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s;
}

.cendoj-btn-clear:hover {
  color: var(--text-main);
}

.cendoj-btn-search {
  min-height: 48px;
  padding: 0 1.5rem;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.2s ease, transform 0.1s ease;
  flex-shrink: 0;
}

.cendoj-btn-search:hover {
  background: var(--primary-hover);
}

.cendoj-btn-search:active {
  transform: translateY(1px);
}

/* Píldoras de búsqueda rápida */
.cendoj-quick-chips {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cendoj-quick-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.cendoj-chips-scroll {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.cendoj-chip {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cendoj-chip:hover,
.cendoj-chip.is-active {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* -------------------------------------------------------------
   Panel de Filtros Facetados Avanzados
   ------------------------------------------------------------- */
.cendoj-filters-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.cendoj-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.cendoj-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cendoj-filter-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.cendoj-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  min-height: 40px;
  padding: 0.4rem 2.25rem 0.4rem 0.75rem;
  font-size: 0.88rem;
  font-family: var(--font-main);
  color: var(--text-main);
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  box-sizing: border-box;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 15px;
  transition: border-color 0.15s, background-color 0.15s;
}

.cendoj-select:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--bg-surface);
}

.cendoj-select option {
  background: var(--bg-surface);
  color: var(--text-main);
}

.cendoj-filters-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.cendoj-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.cendoj-btn-secondary:hover {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.cendoj-active-tags-summary {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.cendoj-filter-tag {
  background: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cendoj-filter-tag-remove {
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  line-height: 1;
}

/* -------------------------------------------------------------
   Barra de Resultados & Enlace Externo CENDOJ
   ------------------------------------------------------------- */
.cendoj-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.cendoj-results-meta {
  display: flex;
  flex-direction: column;
}

.cendoj-results-count {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.cendoj-results-submeta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cendoj-btn-official {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.cendoj-btn-official:hover {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* -------------------------------------------------------------
   Tarjetas Semánticas de Jurisprudencia
   ------------------------------------------------------------- */
.cendoj-results-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.cendoj-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.cendoj-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
}

.cendoj-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.cendoj-badges-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Badges de orden jurisdiccional */
.cendoj-badge-jurisdiccion {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.cendoj-badge-jurisdiccion.juris-civil {
  background: var(--juris-civil-bg);
  color: var(--juris-civil-text);
  border: 1px solid var(--juris-civil-border);
}

.cendoj-badge-jurisdiccion.juris-laboral {
  background: var(--juris-laboral-bg);
  color: var(--juris-laboral-text);
  border: 1px solid var(--juris-laboral-border);
}

.cendoj-badge-jurisdiccion.juris-penal {
  background: var(--juris-penal-bg);
  color: var(--juris-penal-text);
  border: 1px solid var(--juris-penal-border);
}

.cendoj-badge-jurisdiccion.juris-contencioso {
  background: var(--juris-contencioso-bg);
  color: var(--juris-contencioso-text);
  border: 1px solid var(--juris-contencioso-border);
}

/* Badges de sentido del fallo */
.cendoj-badge-fallo {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.cendoj-badge-fallo.fallo-estimatorio {
  background: var(--fallo-estimatorio-bg);
  color: var(--fallo-estimatorio-text);
}

.cendoj-badge-fallo.fallo-desestimatorio {
  background: var(--fallo-desestimatorio-bg);
  color: var(--fallo-desestimatorio-text);
}

.cendoj-badge-fallo.fallo-parcial {
  background: var(--fallo-parcial-bg);
  color: var(--fallo-parcial-text);
}

.cendoj-meta-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-card-subtle);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.cendoj-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.5rem 0;
  line-height: 1.35;
}

.cendoj-court-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}

.cendoj-court-sep {
  color: var(--border-strong);
}

.cendoj-summary-box {
  background: var(--bg-card-subtle);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  margin-bottom: 0.9rem;
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.5;
}

.cendoj-summary-label {
  font-weight: 700;
  color: var(--primary);
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.cendoj-doctrina-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.cendoj-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.cendoj-card-actions-left {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cendoj-btn-view-detail {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.cendoj-btn-view-detail:hover {
  background: var(--primary-hover);
}

.cendoj-btn-copy-card {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.cendoj-btn-copy-card:hover {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary-border);
}

.cendoj-btn-link-cendoj {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}

.cendoj-btn-link-cendoj:hover {
  color: var(--primary);
}

/* -------------------------------------------------------------
   Paginación
   ------------------------------------------------------------- */
.cendoj-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.cendoj-page-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  min-width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.cendoj-page-btn:hover {
  background: var(--primary-subtle);
  border-color: var(--primary-border);
  color: var(--primary);
}

.cendoj-page-btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* -------------------------------------------------------------
   Sección Guía & FAQ
   ------------------------------------------------------------- */
.cendoj-guide-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 2rem 1.85rem;
  margin: 2.5rem 0 2rem;
  box-shadow: var(--shadow-sm);
}

.cendoj-guide-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 1.5rem 0;
  line-height: 1.3;
}

.cendoj-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.cendoj-guide-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.25rem 1.2rem;
}

.cendoj-guide-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-subtle);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.cendoj-guide-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.5rem 0;
  line-height: 1.35;
}

.cendoj-guide-card-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

/* -------------------------------------------------------------
   Modal Accesible de Detalle de Sentencia (Cero window.alert)
   ------------------------------------------------------------- */
.cendoj-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.cendoj-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
}

.cendoj-modal-dialog {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 1001;
  animation: modal-slide-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-slide-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.cendoj-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.4rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
}

.cendoj-modal-header-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cendoj-modal-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0.35rem 0 0 0;
  line-height: 1.3;
}

.cendoj-modal-close {
  background: var(--bg-card-subtle);
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.cendoj-modal-close:hover {
  background: var(--border-subtle);
  color: var(--text-main);
}

.cendoj-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  font-size: 0.93rem;
  line-height: 1.6;
  color: var(--text-main);
}

.cendoj-modal-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.cendoj-meta-item-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.cendoj-meta-item-val {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.cendoj-section-block {
  margin-bottom: 1.35rem;
}

.cendoj-section-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.cendoj-quote-block {
  background: var(--bg-card-subtle);
  border-left: 4px solid var(--primary);
  border-radius: 0 10px 10px 0;
  padding: 1rem 1.2rem;
  font-style: italic;
  color: var(--text-main);
  line-height: 1.6;
  margin: 0.5rem 0 1rem;
}

.cendoj-practical-box {
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  color: var(--text-main);
}

.cendoj-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
}

.cendoj-btn-copy-quote {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.65rem 1.15rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.cendoj-btn-copy-quote:hover {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary-border);
}

.cendoj-btn-portal {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.cendoj-btn-portal:hover {
  background: var(--primary-hover);
}

/* -------------------------------------------------------------
   Toast de Notificación
   ------------------------------------------------------------- */
.cendoj-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  animation: toast-in 0.25s ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------
   Media Queries & Responsividad Móvil Estricta
   ------------------------------------------------------------- */
@media (max-width: 768px) {
  .cendoj-hero-card {
    padding: 1.35rem 1.15rem;
    border-radius: 14px;
  }

  .cendoj-hero-title {
    font-size: 1.45rem;
  }

  .cendoj-search-bar {
    flex-direction: column;
  }

  .cendoj-search-input-wrap {
    width: 100%;
  }

  .cendoj-btn-search {
    width: 100%;
    justify-content: center;
  }

  .cendoj-filters-panel {
    padding: 1.1rem;
    border-radius: 14px;
  }

  .cendoj-filters-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .cendoj-filters-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cendoj-btn-secondary {
    width: 100%;
    justify-content: center;
    height: 42px;
  }

  .cendoj-results-header {
    flex-direction: column;
    align-items: stretch;
  }

  .cendoj-btn-official {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }

  .cendoj-card {
    padding: 1.15rem 1.1rem;
    border-radius: 14px;
  }

  .cendoj-card-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cendoj-card-actions-left {
    flex-direction: column;
  }

  .cendoj-btn-view-detail,
  .cendoj-btn-copy-card {
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }

  .cendoj-btn-link-cendoj {
    justify-content: center;
    padding-top: 0.35rem;
  }

  .cendoj-modal-dialog {
    max-height: 95vh;
    border-radius: 16px;
  }

  .cendoj-modal-header {
    padding: 1.1rem;
  }

  .cendoj-modal-body {
    padding: 1.1rem;
  }

  .cendoj-modal-footer {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }

  .cendoj-btn-copy-quote,
  .cendoj-btn-portal {
    width: 100%;
    justify-content: center;
    min-height: 42px;
  }

  .cendoj-toast {
    left: 1rem;
    right: 1rem;
    bottom: 1.5rem;
    justify-content: center;
  }
}
