/* ═════════════════════════════════════════════════════════════════════════════ */
/*                      DATA TABLE & GRID SYSTEM — STYLES                        */
/*                  Tabelas com sorting, pagination, grid view                  */
/* ═════════════════════════════════════════════════════════════════════════════ */

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          DATA TABLE BASE                                     */
/* ═════════════════════════════════════════════════════════════════════════════ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  background: white;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          TABLE HEADER                                        */
/* ═════════════════════════════════════════════════════════════════════════════ */

.data-table thead {
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
}

.data-table th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-weight: 600;
  color: #1f2937;
  font-size: 0.95rem;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          SORT BUTTON                                         */
/* ═════════════════════════════════════════════════════════════════════════════ */

.table-sort-btn {
  background: none;
  border: none;
  border-radius: 12px;
  color: #1f2937;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
  transition: color 0.2s ease;
}

.table-sort-btn:hover {
  color: #3caa6e;
}

.sort-icon {
  font-size: 0.75rem;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.table-sort-btn:hover .sort-icon {
  opacity: 1;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          TABLE BODY                                          */
/* ═════════════════════════════════════════════════════════════════════════════ */

.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  color: #374151;
  font-size: 0.95rem;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

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

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          TABLE VARIANTS                                      */
/* ═════════════════════════════════════════════════════════════════════════════ */

/* Striped rows */
.data-table.table-striped tbody tr:nth-child(odd) {
  background: #f9fafb;
}

/* Hoverable rows */
.data-table.table-hoverable tbody tr:hover {
  background: #f3f4f6;
  box-shadow: inset 0 0 0 1px #e5e7eb;
}

.data-table.table-striped.table-hoverable tbody tr:nth-child(odd):hover {
  background: #eff0f2;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          CHECKBOX CELLS                                      */
/* ═════════════════════════════════════════════════════════════════════════════ */

.data-table input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #3caa6e;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          PAGINATION                                          */
/* ═════════════════════════════════════════════════════════════════════════════ */

.table-pagination,
.grid-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

.page-info {
  color: #6b7280;
  font-size: 0.95rem;
  min-width: 150px;
  text-align: center;
}

.table-pagination .btn,
.grid-pagination .btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

.table-pagination .btn:disabled,
.grid-pagination .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          GRID VIEW                                           */
/* ═════════════════════════════════════════════════════════════════════════════ */

.grid-view {
  display: grid;
  gap: 1.5rem;
  width: 100%;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

.grid-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

.grid-card:hover {
  border-color: #3caa6e;
  box-shadow: 0 8px 24px rgba(60, 170, 110, 0.15);
  transform: translateY(-4px);
}

.card-content {
  color: #374151;
  line-height: 1.6;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

.grid-card img {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 1rem;
  object-fit: cover;
}

.grid-card h3 {
  margin: 0.5rem 0;
  font-size: 1.1rem;
  color: #1f2937;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

.grid-card p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: #6b7280;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          DARK MODE                                           */
/* ═════════════════════════════════════════════════════════════════════════════ */

:root[data-theme="dark"] .data-table {
  background: #111b3c;
  border-color: rgba(148, 163, 184, 0.1);
  color: #e8ecf1;
}

:root[data-theme="dark"] .data-table thead {
  background: #0f1729;
  border-bottom-color: rgba(148, 163, 184, 0.1);
}

:root[data-theme="dark"] .data-table th {
  color: #e8ecf1;
}

:root[data-theme="dark"] .table-sort-btn {
  color: #e8ecf1;
}

:root[data-theme="dark"] .table-sort-btn:hover {
  color: #34d399;
}

:root[data-theme="dark"] .data-table td {
  border-bottom-color: rgba(148, 163, 184, 0.1);
  color: #a0aec0;
}

:root[data-theme="dark"] .data-table.table-striped tbody tr:nth-child(odd) {
  background: #0f1729;
}

:root[data-theme="dark"] .data-table.table-hoverable tbody tr:hover {
  background: #1a2548;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.1);
}

:root[data-theme="dark"] .data-table.table-striped.table-hoverable tbody tr:nth-child(odd):hover {
  background: #1a2548;
}

:root[data-theme="dark"] .data-table input[type="checkbox"] {
  accent-color: #34d399;
}

:root[data-theme="dark"] .page-info {
  color: #64748b;
}

:root[data-theme="dark"] .grid-card {
  background: #111b3c;
  border-color: rgba(148, 163, 184, 0.1);
}

:root[data-theme="dark"] .grid-card:hover {
  border-color: #34d399;
  box-shadow: 0 8px 24px rgba(52, 211, 153, 0.15);
}

:root[data-theme="dark"] .card-content {
  color: #a0aec0;
}

:root[data-theme="dark"] .grid-card h3 {
  color: #e8ecf1;
}

:root[data-theme="dark"] .grid-card p {
  color: #64748b;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          RESPONSIVE                                          */
/* ═════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .data-table th,
  .data-table td {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  .table-sort-btn {
    font-size: 0.9rem;
  }

  .grid-view {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .data-table {
    font-size: 0.9rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem;
  }

  .table-sort-btn {
    flex-wrap: wrap;
    font-size: 0.85rem;
  }

  .sort-icon {
    display: none;
  }

  /* Transformar tabela para mobile (stack layout) */
  .data-table tbody tr {
    display: block;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
  }

  .data-table td {
    display: block;
    text-align: right;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    float: left;
    color: #1f2937;
  }

  .data-table.table-striped tbody tr:nth-child(odd) {
    background: white;
  }

  .data-table.table-hoverable tbody tr:hover {
    background: white;
  }

  .grid-view {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }

  .grid-card {
    padding: 1rem;
  }

  .table-pagination,
  .grid-pagination {
    gap: 0.5rem;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .grid-view {
    grid-template-columns: 1fr;
  }

  .page-info {
    width: 100%;
    order: 3;
    min-width: 100%;
  }
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          ACESSIBILIDADE                                      */
/* ═════════════════════════════════════════════════════════════════════════════ */

.table-sort-btn:focus,
.table-pagination .btn:focus,
.grid-pagination .btn:focus {
  outline: 2px solid #3caa6e;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .grid-card,
  .table-pagination .btn,
  .grid-pagination .btn {
    transition: none;
  }
}
