/* Estilos do Frontend */
.risc-downloads-wrapper {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}

.risc-notices-wrapper {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}

/* Campo de busca */
.risc-downloads-search {
  margin-bottom: 25px;
}

.risc-downloads-search input {
  width: 100%;
  padding: 14px 20px;
  background: rgba(76, 175, 80, 0.08);
  border: 2px solid rgba(76, 175, 80, 0.3);
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s ease;
}

.risc-downloads-search input::placeholder {
  color: rgba(46, 125, 50, 0.6);
}

.risc-downloads-search input:focus {
  outline: none;
  background: #fff;
  border-color: #4caf50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Tabela de downloads */
.risc-downloads-table-wrapper {
  overflow-x: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.risc-downloads-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.risc-downloads-table thead {
  background: #2e7d32;
  color: #fff;
}

.risc-downloads-table th {
  padding: 18px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.risc-downloads-table td {
  padding: 18px 20px;
  border-bottom: 1px solid #e8e8e8;
  font-size: 15px;
  color: #333;
  vertical-align: middle;
}

.risc-downloads-table tbody tr {
  transition: background 0.2s ease;
}

.risc-downloads-table tbody tr:hover {
  background: #e8f5e9;
}

.risc-downloads-table tbody tr:last-child td {
  border-bottom: none;
}

.risc-document-cell {
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 40px;
}

.risc-file-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.risc-document-cell span {
  font-weight: 500;
  color: #1b5e20;
}

/* Botão de download */
.risc-download-btn {
  display: inline-block;
  background: #4caf50;
  color: #fff !important;
  padding: 10px 24px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  border: 2px solid #4caf50;
}

.risc-download-btn:hover {
  background: #388e3c;
  border-color: #388e3c;
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.risc-download-btn:active {
  transform: translateY(0);
}

/* Mensagem de nenhum resultado */
.risc-no-results {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 16px;
  font-style: italic;
}

/* Editais e Processos */
.risc-notices-content {
  display: grid;
  gap: 26px;
}

.risc-notices-year-group {
  display: grid;
  gap: 14px;
}

.risc-notices-year-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 8px 16px;
  border-radius: 999px;
  background: #2e7d32;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.risc-notices-year-list {
  display: grid;
  gap: 10px;
}

.risc-notice-card {
  border: 1px solid #dce8dd;
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(27, 94, 32, 0.08);
}

.risc-notice-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
}

.risc-notice-summary::-webkit-details-marker {
  display: none;
}

.risc-notice-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.risc-notice-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
  color: #1b5e20;
}

.risc-notice-summary-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.risc-notice-date,
.risc-notice-count {
  color: #2e7d32;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.risc-notice-count {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(129, 199, 132, 0.16);
}

.risc-notice-toggle {
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: #2e7d32;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.risc-notice-card[open] .risc-notice-toggle {
  transform: rotate(225deg);
}

.risc-notice-panel {
  overflow: hidden;
  height: auto;
}

.risc-notice-panel-inner {
  padding: 0 18px 14px;
  border-top: 1px solid #edf4ee;
}

.risc-notice-description {
  margin: 10px 0 12px;
  color: #4e5d51;
  font-size: 13px;
  line-height: 1.45;
}

.risc-notice-description p:last-child {
  margin-bottom: 0;
}

.risc-notice-documents {
  display: grid;
  gap: 10px;
}

.risc-notice-document {
  position: relative;
  border: 1px solid #dce8dd;
  border-radius: 12px;
  background: #fcfefc;
  padding: 10px 12px;
}

.risc-notice-document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

.risc-notice-document-main {
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.risc-notice-document-content {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.risc-notice-document .risc-file-icon {
  width: 26px;
  height: 26px;
}

.risc-notice-document-name {
  display: block;
  font-size: 13px;
  line-height: 1.2;
}

.risc-notice-document-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 2px 4px;
  border-radius: 999px;
  background: rgba(129, 199, 132, 0.22);
  color: #1b5e20;
  font-size: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.risc-notice-document-date {
  color: #2e7d32;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.risc-notice-download-btn {
  padding: 6px 12px;
  font-size: 12px;
  border-width: 1px;
  box-shadow: none;
}

.risc-notice-document.is-complementary {
  margin-left: 22px;
  background: #f8fcf8;
}

.risc-notice-document.is-complementary::before {
  content: "->";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  color: #2e7d32;
  font-size: 14px;
  font-weight: 700;
}

/* Responsividade */
@media (max-width: 768px) {
  .risc-downloads-table {
    font-size: 14px;
  }

  .risc-downloads-table th,
  .risc-downloads-table td {
    padding: 12px 15px;
  }

  .risc-downloads-table th {
    font-size: 14px;
  }

  .risc-file-icon {
    width: 32px;
    height: 32px;
  }

  .risc-document-cell {
    gap: 10px;
  }

  .risc-download-btn {
    padding: 8px 16px;
    font-size: 13px;
  }

  .risc-notice-card {
    border-radius: 14px;
  }

  .risc-notice-heading,
  .risc-notice-summary-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .risc-notice-title {
    font-size: 13px;
  }

  .risc-notice-summary {
    padding: 13px 15px;
  }

  .risc-notice-panel-inner {
    padding: 0 15px 13px;
  }

  .risc-notice-document-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .risc-notice-document-main {
    align-items: center;
  }

  .risc-notice-document.is-complementary {
    margin-left: 16px;
  }

  .risc-notice-document.is-complementary::before {
    left: -12px;
  }
}

@media (max-width: 576px) {
  /* Layout em cards para mobile */
  .risc-downloads-table thead {
    display: none;
  }

  .risc-downloads-table,
  .risc-downloads-table tbody,
  .risc-downloads-table tr,
  .risc-downloads-table td {
    display: block;
    width: 100%;
  }

  .risc-downloads-table tr {
    margin-bottom: 20px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
  }

  .risc-downloads-table td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    padding-left: 50%;
  }

  .risc-downloads-table td:last-child {
    border-bottom: none;
  }

  .risc-downloads-table td:before {
    content: attr(data-label);
    position: absolute;
    left: 15px;
    font-weight: 600;
    color: #1b5e20;
  }

  .risc-document-cell {
    justify-content: flex-start;
  }

  .risc-download-btn {
    width: 100%;
    text-align: center;
  }

  .risc-notices-wrapper {
    padding: 0 12px;
  }

  .risc-notices-year-title {
    font-size: 18px;
    padding: 7px 12px;
  }

  .risc-notice-card {
    border-radius: 14px;
  }

  .risc-notice-title {
    font-size: 12px;
  }

  .risc-notice-description {
    font-size: 12px;
  }

  .risc-notice-document {
    padding: 10px;
  }

  .risc-notice-document.is-complementary {
    margin-left: 10px;
  }

  .risc-notice-document.is-complementary::before {
    left: -12px;
    font-size: 14px;
  }
}

/* ============================================================
   RISC Downloads — ajustes finais de leveza visual e segurança de layout
   ============================================================ */
.risc-downloads-wrapper,
.risc-notices-wrapper,
.risc-downloads-wrapper *,
.risc-notices-wrapper * {
  box-sizing: border-box;
}

.risc-downloads-wrapper,
.risc-notices-wrapper {
  width: 100%;
  max-width: 1120px;
  overflow-x: hidden;
}

@supports (overflow: clip) {
  .risc-downloads-wrapper,
  .risc-notices-wrapper {
    overflow-x: clip;
  }
}

.risc-downloads-search input,
.risc-downloads-table,
.risc-notice-card,
.risc-notice-document {
  max-width: 100%;
}

.risc-document-cell,
.risc-notice-document-main,
.risc-notice-title,
.risc-notice-document-name {
  min-width: 0;
}

.risc-document-cell span,
.risc-notice-title,
.risc-notice-document-name {
  overflow-wrap: anywhere;
}

.risc-download-btn:focus-visible,
.risc-search-input:focus-visible,
.risc-notice-summary:focus-visible {
  outline: 3px solid rgba(76, 175, 80, 0.28);
  outline-offset: 3px;
}

/* Mobile mais planejado: documentos em lista compacta, não cards gigantes */
@media (max-width: 576px) {
  .risc-downloads-wrapper,
  .risc-notices-wrapper {
    margin: 22px auto;
    padding: 0 14px;
  }

  .risc-downloads-search {
    margin-bottom: 16px;
  }

  .risc-downloads-search input {
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
  }

  .risc-downloads-table-wrapper {
    overflow: visible;
    border-radius: 16px;
    box-shadow: none;
    background: transparent;
  }

  .risc-downloads-table {
    display: block;
    background: transparent;
  }

  .risc-downloads-table tbody {
    display: grid;
    gap: 12px;
  }

  .risc-downloads-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 12px;
    border: 1px solid #e7eee8;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(27, 94, 32, 0.07);
    overflow: hidden;
  }

  .risc-downloads-table td {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
  }

  .risc-downloads-table td::before {
    content: none !important;
  }

  .risc-downloads-table td:nth-child(1) {
    grid-column: 1 / -1;
  }

  .risc-downloads-table td:nth-child(2) {
    grid-column: 1 / 2;
    color: #69786c;
    font-size: 12px;
    line-height: 1.2;
  }

  .risc-downloads-table td:nth-child(3) {
    grid-column: 2 / 3;
    justify-self: end;
  }

  .risc-document-cell {
    gap: 10px;
    align-items: center;
    min-height: auto;
  }

  .risc-file-icon {
    width: 34px;
    height: 34px;
  }

  .risc-document-cell span {
    font-size: 14px;
    line-height: 1.22;
  }

  .risc-download-btn {
    width: auto;
    min-width: 96px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.1;
    text-align: center;
    transform: none !important;
  }

  .risc-download-btn:hover {
    transform: none !important;
  }

  .risc-no-results {
    padding: 22px 14px;
    border-radius: 14px;
    background: #fff;
  }

  .risc-notices-content {
    gap: 18px;
  }

  .risc-notices-year-group {
    gap: 10px;
  }

  .risc-notices-year-list {
    gap: 12px;
  }

  .risc-notice-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px 10px;
  }

  .risc-notice-summary-meta {
    display: contents;
  }

  .risc-notice-title {
    grid-column: 1 / 2;
    font-size: 14px;
    line-height: 1.25;
  }

  .risc-notice-date,
  .risc-notice-count {
    grid-column: 1 / 2;
    font-size: 11px;
  }

  .risc-notice-count {
    width: fit-content;
    padding: 4px 8px;
  }

  .risc-notice-toggle {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    margin-top: 4px;
  }

  .risc-notice-document-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
  }

  .risc-notice-document-main {
    grid-column: 1 / -1;
  }

  .risc-notice-document-date {
    grid-column: 1 / 2;
    font-size: 11px;
    white-space: normal;
  }

  .risc-notice-download-btn {
    grid-column: 2 / 3;
    justify-self: end;
  }
}

