/* ==========================================================================
   ICAC en cifras page styles
   Figma reference: node 22889:174822
   Colors: primary #b91c1c, bg-card #f9fafb, border #e5e5e5, text #0a0a0a, muted #525252
   Font: Inter (400, 500, 600, 700)
   ========================================================================== */

/* Hero */
.cifras-hero {
  background: white;
  padding: 64px 0 28px;
  max-width: 1536px;
  margin: 0 auto;
}
.cifras-hero__container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cifras-hero__breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.cifras-hero__breadcrumb-item {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: #525252;
}
.cifras-hero__breadcrumb-item--active {
  color: #0a0a0a;
}
.cifras-hero__breadcrumb-sep {
  flex-shrink: 0;
}
.cifras-hero__title {
  font-family: 'Inter', sans-serif;
  font-size: 36px;
  font-weight: 700;
  line-height: 40px;
  color: #0a0a0a;
  letter-spacing: 0;
  margin: 0;
}

/* Listing section */
.cifras-listing {
  padding: 0 0 64px;
  max-width: 1536px;
  margin: 0 auto;
}
.cifras-listing__container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 23px;
}

/* Top bar */
.cifras-listing__topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
}

/* Tabs */
.cifras-listing__tabs {
  display: flex;
  align-items: center;
  gap: 0;
  background: #f5f5f5;
  border-radius: 10px;
  padding: 3px;
  cursor: pointer;
}
.cifras-listing__tab {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  color: #0a0a0a;
  background: transparent;
  border: none;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.cifras-listing__tab--active {
  background: white;
  border: 1px solid #e5e5e5;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
}

/* Controls */
.cifras-listing__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cifras-listing__view-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 8px 16px;
  height: 36px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #0a0a0a;
  cursor: pointer;
}
.cifras-listing__sort {
  position: relative;
}
.cifras-listing__sort-select {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: #525252;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  height: 36px;
  padding: 8px 32px 8px 12px;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
  appearance: none;
  cursor: pointer;
}
.cifras-listing__sort-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Separator */
.cifras-listing__separator {
  border: none;
  border-top: 1px solid #e5e5e5;
  margin: 0;
}

/* Section title */
.cifras-listing__section-title {
  font-family: 'Inter', sans-serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  color: #0a0a0a;
  letter-spacing: -0.4px;
  margin: 0;
}

/* Content layout */
.cifras-listing__content {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* Sidebar */
.cifras-listing__sidebar {
  width: 305px;
  flex-shrink: 0;
}
.cifras-listing__filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cifras-listing__filters-title {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: #000;
  margin: 0;
}

/* Search */
.cifras-listing__search {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #e5e5e5;
  height: 48px;
  padding: 12px;
  background: transparent;
}
.cifras-listing__search-icon {
  opacity: 0.5;
  flex-shrink: 0;
}
.cifras-listing__search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: #0a0a0a;
  background: transparent;
}
.cifras-listing__search-input::placeholder {
  color: #525252;
}
.cifras-listing__search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

/* Filter groups */
.cifras-listing__filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cifras-listing__filter-label {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  color: #0a0a0a;
}
.cifras-listing__select-wrapper {
  position: relative;
}
.cifras-listing__filter-select {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: #525252;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  height: 36px;
  padding: 8px 32px 8px 12px;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
  appearance: none;
  cursor: pointer;
}
.cifras-listing__select-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Buttons */
.cifras-listing__btn-search {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  color: #fafafa;
  background: #b91c1c;
  border: none;
  border-radius: 8px;
  height: 36px;
  padding: 8px 16px;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  width: 100%;
  text-align: center;
}
.cifras-listing__btn-search:hover {
  background: #991b1b;
}
.cifras-listing__btn-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  color: #0a0a0a;
  background: transparent;
  border: none;
  border-radius: 8px;
  height: 36px;
  padding: 8px 16px;
  cursor: pointer;
}

/* Grid */
.cifras-listing__grid-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.cifras-listing__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.cifras-listing__grid--list {
  grid-template-columns: 1fr;
}

/* Card */
.cifras-listing__card {
  background: #f9fafb;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 16px;
  min-height: 172px;
  height: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Badge */
.cifras-listing__card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 4px 8px;
  align-self: flex-start;
}
.cifras-listing__flag {
  flex-shrink: 0;
}
.cifras-listing__badge-text {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  color: #0a0a0a;
}

/* Card title */
.cifras-listing__card-title {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  color: #0a0a0a;
  margin: 0;
}

/* Actions container */
.cifras-listing__card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  gap: 8px 16px;
  width: 100%;
}

/* Card action links */
.cifras-listing__card-preview,
.cifras-listing__card-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  color: #b91c1c;
  text-decoration: none;
  border-radius: 8px;
  height: 36px;
}
.cifras-listing__card-preview:hover,
.cifras-listing__card-download:hover {
  text-decoration: underline;
}

/* ===== TABLE VIEW (Figma: Cuentas Anuales) ===== */

/* Table container */
.cifras-listing__table-container {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 20px;
  overflow: hidden;
}

/* Table */
.cifras-listing__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.cifras-listing__table thead th {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  color: #525252;
  text-align: left;
  padding: 10px 16px;
  height: 40px;
  border-bottom: 1px solid #e5e5e5;
  white-space: nowrap;
}
.cifras-listing__table thead th:first-child {
  width: 40%;
}
.cifras-listing__table thead th:nth-child(2) {
  width: 15%;
}
.cifras-listing__table thead th:nth-child(3) {
  width: 20%;
}
.cifras-listing__table thead th:last-child {
  width: 25%;
}

