/* ==========================================================================
   BLOCK FUNDOS RPPS - BASE
   ========================================================================== */

.block-fundos-rpps {
  text-align: center;
}

.block-fundos-rpps .xp-button {
  border: solid 2px black !important;
  background-color: white !important;
  color: rgba(18, 18, 18, 1) !important;
  font-size: 16px !important;
}

.block-fundos-rpps .xp-button.hidden {
  display: none;
}

.block-fundos-rpps .file-icon {
  content: '';
  display: block;
  width: 30px;
  height: 25px;
  position: relative;
  background-image: url('../../../public/assets/icons/xp/file-text.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 1.5rem;
  padding: 15px 20px;
  cursor: pointer;
}

.block-fundos-rpps.inverse .file-icon,
.block-fundos-rpps.inverse .download-icon {
  filter: invert(95%) sepia(95%) saturate(21%) hue-rotate(327deg) brightness(105%) contrast(107%);
}

.block-fundos-rpps .download-icon {
  content: '';
  display: block;
  width: 30px;
  height: 25px;
  position: relative;
  background-image: url('../../../public/assets/icons/xp/download.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 1.5rem;
  padding: 15px 20px;
  cursor: pointer;
}

.table-container {
  margin-bottom: 40px;
}

.xp-error-message {
  font-size: 1.5em;
  text-align: center;
  margin: 20px 0;
}

/* ==========================================================================
   MODAL DE DOCUMENTOS
   ========================================================================== */

.xp-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.xp-modal.is-hidden {
  display: none;
}

.xp-modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.xp-modal__dialog {
  position: relative;
  background-color: #fff;
  border-radius: 8px;
  padding: 32px;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.xp-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 0;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.xp-modal__close::before,
.xp-modal__close::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background-color: rgba(102, 102, 102, 1);
  transition: background-color 0.2s ease;
}

.xp-modal__close::before {
  transform: rotate(45deg);
}

.xp-modal__close::after {
  transform: rotate(-45deg);
}

.xp-modal__close:hover::before,
.xp-modal__close:hover::after {
  background-color: rgba(18, 18, 18, 1);
}

.xp-modal__title {
  font-size: 24px;
  text-align: left;
  font-weight: 600;
  color: rgba(18, 18, 18, 1);
  margin: 0 0 8px 0;
}

.xp-modal__desc {
  text-align: left;
  font-size: 14px;
  color: rgba(102, 102, 102, 1);
  margin: 0 0 16px 0;
}
.xp-modal__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.xp-modal__actions {
  margin: 0 0 24px 0;
  display: flex;
  justify-content: flex-start;
  gap: 12px;
}

.xp-download-all-btn:disabled {
  background-color: #ccc !important;
  color: #666666 !important;
  border: none !important;
  cursor: not-allowed;
}

.xp-modal__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  display: block;
}

.xp-modal__table thead {
  display: block;
  width: 100%;
}

.xp-modal__table tbody {
  display: block;
  max-height: 300px;
  overflow-y: auto;
  width: 100%;
}

.xp-modal__table thead tr,
.xp-modal__table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.xp-modal__table thead th:first-child {
  width: 7%;
}

.xp-modal__table thead th:last-child {
  width: 10%;
}

.xp-modal__table thead th {
  width: 80%;
  text-align: left;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(18, 18, 18, 1);
  border-bottom: 2px solid #e0e0e0;
}

.xp-modal__table tbody td:first-child {
  width: 7%;
}
.xp-modal__table tbody td:last-child {
  width: 10%;
}
.xp-modal__table tbody td {
  width: 80%;
  padding: 10px;
  font-size: 14px;
  color: rgba(102, 102, 102, 1);
  border-bottom: 1px solid #f0f0f0;
}

.xp-modal__table tbody tr:last-child td {
  border-bottom: none;
}

.xp-modal__table tbody tr:hover {
  background-color: #f9f9f9;
}

.xp-download-link {
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(251, 193, 5, 1);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.xp-download-link:hover {
  opacity: 0.8;
}

.xp-download-link .download-icon {
  padding: 0;
  width: 24px;
  height: 24px;
  filter: none;
}

.xp-modal__table input[type="checkbox"] {
  appearance: none;
  display: flex;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  height: 24px;
  width: 24px;
  border-radius: 0;
  border-width: 2px;
  border-style: solid;
  outline: transparent solid 2px;
  outline-offset: 0;
  cursor: pointer;
}
.xp-modal__table input[type="checkbox"]:checked {
  background-color: rgb(18, 18, 18);
}
.xp-modal__table input[type="checkbox"]:checked:before {
  transform: scale(1);
}
.xp-modal__table input[type="checkbox"]:before {
  content: "";
  width: 100%;
  clip-path: polygon(17% 54%, 28% 43%, 38% 54%, 70% 22%, 81% 33%, 38% 75%, 17% 54%);
  transform: scale(0);
  background-color: rgb(255, 255, 255);
}
.xp-modal__close-btn {
  margin-right: 10px;
}
.xp-modal__download-selected-files {
  color: #666666;
  font-size: 12px;
}

@media (max-width: 600px) {
  .xp-modal__footer {
    display: block;
    text-align: left;
  }
  .xp-modal__table thead th:first-child {
    width: 10%;
  }

  .xp-modal__table thead th:last-child {
    width: 20%;
  }

  .xp-modal__table thead th {
    width: 70%;
  }
  .xp-modal__download-selected-files {
    margin-bottom: 15px;
  }
  .xp-modal__table tbody td:first-child {
    width: 10%;
  }
  .xp-modal__table tbody td:last-child {
    width: 20%;
  }
  .xp-modal__table tbody td {
    width: 70%;
  }
  .xp-modal__close-btn {
    margin-bottom: 15px;
  }
}
/* ==========================================================================
   TABELA DESKTOP - GRID LAYOUT
   ========================================================================== */

.xp-ativos-table {
  display: grid;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background-color: #fff;
}

/* Grid columns: Fundos(40) + 11 colunas variadas */
.xp-ativos-table .table-header-top,
.xp-ativos-table .table-header,
.xp-ativos-table .table-row {
  grid-template-columns: 40fr 20fr 17fr 17fr 10fr 10fr 10fr 12fr 12fr 15fr 20fr 10fr;
}

/* Header Superior */
.xp-ativos-table .table-header-top {
  display: grid;
}

.xp-ativos-table .table-header-top .header-cell {
  padding: 12px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: rgba(18, 18, 18, 1);
}

.xp-ativos-table .table-header-top .header-span-5 {
  grid-column: span 5;
}

/* Header de Colunas */
.xp-ativos-table .table-header {
  display: grid;
  align-items: left;
  border-bottom: 2px solid #ddd;
}

.xp-ativos-table .table-header .header-cell {
  padding: 12px 8px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: rgba(18, 18, 18, 1);
}

/* Header Sortable */
.xp-ativos-table .header-cell.sortable {
  cursor: pointer;
  display: flex;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  transition: background-color 0.2s ease;
}

.xp-ativos-table .header-cell.sortable:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.xp-ativos-table .header-cell.sortable .sort-indicator {
  position: relative;
  padding-left: 10px;
  top: 1px;
  opacity: 0.3;
  font-size: 0.9em;
  transition: opacity 0.2s ease;
}

.xp-ativos-table .header-cell.sortable:hover .sort-indicator {
  opacity: 0.6;
}

.xp-ativos-table .header-cell.sort-asc .sort-indicator,
.xp-ativos-table .header-cell.sort-desc .sort-indicator {
  opacity: 1;
  font-weight: bold;
  color: #121212;
}

/* Body e Linhas */
.xp-ativos-table .table-body {
  display: contents;
}

.xp-ativos-table .table-row {
  display: grid;
  border-bottom: 1px solid #e0e0e0;
  transition: background-color 0.2s ease;
}

.xp-ativos-table .table-row:hover {
  background-color: #f9f9f9;
}

.xp-ativos-table .table-row:last-child {
  border-bottom: none;
}

/* Células */
.xp-ativos-table .table-cell {
  padding: 10px 8px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: rgba(102, 102, 102, 1);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

/* Coluna de Fundos */
.assets {
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: flex-start !important;
  text-align: left !important;
}

.assets-classification {
  font-size: 12px;
  color: rgba(102, 102, 102, 1);
  font-weight: 400;
}

/* Botões */
.xp-ativos-table .button {
  background-color: rgba(251, 193, 5, 1) !important;
  font-weight: 500;
  color: rgba(18, 18, 18, 1) !important;
}

/* Título de rentabilidade - escondido no desktop */
.xp-ativos-table .rentability-title-mobile {
  display: none;
}

/* ==========================================================================
   SKELETON LOADING
   ========================================================================== */

.xp-ativos-table.table-skeleton {
  width: 100%;
  border-collapse: collapse;
}

.xp-ativos-table.table-skeleton tr {
  border-bottom: 1px solid #ddd;
}

.skeleton-body, 
.skeleton-header {
  display: inline-block;  
  height: auto;
  width: 100%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 37%, #f0f0f0 63%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-block {
  display: inline-block;
  height: 46px;
  width: 100%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ==========================================================================
   RESPONSIVIDADE
   ========================================================================== */

/* Tablets: scroll horizontal */
@media (max-width: 1200px) {
  .xp-ativos-table {
    overflow-x: auto;
  }
}

/* Mobile: Cards */
@media (max-width: 1024px) {
  .xp-ativos-table {
    display: block;
    overflow-x: visible;
    border: 0;
  }
  
  /* Esconder headers */
  .xp-ativos-table .table-header-top,
  .xp-ativos-table .table-header {
    display: none;
  }
  
  .xp-ativos-table .table-body {
    display: block;
  }
  
  /* Cards */
  .xp-ativos-table .table-row {
    display: block;
    margin-bottom: 20px;
    padding: 16px;
    border-bottom: none;
    background-color: #fff;
  }
  
  /* Background alternado */
  .xp-ativos-table .table-row:nth-child(even) {
    background-color: rgba(247, 247, 248, 1);
  }
  
  .xp-ativos-table .table-row:hover {
    background-color: inherit;
  }
  
  /* Células como blocos verticais */
  .xp-ativos-table .table-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 0;
    border: none;
    text-align: left;
    justify-content: flex-start;
    align-items: flex-start;
    font-size: 16px;
    font-weight: 400;
    color: rgba(18, 18, 18, 1);
  }
  
  /* Labels acima do conteúdo */
  .xp-ativos-table .table-cell::before{
    content: attr(data-label);
    font-weight: 400;
    color: rgba(102, 102, 102, 1);
    font-size: 16px;
    letter-spacing: 0.5px;
  }
  
  /* Coluna Fundos sem label */
  .xp-ativos-table .table-cell:first-child::before {
    content: none;
  }
  
  .xp-ativos-table .table-cell.assets {
    font-weight: 500;
    color: rgba(18, 18, 18, 1);
  }
  
  /* Título de Rentabilidade */
  .xp-ativos-table .rentability-title-mobile {
    display: block;
    padding-top: 16px;
    font-size: 16px;
    letter-spacing: 0.5px;
    color: rgba(102, 102, 102, 1);
    text-align: left;
  }
  
  /* Células de rentabilidade em grid horizontal */
  .xp-ativos-table .table-cell[data-label="Mês"],
  .xp-ativos-table .table-cell[data-label="Ano"],
  .xp-ativos-table .table-cell[data-label="12M"],
  .xp-ativos-table .table-cell[data-label="24M"],
  .xp-ativos-table .table-cell[data-label="36M"] {
    display: inline-flex;
    width: calc(20% - 7px);
    margin-right: 4px;
    align-items: flex-start;
    text-align: left;
    padding: 8px 0;
  }
  
  .xp-ativos-table .table-cell[data-label="36M"] {
    margin-right: 0;
  }
  
  .xp-ativos-table .table-cell[data-label="Mês"]::before,
  .xp-ativos-table .table-cell[data-label="Ano"]::before,
  .xp-ativos-table .table-cell[data-label="12M"]::before,
  .xp-ativos-table .table-cell[data-label="24M"]::before,
  .xp-ativos-table .table-cell[data-label="36M"]::before {
    width: 100%;
    text-align: left;
  }
  

  .xp-ativos-table .table-cell[data-label=""]:not(:first-child)::before {
    content: none;
  }
  
  /* Botão investir full width */
  .xp-ativos-table .table-cell .button {
    width: 100%;
    text-align: center;
    padding: 12px 24px;
    font-size: 14px !important;
  }
  
  /* Esconder célula de documentos */
  .xp-ativos-table .table-cell[data-label="Documentos"] {
    display: none;
  }
  
  /* Classe time com flex */
  .time {
    display: flex;
    gap: 3px;
  }
}