@media (max-width: 380px) {
  .risc-downloads-wrapper,
  .risc-notices-wrapper {
    padding: 0 12px;
  }

  .risc-downloads-table tr {
    padding: 11px;
  }

  .risc-download-btn {
    min-width: 86px;
    padding-inline: 10px;
  }
}

/* ============================================================
   RISC Downloads 1.1.2 — coluna de data opcional
   Use show_date="0" no shortcode para esconder a data.
   ============================================================ */
.risc-downloads-table--no-date th:nth-child(2),
.risc-downloads-table--no-date td:nth-child(2) {
  text-align: right;
}

@media (max-width: 576px) {
  .risc-downloads-table--no-date tr {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .risc-downloads-table--no-date td:nth-child(1) {
    grid-column: 1 / 2;
  }

  .risc-downloads-table--no-date td:nth-child(2) {
    grid-column: 2 / 3;
    justify-self: end;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
    text-align: right;
  }
}

/* ============================================================
   RISC Downloads 1.1.3 — tabela mais elegante, fina e responsiva
   ============================================================ */
.risc-downloads-wrapper {
  max-width: 980px;
  margin: 22px auto;
  padding: 0 16px;
}

.risc-downloads-search {
  margin-bottom: 14px;
}

.risc-downloads-search input {
  min-height: 42px;
  padding: 10px 14px;
  border-width: 1px;
  border-radius: 12px;
  font-size: 14px;
}

.risc-downloads-table-wrapper {
  border: 1px solid #e2e8e3;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.risc-downloads-table {
  border-collapse: collapse;
  table-layout: auto;
}

.risc-downloads-table th {
  padding: 11px 16px;
  font-size: 12px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: .08em;
}

.risc-downloads-table td {
  padding: 10px 16px;
  font-size: 13px;
  line-height: 1.28;
}

.risc-document-cell {
  gap: 10px;
  min-height: 30px;
}

.risc-file-icon {
  width: 28px;
  height: 28px;
}

.risc-document-cell span {
  font-size: 13px;
  line-height: 1.25;
  font-weight: 600;
}

.risc-download-btn {
  padding: 7px 14px;
  border-width: 1px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.1;
  box-shadow: none;
}

.risc-download-btn:hover {
  transform: translateY(-1px);
}

.risc-downloads-table--with-date th:nth-child(2),
.risc-downloads-table--with-date td:nth-child(2) {
  width: 120px;
  white-space: nowrap;
  font-size: 12px;
}

.risc-downloads-table th:last-child,
.risc-downloads-table td:last-child {
  width: 120px;
  text-align: right;
  white-space: nowrap;
}

.risc-downloads-table--no-date th:last-child,
.risc-downloads-table--no-date td:last-child {
  width: 118px;
}

/* Mobile: lista fina, 2 linhas no máximo, sem tabela gigante */
@media (max-width: 576px) {
  .risc-downloads-wrapper {
    margin: 18px auto;
    padding: 0 12px;
  }

  .risc-downloads-table-wrapper {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent !important;
  }

  .risc-downloads-table,
  .risc-downloads-table tbody {
    display: block;
    width: 100%;
    background: transparent !important;
  }

  .risc-downloads-table tbody {
    display: grid;
    gap: 10px;
  }

  .risc-downloads-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 11px 12px;
    border: 1px solid #e2e8e3;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
  }

  .risc-downloads-table td {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
  }

  .risc-downloads-table td::before {
    content: none !important;
  }

  .risc-downloads-table--with-date td:nth-child(1) {
    grid-column: 1 / -1;
  }

  .risc-downloads-table--with-date td:nth-child(2) {
    grid-column: 1 / 2;
    width: auto;
    color: #64756a;
    font-size: 11px;
    line-height: 1.1;
  }

  .risc-downloads-table--with-date td:nth-child(3) {
    grid-column: 2 / 3;
    justify-self: end;
    width: auto;
  }

  .risc-downloads-table--no-date td:nth-child(1) {
    grid-column: 1 / 2;
  }

  .risc-downloads-table--no-date td:nth-child(2) {
    grid-column: 2 / 3;
    justify-self: end;
    width: auto;
  }

  .risc-document-cell {
    gap: 8px;
  }

  .risc-file-icon {
    width: 26px;
    height: 26px;
  }

  .risc-document-cell span {
    font-size: 12.5px;
    line-height: 1.2;
  }

  .risc-download-btn {
    min-width: 84px;
    padding: 7px 10px;
    font-size: 11px;
    text-align: center;
  }
}

@media (max-width: 380px) {
  .risc-downloads-table tr {
    padding: 10px;
  }

  .risc-download-btn {
    min-width: 76px;
    padding-inline: 9px;
  }
}