.cifras-listing__table tbody tr {
  height: 52px;
  border-bottom: 1px solid #e5e5e5;
  transition: background 0.15s ease;
}
.cifras-listing__table tbody tr:last-child {
  border-bottom: none;
}
.cifras-listing__table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}
.cifras-listing__table tbody td {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  color: #0a0a0a;
  padding: 0 16px;
  vertical-align: middle;
}

/* Table badge (idioma) */
.cifras-listing__table-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 4px 8px;
}
.cifras-listing__table-badge .cifras-listing__flag {
  flex-shrink: 0;
}
.cifras-listing__table-badge-text {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  color: #0a0a0a;
}

/* Table actions container */
.cifras-listing__table-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Table download link */
.cifras-listing__table-preview,
.cifras-listing__table-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  color: #b91c1c;
  text-decoration: none;
  cursor: pointer;
}
.cifras-listing__table-preview:hover,
.cifras-listing__table-download:hover {
  text-decoration: underline;
}
.cifras-listing__table-preview svg,
.cifras-listing__table-download svg {
  flex-shrink: 0;
}

/* Pagination bottom bar with "Mostrando" */
.cifras-listing__pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
}
.cifras-listing__pagination-showing {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #0a0a0a;
}
.cifras-listing__pagination-showing select {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #0a0a0a;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  height: 36px;
  padding: 8px 28px 8px 12px;
  appearance: none;
  cursor: pointer;
  box-shadow: 0px 1px 2px rgba(0,0,0,0.05);
}
.cifras-listing__pagination-nav {
  display: flex;
  align-items: center;
  gap: 0;
}

/* Hide table in grid mode, hide grid in list/table mode */
.cifras-listing__grid-area[data-view="table"] .cifras-listing__grid {
  display: none !important;
}
.cifras-listing__grid-area[data-view="table"] .cifras-listing__table-container {
  display: block;
}
.cifras-listing__grid-area:not([data-view="table"]) .cifras-listing__table-container {
  display: none;
}

/* Empty state */
.cifras-listing__empty {
  text-align: center;
  padding: 48px 16px;
  color: #525252;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
}

/* Pagination */
.cifras-listing__pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding-top: 16px;
}
.cifras-listing__page-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  border-radius: 8px;
  height: 36px;
  padding: 8px 16px 8px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #0a0a0a;
  cursor: pointer;
}
.cifras-listing__page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.cifras-listing__page-btn--prev {
  padding: 8px 16px 8px 10px;
}
.cifras-listing__page-btn--next {
  padding: 8px 10px 8px 16px;
  background: #f1f5f9; /* Match screenshot grey background */
}
.cifras-listing__page-numbers {
  display: flex;
  align-items: center;
  gap: 0;
}
.cifras-listing__page-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #0a0a0a;
  cursor: pointer;
}
.cifras-listing__page-num--active {
  background: #f5f5f5;
  color: #b91c1c;
  border: none;
  box-shadow: none;
}

/* Responsive */
@media (max-width: 1024px) {
  .cifras-listing__content {
    flex-direction: column;
  }
  .cifras-listing__sidebar {
    width: 100%;
  }
  .cifras-listing__grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cifras-listing__topbar {
    flex-direction: column;
    gap: 16px;
  }
  .cifras-listing__tabs {
    flex-wrap: wrap;
  }
  .cifras-hero__container,
  .cifras-listing__container {
    padding: 0 16px;
  }
  .cifras-listing__table-container {
    border-radius: 12px;
    padding: 12px;
  }
  .cifras-listing__table thead th,
  .cifras-listing__table tbody td {
    padding: 0 8px;
    font-size: 14px;
  }
  .cifras-listing__pagination-bar {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
}
@media (max-width: 640px) {
  /* 2-column card grid on mobile */
  .cifras-listing__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  /* Compact cards for 2-col layout */
  .cifras-listing__card {
    padding: 12px;
  }

  .cifras-listing__card-title {
    font-size: 13px;
    line-height: 18px;
  }

  .cifras-listing__card-download {
    font-size: 12px;
  }

  .cifras-hero__title {
    font-size: 28px;
    line-height: 36px;
  }
  .cifras-listing__table thead th:nth-child(2),
  .cifras-listing__table tbody td:nth-child(2) {
    display: none;
  }
  .cifras-listing__table thead th:nth-child(3),
  .cifras-listing__table tbody td:nth-child(3) {
    display: none;
  }
}

/* ==========================================================================
   Mobile collapsible filters toggle
   ========================================================================== */

/* Toggle button — hidden on desktop */
.cifras-filters-toggle {
  display: none;
}

@media (max-width: 768px) {
  /* Show the toggle button */
  .cifras-filters-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: #f9fafb;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #0a0a0a;
    cursor: pointer;
    margin-bottom: 0;
    transition: background 0.15s ease;
    order: -1; /* Appear before the sidebar */
  }

  .cifras-filters-toggle:hover {
    background: #f3f4f6;
  }

  .cifras-filters-toggle__label {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .cifras-filters-toggle__chevron {
    transition: transform 0.25s ease;
    flex-shrink: 0;
  }

  .cifras-filters-toggle[aria-expanded="true"] .cifras-filters-toggle__chevron {
    transform: rotate(180deg);
  }

  /* Make content area a column layout for mobile */
  .cifras-listing__content {
    flex-direction: column;
  }

  /* Sidebar becomes full-width and collapsible */
  .cifras-listing__sidebar {
    width: 100%;
  }

  /* Filters panel hidden by default on mobile */
  .cifras-listing__filters {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.2s ease;
    padding-top: 0;
    padding-bottom: 0;
  }

  /* Expanded state */
  .cifras-listing__filters.is-open {
    max-height: 800px;
    padding-top: 16px;
    padding-bottom: 8px;
  }
}

