/**
 * Custom CSS for RECAC Theme
 * Additional styles not covered by Tailwind
 *
 * @package RECAC_Theme
 * @since 1.0.0
 */

/* CSS Variables for easier theme customization */
:root {
  --recac-primary: #0d2535;
  --recac-secondary: #163d56;
  --recac-accent: #C2B000;
  --recac-gold: #C2B000;
  --recac-teal: #319795;
  --recac-emerald: #38a169;
  --neutral-warm: #faf9f7;
  --neutral-cool: #f7fafc;
  --neutral-dark: #1a202c;
}

/* ── Override Tailwind compiled color classes with new brand palette ────── */
/* Primary #0d2535 — deep navy */
.bg-recac-primary { background-color: rgb(13 37 53 / var(--tw-bg-opacity, 1)) !important; }
.text-recac-primary { color: rgb(13 37 53 / var(--tw-text-opacity, 1)) !important; }
.border-recac-primary { border-color: rgb(13 37 53 / var(--tw-border-opacity, 1)) !important; }
.from-recac-primary { --tw-gradient-from: #0d2535 !important; }
.to-recac-primary   { --tw-gradient-to:   #0d2535 !important; }
.ring-recac-primary { --tw-ring-color: rgb(13 37 53 / var(--tw-ring-opacity, 1)) !important; }
.hover\:bg-recac-primary:hover   { background-color: rgb(13 37 53 / var(--tw-bg-opacity, 1)) !important; }
.hover\:text-recac-primary:hover { color: rgb(13 37 53 / var(--tw-text-opacity, 1)) !important; }
/* opacity variants */
.bg-recac-primary\/5  { background-color: rgb(13 37 53 / 0.05)  !important; }
.bg-recac-primary\/10 { background-color: rgb(13 37 53 / 0.10)  !important; }
.bg-recac-primary\/20 { background-color: rgb(13 37 53 / 0.20)  !important; }
.bg-recac-primary\/30 { background-color: rgb(13 37 53 / 0.30)  !important; }
.border-recac-primary\/10 { border-color: rgb(13 37 53 / 0.10)  !important; }
.border-recac-primary\/20 { border-color: rgb(13 37 53 / 0.20)  !important; }
.border-recac-primary\/40 { border-color: rgb(13 37 53 / 0.40)  !important; }
.text-recac-primary\/80   { color: rgb(13 37 53 / 0.80) !important; }
.hover\:bg-recac-primary\/10:hover { background-color: rgb(13 37 53 / 0.10) !important; }

/* Secondary #163d56 */
.bg-recac-secondary { background-color: rgb(22 61 86 / var(--tw-bg-opacity, 1)) !important; }
.text-recac-secondary { color: rgb(22 61 86 / var(--tw-text-opacity, 1)) !important; }
.border-recac-secondary { border-color: rgb(22 61 86 / var(--tw-border-opacity, 1)) !important; }
.from-recac-secondary { --tw-gradient-from: #163d56 !important; }
.to-recac-secondary   { --tw-gradient-to:   #163d56 !important; }
.hover\:bg-recac-secondary:hover { background-color: rgb(22 61 86 / var(--tw-bg-opacity, 1)) !important; }

/* Accent/Gold #C2B000 */
.bg-recac-accent    { background-color: rgb(194 176 0 / var(--tw-bg-opacity, 1)) !important; }
.text-recac-accent  { color: rgb(194 176 0 / var(--tw-text-opacity, 1)) !important; }
.border-recac-accent { border-color: rgb(194 176 0 / var(--tw-border-opacity, 1)) !important; }
.from-recac-accent  { --tw-gradient-from: #C2B000 !important; }
.to-recac-accent    { --tw-gradient-to:   #C2B000 !important; }
.hover\:bg-recac-accent:hover { background-color: rgb(194 176 0 / var(--tw-bg-opacity, 1)) !important; }
.bg-recac-gold      { background-color: rgb(194 176 0 / var(--tw-bg-opacity, 1)) !important; }
.text-recac-gold    { color: rgb(194 176 0 / var(--tw-text-opacity, 1)) !important; }
.from-recac-gold    { --tw-gradient-from: #C2B000 !important; }
.to-recac-gold      { --tw-gradient-to:   #C2B000 !important; }

/* ── WordPress Core Styles Override ─────────────────────────────────────── */
/* WordPress Core Styles Override */
.alignnone {
  margin: 1.5em 1.5em 1.5em 0;
}

.aligncenter,
div.aligncenter {
  display: block;
  margin: 1.5em auto;
}

.alignright {
  float: right;
  margin: 1.5em 0 1.5em 1.5em;
}

.alignleft {
  float: left;
  margin: 1.5em 1.5em 1.5em 0;
}

/* WordPress Image Captions */
.wp-caption {
  max-width: 100%;
}

.wp-caption img[class*="wp-image-"] {
  display: block;
  margin: 0 auto;
}

.wp-caption-text {
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.5rem;
}

/* Screen Reader Text */
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

.screen-reader-text:focus {
  background-color: #f1f1f1;
  border-radius: 3px;
  box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
  clip: auto !important;
  color: #21759b;
  display: block;
  font-size: 14px;
  font-weight: bold;
  height: auto;
  left: 5px;
  line-height: normal;
  padding: 15px 23px 14px;
  text-decoration: none;
  top: 5px;
  width: auto;
  z-index: 100000;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -9999px;
  left: -9999px;
}

.skip-link:focus {
  top: 0;
  left: 0;
  background: var(--recac-primary);
  color: white;
  padding: 1rem 2rem;
  z-index: 100000;
  text-decoration: none;
  border-radius: 0 0 0.5rem 0;
}

/* Custom Logo Styles */
.custom-logo-link {
  display: inline-block;
}

.custom-logo {
  max-height: 48px;
  width: auto;
  height: auto;
}

/* Leaflet Map Overrides */
.leaflet-container {
  font-family: 'Inter', system-ui, sans-serif;
  z-index: 0;
}

.leaflet-popup-content-wrapper {
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.leaflet-popup-content {
  margin: 0;
  font-size: 14px;
}

.leaflet-popup-tip {
  display: none;
}

/* Header Scroll Effect */
.site-header {
  transition: all 0.3s ease;
}

.site-header.scrolled {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Mobile Menu Animation */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

#mobile-menu.active {
  max-height: 500px;
}

/* Smooth Scroll Indicator */
.scroll-indicator {
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Stats Counter Animation */
.stat-number {
  font-variant-numeric: tabular-nums;
}

/* Country Flag Emoji Consistency */
.country-flag {
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-size: 1.5em;
}

/* Timeline Connector Line */
.timeline-line {
  position: relative;
}

.timeline-line::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--recac-secondary), var(--recac-teal));
  transform: translateX(-50%);
}

@media (max-width: 768px) {
  .timeline-line::before {
    left: 1rem;
  }
}

/* Bulletin Grid Layout */
.bulletin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

.bulletin-featured {
  grid-column: span 2;
}

@media (max-width: 768px) {
  .bulletin-featured {
    grid-column: span 1;
  }
}

/* Tabs Component */
.tab-button {
  position: relative;
  transition: all 0.3s ease;
}

.tab-button.active {
  color: var(--recac-secondary);
}

.tab-button.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(to right, var(--recac-secondary), var(--recac-teal));
  border-radius: 3px 3px 0 0;
}

/* Loading State */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--recac-secondary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Focus Styles for Accessibility */
*:focus-visible {
  outline: 2px solid var(--recac-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--recac-accent);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .site-header,
  .site-footer,
  .no-print {
    display: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }

  a {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }
}

/* ── Repositorio Nacional de Documentos ───────────────────────────────── */

/* Segmented control de sección */
.repo-seg-tab {
  padding: 0.5rem 1.125rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.repo-seg-tab.is-active {
  background: #ffffff;
  color: var(--tab-color, var(--recac-primary));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
  font-weight: 600;
}

/* Filtro de país — estado activo */
.country-filter-btn.is-active {
  background-color: #1a202c;
  color: #fff;
  border-color: #1a202c;
}

/* Tarjeta de documento */
.pub-card {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.pub-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* ── Portal de Transparencia v4 — Diseño profesional ────────────────────── */

/* Layout raíz */
.tr-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f1f5f9;
}

/* ── Cabecera de página ─────────────────────────────── */
.tr-header {
  background: #ffffff;
  border-top: 3px solid #C2B000;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: sticky;
  top: 136px; /* fallback: 104px nav + 32px admin bar — JS lo afina */
  z-index: 30;
}
.tr-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Fila 1: título + búsqueda */
.tr-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.75rem 0 0.625rem;
  border-bottom: 1px solid #f1f5f9;
}
.tr-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #12455F;
  font-size: 0.9375rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.tr-header-title svg { width: 1rem; height: 1rem; flex-shrink: 0; }
.tr-header-stats {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 400;
  margin-left: 0.25rem;
  white-space: nowrap;
}

/* Search input */
.tr-search-wrap {
  position: relative;
  width: 260px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.tr-search-wrap svg {
  position: absolute;
  left: 0.625rem;
  color: #94a3b8;
  pointer-events: none;
  flex-shrink: 0;
}
.tr-search-input {
  width: 100%;
  height: 34px;
  padding: 0 0.75rem 0 2.125rem;
  font-size: 0.8125rem;
  color: #111827;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.tr-search-input:focus {
  outline: none;
  background: #ffffff;
  border-color: #12455F;
  box-shadow: 0 0 0 3px rgba(18,69,95,0.08);
}
.tr-search-input::placeholder { color: #94a3b8; }

/* Fila 2: tabs de sección */
.tr-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tr-tabs::-webkit-scrollbar { display: none; }
.tr-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1.125rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
  flex-shrink: 0;
}
.tr-tab:hover { color: #12455F; }
.tr-tab.active {
  color: #12455F;
  border-bottom-color: #12455F;
  font-weight: 600;
}
.tr-tab-count {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #94a3b8;
  line-height: 1.5;
}
.tr-tab.active .tr-tab-count {
  background: rgba(18,69,95,0.1);
  color: #12455F;
}

/* ── Cuerpo: sidebar + main ─────────────────────────── */
.tr-body {
  display: flex;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ── Sidebar ────────────────────────────────────────── */
.tr-sidebar {
  width: 272px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  position: sticky;
  top: 184px;
  max-height: calc(100vh - 184px);
  padding: 0 0 1rem;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}
.tr-sidebar::-webkit-scrollbar { width: 4px; }
.tr-sidebar::-webkit-scrollbar-track { background: transparent; }
.tr-sidebar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

/* Cabecera del sidebar */
.tr-sidebar-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 1.125rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
}

/* Buscador dentro del sidebar */
.tr-sidebar-search {
  position: relative;
  margin: 0 0.75rem 0.75rem;
}
.tr-sidebar-search svg {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}
.tr-sidebar-search-input {
  width: 100%;
  height: 30px;
  padding: 0 0.5rem 0 1.875rem;
  font-size: 0.75rem;
  color: #374151;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.tr-sidebar-search-input:focus {
  outline: none;
  border-color: #12455F;
  box-shadow: 0 0 0 2px rgba(18,69,95,0.08);
  background: #fff;
}
.tr-sidebar-search-input::placeholder { color: #94a3b8; }

/* Botón de país */
.tr-country-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 0.875rem;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.tr-country-btn:hover {
  background: #f8fafc;
}
.tr-country-btn.is-active {
  background: linear-gradient(to right, rgba(18,69,95,0.06), rgba(18,69,95,0.02));
  border-left-color: #C2B000;
}

/* Bandera emoji — tamaño real */
.tr-country-flag {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.tr-country-btn:hover .tr-country-flag {
  border-color: #cbd5e1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.tr-country-btn.is-active .tr-country-flag {
  border-color: rgba(18,69,95,0.25);
  box-shadow: 0 0 0 3px rgba(18,69,95,0.08);
  background: rgba(18,69,95,0.06);
}

/* Info: nombre + sigla apilados */
.tr-country-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tr-country-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr-country-btn.is-active .tr-country-name { color: #12455F; }
.tr-country-acronym {
  font-size: 0.6875rem;
  color: #94a3b8;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr-country-count {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  flex-shrink: 0;
  min-width: 1.5rem;
  text-align: center;
}
.tr-country-btn.is-active .tr-country-count {
  background: rgba(18,69,95,0.12);
  color: #12455F;
}
.tr-country-chevron {
  flex-shrink: 0;
  color: #cbd5e1;
  transition: transform 0.2s;
}
.tr-country-btn.is-active .tr-country-chevron { color: #94a3b8; }

/* Sub-secciones del sidebar */
.tr-sections {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
  background: #fafafa;
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
}
.tr-sections.open {
  max-height: 320px;
  border-color: #f1f5f9;
}
.tr-section-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 1rem 0.375rem 3.5rem;
  font-size: 0.7875rem;
  color: #64748b;
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
  border-left: 3px solid transparent;
}
.tr-section-link:hover {
  background: #f1f5f9;
  color: #334155;
}
.tr-section-link.active {
  color: #12455F;
  font-weight: 600;
  background: rgba(18,69,95,0.05);
  border-left-color: #12455F;
}
.tr-section-count {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 500;
  color: #94a3b8;
  min-width: 1.25rem;
  text-align: right;
}
.tr-section-link.active .tr-section-count {
  color: #12455F;
  font-weight: 700;
}

/* ── Área principal ─────────────────────────────────── */
.tr-main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 2rem 3rem;
}

/* Breadcrumb */
.tr-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 1.25rem;
}
.tr-breadcrumb a { color: #94a3b8; text-decoration: none; transition: color 0.1s; }
.tr-breadcrumb a:hover { color: #12455F; }
.tr-breadcrumb-current { color: #12455F; font-weight: 600; }

/* Country strip */
.tr-country-strip {
  display: flex;
  align-items: center;
  gap: 1.125rem;
  padding: 1rem 1.25rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  border-top: 3px solid #12455F;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.tr-country-strip-flag {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.12));
}
.tr-country-strip-name { font-size: 1.0625rem; font-weight: 700; color: #0f172a; }
.tr-country-strip-org { font-size: 0.8125rem; color: #64748b; margin-top: 2px; line-height: 1.4; }
.tr-member-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 0.6875rem;
  font-weight: 600;
}
.tr-member-badge-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

/* Lista de documentos */
.tr-doc-list {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.tr-doc-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.tr-doc-list-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tr-doc-count-pill {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
  background: rgba(18,69,95,0.1);
  color: #12455F;
}
.tr-doc-row {
  display: flex;
  align-items: flex-start;
  gap: 1.125rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s;
  position: relative;
}
.tr-doc-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: transparent;
  transition: background 0.15s;
  border-radius: 0 2px 2px 0;
}
.tr-doc-row:hover::before { background: #12455F; }
.tr-doc-row:last-child { border-bottom: none; }
.tr-doc-row:hover { background: #f8fafc; }
.tr-doc-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.tr-doc-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; flex-shrink: 0; min-width: 70px; }
.tr-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  width: fit-content;
  letter-spacing: 0.01em;
}
.tr-doc-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.45;
}
.tr-doc-desc {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.55;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.tr-doc-year {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 4px;
}

/* Botón de descarga */
.tr-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: #12455F;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tr-dl-btn:hover {
  background: #0f3a4f;
  color: #fff;
  box-shadow: 0 2px 8px rgba(18,69,95,0.3);
  transform: translateY(-1px);
}
.tr-dl-btn-na {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: not-allowed;
  border: 1px solid #e2e8f0;
}

/* Estado vacío */
.tr-empty {
  padding: 4rem 2rem;
  text-align: center;
}
.tr-empty-icon {
  width: 3.5rem; height: 3.5rem;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #f1f5f9;
  color: #94a3b8;
  margin-bottom: 1rem;
}
.tr-empty-title { font-size: 1rem; font-weight: 600; color: #334155; margin-bottom: 0.375rem; }
.tr-empty-text  { font-size: 0.8125rem; color: #94a3b8; max-width: 24rem; margin: 0 auto; line-height: 1.65; }

/* Vista de bienvenida — cards de categorías */
.tr-welcome-grid {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.tr-welcome-row {
  display: flex;
  align-items: center;
  gap: 1.125rem;
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s;
  cursor: default;
}
.tr-welcome-row:last-child { border-bottom: none; }
.tr-welcome-row:hover { background: #f8fafc; }
.tr-welcome-icon {
  width: 2.5rem; height: 2.5rem;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tr-welcome-label { font-size: 0.9375rem; font-weight: 600; color: #0f172a; }
.tr-welcome-desc  { font-size: 0.8rem; color: #64748b; margin-top: 3px; line-height: 1.45; }
.tr-welcome-count { font-size: 1.375rem; font-weight: 700; color: #12455F; flex-shrink: 0; text-align: right; line-height: 1; }
.tr-welcome-count-label { font-size: 0.6875rem; color: #94a3b8; text-align: right; margin-top: 1px; }

/* Grid de países — vista bienvenida */
.tr-countries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.tr-country-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.125rem 0.75rem 0.875rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  text-decoration: none;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.tr-country-card:hover {
  border-color: #12455F;
  box-shadow: 0 4px 16px rgba(18,69,95,0.12);
  transform: translateY(-2px);
}
.tr-country-card-flag {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}
.tr-country-card-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
  text-align: center;
  line-height: 1.3;
}
.tr-country-card-acronym {
  font-size: 0.6875rem;
  color: #94a3b8;
  text-align: center;
}
.tr-country-card-docs {
  font-size: 0.75rem;
  font-weight: 700;
  color: #12455F;
  background: rgba(18,69,95,0.08);
  padding: 2px 8px;
  border-radius: 8px;
}
.tr-country-card-obs {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #92400e;
  background: rgba(194,176,0,0.1);
  padding: 2px 8px;
  border-radius: 8px;
}

/* Paginación */
.tr-pagination { display: flex; align-items: center; justify-content: center; gap: 0.375rem; padding: 1rem; }
.tr-page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2rem; height: 2rem; padding: 0 0.5rem;
  border: 1px solid #e5e7eb; border-radius: 5px;
  font-size: 0.8125rem; font-weight: 500; color: #374151;
  background: #fff; text-decoration: none;
  transition: border-color 0.1s, background 0.1s;
}
.tr-page-btn:hover { border-color: #12455F; color: #12455F; }
.tr-page-btn.active { background: #12455F; border-color: #12455F; color: #fff; font-weight: 600; }
.tr-page-btn.nav { padding: 0 0.75rem; gap: 0.25rem; }
.tr-page-dots { font-size: 0.8125rem; color: #9ca3af; padding: 0 0.25rem; }

/* Banner búsqueda activa */
.tr-search-banner {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.625rem 1rem;
  background: rgba(18,69,95,0.05);
  border-radius: 6px;
  border: 1px solid rgba(18,69,95,0.1);
  font-size: 0.8125rem; color: #12455F;
  margin-bottom: 1rem;
}
.tr-search-banner a { color: #C2B000; font-weight: 600; text-decoration: none; margin-left: auto; flex-shrink: 0; }

/* Overlay móvil */
#sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; }
#sidebar-overlay.active { display: block; }

/* ── Tabs del page header de Transparencia ──────────── */
.tr-ph-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
  flex-shrink: 0;
}
.tr-ph-tab:hover { color: #12455F; }
.tr-ph-tab.active {
  color: #12455F;
  border-bottom-color: #12455F;
  font-weight: 600;
}
.tr-ph-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #94a3b8;
  line-height: 1.5;
}
.tr-ph-tab.active .tr-ph-count {
  background: rgba(18,69,95,0.1);
  color: #12455F;
}

/* ── Admin bar compensation (logged-in WP users) ────── */
body.admin-bar .tr-page { padding-top: 136px !important; } /* 104 + 32 */
body.admin-bar .tr-header { top: 136px !important; }
body.admin-bar .tr-sidebar { top: 216px !important; max-height: calc(100vh - 216px) !important; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 1023px) {
  .tr-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    max-height: 100vh !important;
    top: 0 !important;
    padding-top: 1rem;
    box-shadow: 6px 0 32px rgba(0,0,0,0.15);
    width: 280px;
  }
  .tr-sidebar.open { transform: translateX(0); }
  .tr-main { padding: 1rem; }
  .tr-countries-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ── Mantener compatibilidad con clases Tailwind usadas en el resto del tema */
.country-accordion-btn.is-active-country {
  border-left: 3px solid #C2B000 !important;
  padding-left: calc(0.75rem - 3px) !important;
  background: rgba(18,69,95,0.06) !important;
}

/* Métricas del hero — barra horizontal */
.trans-hero-metrics {
  display: flex;
  border-top: 1px solid rgba(255,255,255,0.12);
  margin-top: 2rem;
  padding-top: 1.5rem;
}
.trans-hero-metric {
  flex: 1;
  text-align: center;
  padding: 0 1.5rem;
  border-right: 1px solid rgba(255,255,255,0.15);
}
.trans-hero-metric:last-child { border-right: none; }
.trans-hero-metric-number {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 2.75rem;
  font-weight: 700;
  color: #C2B000;
  line-height: 1;
}
.trans-hero-metric-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-top: 0.4rem;
}

/* Barra de búsqueda global — sticky */
.trans-search-bar {
  position: sticky;
  top: 88px;
  z-index: 20;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 2px 10px rgba(18,69,95,0.07);
}

/* Input de búsqueda prominente */
.trans-search-input {
  height: 46px;
  font-size: 0.9375rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  padding: 0 1rem 0 2.75rem;
  width: 100%;
  background: #ffffff;
  color: #111827;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.trans-search-input:focus {
  outline: none;
  border-color: #12455F;
  box-shadow: 0 0 0 3px rgba(18,69,95,0.1);
}
.trans-search-input::placeholder { color: #9ca3af; }

/* Chips de filtro rápido */
.trans-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1.5px solid #e5e7eb;
  color: #374151;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.trans-filter-chip:hover {
  border-color: #12455F;
  color: #12455F;
}
.trans-filter-chip.is-active {
  border-color: #12455F;
  background: #12455F;
  color: #ffffff;
  font-weight: 600;
}

/* Sidebar header institucional */
.trans-sidebar-header {
  background: linear-gradient(135deg, #12455F 0%, #1a6080 100%);
  padding: 1.125rem 1.25rem 1rem;
  flex-shrink: 0;
}
.trans-sidebar-search-input {
  width: 100%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px;
  padding: 7px 10px 7px 2.25rem;
  font-size: 0.8125rem;
  color: #ffffff;
  transition: background 0.2s, border-color 0.2s;
}
.trans-sidebar-search-input::placeholder { color: rgba(255,255,255,0.45); }
.trans-sidebar-search-input:focus {
  outline: none;
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.45);
}

/* País activo — indicador dorado */
.country-accordion-btn.is-active-country {
  border-left: 3px solid #C2B000 !important;
  padding-left: calc(0.75rem - 3px) !important;
  background: rgba(18,69,95,0.06) !important;
}

/* Tarjeta de documento — accent bar + hover */
.trans-doc-card {
  position: relative;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
}
.trans-doc-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--card-accent, #12455F);
}
.trans-doc-card:hover {
  box-shadow: 0 8px 28px rgba(18,69,95,0.12);
  transform: translateY(-2px);
}
.trans-doc-card-body {
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.trans-doc-card-footer {
  padding: 0.625rem 1.25rem 0.625rem 1.5rem;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Botón de descarga — ghost style */
.trans-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: 1.5px solid #12455F;
  border-radius: 7px;
  color: #12455F;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.trans-download-btn:hover {
  background: #12455F;
  color: #ffffff;
}
.trans-download-btn-disabled {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 7px;
  color: #9ca3af;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: not-allowed;
  flex-shrink: 0;
}

/* Tarjeta de categoría — feature card */
.trans-category-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  border-top: 4px solid var(--cat-color, #12455F);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.trans-category-card:hover {
  box-shadow: 0 8px 24px rgba(18,69,95,0.1);
  transform: translateY(-2px);
}

/* Banner de resultados de búsqueda */
.trans-search-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: rgba(18,69,95,0.05);
  border: 1px solid rgba(18,69,95,0.12);
  border-radius: 10px;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: #12455F;
}

/* Dark Mode Support (Future Enhancement) */
@media (prefers-color-scheme: dark) {
  /* Can be enabled later for dark mode support */
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .btn-primary,
  .btn-secondary,
  .btn-accent {
    border: 2px solid currentColor;
  }
}

/* Browser-specific Fixes */

/* Firefox */
@-moz-document url-prefix() {
  .custom-select {
    padding-right: 2rem;
  }
}

/* Safari */
@supports (-webkit-appearance: none) {
  .safari-only {
    -webkit-font-smoothing: antialiased;
  }
}

/* IE11 Fallbacks (if needed) */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  /* IE11 specific styles */
}

/* ── Footer: override browser/theme default link colors ─────────────────── */
footer a,
footer a:link,
footer a:visited {
  color: inherit !important;
  text-decoration: none !important;
  background: transparent !important;
}
footer a:hover {
  text-decoration: none !important;
  background: transparent !important;
}
/* Excepción: botón CTA del footer mantiene su color propio */
footer a.footer-cta-btn,
footer a.footer-cta-btn:link,
footer a.footer-cta-btn:visited,
footer a.footer-cta-btn:hover {
  color: #0d2535 !important;
  background-color: #ffffff !important;
}
footer a.footer-cta-btn:hover {
  background-color: #C2B000 !important;
  color: #ffffff !important;
}
