/* Import Satoshi Font */
@import url('https://api.fontshare.com/v2/css?f[]=satoshi@400,500,600,700&display=swap');

/* Variables Reversa */
:root {
  --reversa-green: #04db8d;
  --reversa-blue: #0b2431;
  --reversa-slate: #455862;
  --neutral-50: #fafafa;
  --neutral-100: #f8f9fa;
  --neutral-200: #f1f1f1;
  --neutral-300: #e9ecef;
  --neutral-400: #dee2e6;
  --neutral-500: #adb5bd;
  --neutral-600: #6c757d;
  --neutral-700: #495057;
  --error: #d32f2f;
  --warning-bg: #fff3cd;
  --warning-fg: #856404;
}

/* Reset y Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Satoshi', sans-serif;
  background: var(--neutral-50);
  color: var(--neutral-700);
  line-height: 1.6;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(4,219,141,.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(11,36,49,.04) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(4,219,141,.02) 0%, transparent 70%),
    linear-gradient(180deg, transparent 0%, rgba(4,219,141,.01) 100%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    repeating-linear-gradient(90deg, transparent 0px, transparent 49px, rgba(4,219,141,.01) 49px, rgba(4,219,141,.01) 50px),
    repeating-linear-gradient(0deg, transparent 0px, transparent 49px, rgba(11,36,49,.01) 49px, rgba(11,36,49,.01) 50px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

body > * {
  position: relative;
  z-index: 1;
}

/* Header con Branding */
.icam-header {
  /* Fondo opaco (sin transparencia) para que no se vean los elementos detrás al hacer scroll */
  background:
    linear-gradient(135deg, rgba(4,219,141,.10) 0%, rgba(11,36,49,.07) 100%),
    var(--neutral-50);
  border-bottom: 1px solid var(--neutral-300);
  padding: 14px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
  max-width: 1200px;
  flex-wrap: wrap;
}

.header-tagline {
  font-size: 14px;
  font-weight: 600;
  color: #6c757d;
  margin: 0;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.header-logo {
  height: 25px;
  width: auto;
  vertical-align: middle;
  margin-left: 2px;
  transition: transform 0.2s ease;
}

/* Botón Descubre más - degradado verde-gris estilo sidebar */
.btn-discover {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(4, 219, 141, 0.15) 0%, rgba(69, 88, 98, 0.1) 100%);
  border: 1px solid rgba(4, 219, 141, 0.3);
  color: var(--reversa-blue);
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  white-space: nowrap;
}

.btn-discover:hover {
  background: linear-gradient(135deg, rgba(4, 219, 141, 0.25) 0%, rgba(69, 88, 98, 0.15) 100%);
  border-color: var(--reversa-green);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(4, 219, 141, 0.2);
}

.btn-discover i {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.btn-discover:hover i {
  transform: translateX(2px);
}

.powered-by {
  font-size: 13px;
  color: var(--neutral-600);
  font-weight: 500;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.icam-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.reversa-brand {
  color: var(--reversa-blue);
  font-weight: 700;
}

.reversa-link {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

.reversa-link:hover {
  opacity: 0.8;
}

.reversa-link:hover .reversa-brand {
  color: var(--reversa-green);
}

.reversa-link:hover .header-logo {
  transform: scale(1.05);
}

/* Título Principal */
.main-title-container {
  text-align: center;
  padding: 24px 20px 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  max-width: fit-content;
  margin: 0 auto;
}

.main-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--reversa-blue);
  display: inline-block;
  margin-bottom: 0;
}

.main-title-container .powered-by {
  margin-top: 0px;
  padding: 0;
  border: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  justify-content: center;
}

/* Navegación Principal (Tabs) - Estilo dashboard_interno */
.icam-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 20px 8px;
  border-bottom: 1px solid var(--neutral-300);
  position: relative;
  z-index: 10;
  flex-wrap: wrap;
}

.tab {
  padding: 12px 8px;
  color: var(--reversa-blue);
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
  font-size: 15px;
}

.tab:hover {
  color: var(--reversa-green);
}

.tab.active {
  color: var(--reversa-blue);
}

.tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--reversa-blue);
  border-radius: 2px;
}

/* Subnavegación (Subtabs) */
.icam-subnav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 20px 20px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.subtab {
  padding: 8px 12px;
  background: transparent;
  color: var(--reversa-slate);
  font-weight: 600;
  font-size: 13px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.subtab:hover {
  background: var(--neutral-100);
  border-color: var(--neutral-300);
}

.subtab.active {
  background: var(--reversa-blue);
  color: white;
  border-color: var(--reversa-blue);
}

/* Filtros */
.icam-filters {
  display: inline-flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 32px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(11,36,49,.08);
  border: 1px solid var(--neutral-300);
  position: relative;
}

.icam-filters::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-reversa);
  border-radius: 16px 16px 0 0;
}

/* Contenedor centrado para filtros */
.icam-filters-wrapper {
  display: flex;
  justify-content: center;
  padding: 0 20px;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--reversa-blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label i {
  font-size: 14px;
  color: var(--reversa-blue);
}

.chip-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--neutral-100);
  color: var(--neutral-600);
  border: 2px solid transparent;
}

.chip:hover {
  background: var(--neutral-200);
}

.chip.active {
  background: rgba(4,219,141,.1);
  color: var(--reversa-green);
  border-color: var(--reversa-green);
}

/* Tooltips para chips de impacto */
.chip-tooltip {
  position: relative;
}

.chip-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--reversa-blue);
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 220px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(11, 36, 49, 0.25);
}

.chip-tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--reversa-blue);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
}

.chip-tooltip:hover::after,
.chip-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Custom Date Range */
.custom-range {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  background: var(--neutral-50);
  border: 1px solid var(--neutral-300);
  border-radius: 10px;
  flex-wrap: wrap;
}

.custom-range-input {
  flex: 1;
  min-width: 140px;
  padding: 8px 12px;
  border: 1px solid var(--neutral-400);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Satoshi', sans-serif;
  color: var(--reversa-blue);
  cursor: pointer;
}

.custom-range-input:focus {
  outline: none;
  border-color: var(--reversa-green);
  box-shadow: 0 0 0 3px rgba(4,219,141,.15);
}

.fecha-separator {
  color: var(--neutral-500);
  font-weight: 600;
}

.btn-apply-custom {
  padding: 8px 16px;
  background: var(--reversa-blue);
  color: white;
  border: none;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
}

.btn-apply-custom:hover {
  background: var(--reversa-slate);
}

/* Contenedor de Documentos */
.icam-docs-container {
  padding: 0 20px 40px;
  position: relative;
}

.icam-docs-container::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(180deg, rgba(4,219,141,.02) 0%, transparent 100%);
  pointer-events: none;
  z-index: -1;
}

/* Loader */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.loader {
  border: 4px solid var(--neutral-300);
  border-top: 4px solid var(--reversa-green);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-container span {
  font-size: 14px;
  color: var(--neutral-600);
  font-weight: 500;
}

/* Grid de Documentos */
.icam-docs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Card de Documento */
.doc-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(11,36,49,.08);
  transition: all 0.3s ease;
  border: 1px solid var(--neutral-300);
  position: relative;
  overflow: hidden;
}

.doc-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 0;
  background: var(--gradient-reversa);
  transition: height 0.3s ease;
}

.doc-card:hover {
  box-shadow: 0 4px 16px rgba(11,36,49,.12);
  transform: translateY(-2px);
  border-color: rgba(4,219,141,.3);
}

.doc-card:hover::before {
  height: 100%;
}

.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.doc-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--reversa-blue);
  line-height: 1.4;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.jurisprudencia-icon {
  color: var(--reversa-slate);
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.8;
  transition: all 0.2s ease;
}

.doc-card:hover .jurisprudencia-icon {
  color: var(--reversa-blue);
  opacity: 1;
  transform: scale(1.1);
}

.doc-date {
  font-size: 12px;
  color: var(--neutral-600);
  white-space: nowrap;
  font-weight: 500;
}

.doc-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.doc-source {
  font-size: 12px;
  color: var(--neutral-600);
  font-weight: 500;
}

.doc-etiquetas {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.doc-etiquetas .chip {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: default;
}

.doc-etiquetas .chip:hover {
  background: rgba(4, 219, 141, 0.1);
}

.doc-impact-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.doc-impact-badge.Destacado {
  background: rgba(211,47,47,.1);
  color: var(--error);
}

.doc-impact-badge.relevante {
  background: var(--warning-bg);
  color: var(--warning-fg);
}

.doc-impact-badge.informativo {
  background: rgba(4,219,141,.1);
  color: var(--reversa-green);
}

.doc-resumen {
  font-size: 14px;
  color: var(--neutral-700);
  line-height: 1.6;
  margin-bottom: 12px;
}

.doc-explicacion {
  background: rgba(4,219,141,.05);
  border-left: 3px solid var(--reversa-green);
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.doc-explicacion-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--reversa-slate);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.doc-explicacion-text {
  font-size: 13px;
  color: var(--neutral-700);
  line-height: 1.5;
}

.doc-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--reversa-blue);
  color: white;
  text-decoration: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.doc-link:hover {
  background: var(--reversa-slate);
  transform: translateX(2px);
}

.doc-link i {
  font-size: 11px;
}

/* Sin Resultados */
.no-results {
  text-align: center;
  padding: 80px 20px;
  color: var(--neutral-600);
}

.no-results i {
  font-size: 64px;
  color: var(--neutral-400);
  margin-bottom: 16px;
}

.no-results p {
  font-size: 16px;
  font-weight: 500;
}

/* Responsive - Mobile First */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  
  .header-tagline {
    font-size: 13px;
    text-align: center;
  }
  
  .header-logo {
    height: 18px;
  }
  
  /* Tooltips más pequeños en móviles */
  .chip-tooltip::after {
    font-size: 11px;
    padding: 8px 10px;
    max-width: 180px;
  }
  
  .btn-discover {
    padding: 7px 14px;
    font-size: 12px;
  }
  
  .powered-by {
    font-size: 12px;
  }

  .icam-logo {
    height: 29px;
  }
  
  .main-title {
    font-size: 22px;
    line-height: 1.3;
  }
  
  .main-title::after {
    width: 60px;
  }
  
  .tab {
    font-size: 14px;
    padding: 10px 6px;
  }
  
  .icam-filters-wrapper {
    padding: 0 12px;
  }
  
  .icam-filters {
    display: flex;
    width: 100%;
    padding: 16px 16px 20px;
    gap: 16px;
  }
  
  .icam-docs-container {
    padding: 0 12px 32px;
  }
  
  .doc-card {
    padding: 16px;
  }
}

/* Tablet */
@media (min-width: 768px) {
  .icam-filters {
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 60px;
  }
  
  .filter-group {
    flex: 0 1 auto;
  }
  
  .filter-group:first-child {
    padding-right: 30px;
    border-right: 2px solid var(--neutral-300);
  }
}

/* Desktop */
@media (min-width: 1200px) {
  .icam-docs-container {
    max-width: 1200px;
    margin: 0 auto;
  }
}

