/**
 * @file
 * Property view table styles - Horizontal scroll with sticky columns.
 *
 * Shared by propiedades, residencial, suelo, terciario, anexos, and inversiones_alternativas views.
 * Design inspired by chalecoairbagmoto.es comparison tables.
 * Provides professional table layout for viewing 34+ columns of property data.
 */

/* ========================================
 * HORIZONTAL SCROLL CONTAINER
 * ======================================== */

.table-scroll-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  position: relative;
  margin-bottom: var(--space-lg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg); /* 12px - more rounded */
  background: var(--color-white);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 0 0 1px rgba(0, 0, 0, 0.02);
}

/* ========================================
 * TABLE BASE
 * ======================================== */

.propiedades-table,
.residencial-table,
.suelo-table,
.terciario-table,
.anexos-table,
.inversiones-alternativas-table {
  width: auto; /* Don't force 100% width */
  min-width: 100%; /* But ensure it fills container */
  border-collapse: separate; /* Needed for sticky columns */
  border-spacing: 0;
  margin-bottom: 0;
  background: var(--color-white);
}

/* ========================================
 * HEADER STYLING - Dark Professional Look
 * ======================================== */

.propiedades-table thead,
.residencial-table thead,
.suelo-table thead,
.terciario-table thead,
.anexos-table thead,
.inversiones-alternativas-table thead {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  border-bottom: 2px solid var(--color-peach); /* #E8C4B8 accent */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.propiedades-table th,
.residencial-table th,
.suelo-table th,
.terciario-table th,
.anexos-table th,
.inversiones-alternativas-table th {
  background: linear-gradient(180deg, #223a52 0%, #2d4a63 100%);
  color: var(--color-white);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  text-align: center;
  padding: var(--space-xs) 6px;
  border: none;
  white-space: nowrap;
  min-width: 120px;
  line-height: var(--line-height-tight);
  vertical-align: middle;
  transition: background var(--transition-fast);
}

/* Sortable column headers */
.propiedades-table th a,
.residencial-table th a,
.suelo-table th a,
.terciario-table th a,
.anexos-table th a,
.inversiones-alternativas-table th a {
  color: var(--color-white);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  transition: all var(--transition-fast);
  position: relative;
}

.propiedades-table th a:hover,
.residencial-table th a:hover,
.suelo-table th a:hover,
.terciario-table th a:hover,
.anexos-table th a:hover,
.inversiones-alternativas-table th a:hover {
  opacity: 1;
  color: var(--color-peach-light);
}

.propiedades-table th a::after,
.residencial-table th a::after,
.suelo-table th a::after,
.terciario-table th a::after,
.anexos-table th a::after,
.inversiones-alternativas-table th a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-peach);
  transform: scaleX(0);
  transition: transform var(--transition-fast);
}

.propiedades-table th a:hover::after,
.residencial-table th a:hover::after,
.suelo-table th a:hover::after,
.terciario-table th a:hover::after,
.anexos-table th a:hover::after,
.inversiones-alternativas-table th a:hover::after {
  transform: scaleX(1);
}

/* Sort indicators */
.propiedades-table th .tablesort,
.residencial-table th .tablesort,
.suelo-table th .tablesort,
.terciario-table th .tablesort,
.anexos-table th .tablesort,
.inversiones-alternativas-table th .tablesort {
  opacity: 0.6;
  font-size: var(--font-size-xs);
  margin-left: var(--space-2xs);
  transition: opacity var(--transition-fast);
}

.propiedades-table th .tablesort--asc,
.propiedades-table th .tablesort--desc,
.residencial-table th .tablesort--asc,
.residencial-table th .tablesort--desc,
.suelo-table th .tablesort--asc,
.suelo-table th .tablesort--desc,
.terciario-table th .tablesort--asc,
.anexos-table th .tablesort--asc,
.inversiones-alternativas-table th .tablesort--asc,
.terciario-table th .tablesort--desc,
.anexos-table th .tablesort--desc,
.inversiones-alternativas-table th .tablesort--desc {
  opacity: 1;
  color: var(--color-peach);
}

.propiedades-table th.is-active,
.residencial-table th.is-active,
.suelo-table th.is-active,
.terciario-table th.is-active,
.anexos-table th.is-active,
.inversiones-alternativas-table th.is-active {
  background: linear-gradient(180deg, #2a4562 0%, #37587a 100%);
}

/* ========================================
 * STICKY FIRST COLUMN
 * ======================================== */

.propiedades-table .sticky-column,
.residencial-table .sticky-column,
.suelo-table .sticky-column,
.terciario-table .sticky-column,
.anexos-table .sticky-column,
.inversiones-alternativas-table .sticky-column {
  position: sticky;
  left: 0;
  z-index: 10;
  background-color: var(--color-white);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    3px 0 8px -2px rgba(0, 0, 0, 0.08),
    2px 0 4px -1px rgba(232, 196, 184, 0.15),
    1px 0 0 0 rgba(0, 0, 0, 0.04);
}

/* Header sticky column needs higher z-index and dark background */
.propiedades-table thead .sticky-column,
.residencial-table thead .sticky-column,
.suelo-table thead .sticky-column,
.terciario-table thead .sticky-column,
.anexos-table thead .sticky-column,
.inversiones-alternativas-table thead .sticky-column {
  z-index: 30;
  background: linear-gradient(180deg, #223a52 0%, #2d4a63 100%);
  box-shadow:
    3px 0 10px -2px rgba(0, 0, 0, 0.15),
    2px 0 6px -1px rgba(232, 196, 184, 0.2);
}

/* ========================================
 * DATA ROWS - Alternating Colors
 * ======================================== */

.propiedades-table tbody tr,
.residencial-table tbody tr,
.suelo-table tbody tr,
.terciario-table tbody tr,
.anexos-table tbody tr,
.inversiones-alternativas-table tbody tr {
  transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  cursor: pointer;
}

.propiedades-table tbody tr:last-child,
.residencial-table tbody tr:last-child,
.suelo-table tbody tr:last-child,
.terciario-table tbody tr:last-child,
.anexos-table tbody tr:last-child,
.inversiones-alternativas-table tbody tr:last-child {
  border-bottom: none;
}

/* Alternating row colors for readability */
.propiedades-table tbody tr:nth-child(odd),
.residencial-table tbody tr:nth-child(odd),
.suelo-table tbody tr:nth-child(odd),
.terciario-table tbody tr:nth-child(odd),
.anexos-table tbody tr:nth-child(odd),
.inversiones-alternativas-table tbody tr:nth-child(odd) {
  background-color: var(--color-bg-cream);
}

.propiedades-table tbody tr:nth-child(even),
.residencial-table tbody tr:nth-child(even),
.suelo-table tbody tr:nth-child(even),
.terciario-table tbody tr:nth-child(even),
.anexos-table tbody tr:nth-child(even),
.inversiones-alternativas-table tbody tr:nth-child(even) {
  background-color: var(--color-white);
}

/* Elegant hover effect with gradient and lift */
.propiedades-table tbody tr:hover,
.residencial-table tbody tr:hover,
.suelo-table tbody tr:hover,
.terciario-table tbody tr:hover,
.anexos-table tbody tr:hover,
.inversiones-alternativas-table tbody tr:hover {
  background: linear-gradient(90deg,
    rgba(232, 196, 184, 0.08) 0%,
    rgba(232, 196, 184, 0.12) 50%,
    rgba(232, 196, 184, 0.08) 100%
  );
  transform: translateY(-1px);
  box-shadow:
    0 2px 8px -1px rgba(0, 0, 0, 0.06),
    0 4px 12px -2px rgba(232, 196, 184, 0.15);
  border-top: 1px solid rgba(232, 196, 184, 0.3);
  border-bottom: 1px solid rgba(232, 196, 184, 0.3);
  z-index: 1;
}

/* ========================================
 * DATA CELLS
 * ======================================== */

.propiedades-table td,
.residencial-table td,
.suelo-table td,
.terciario-table td,
.anexos-table td,
.inversiones-alternativas-table td {
  text-align: center;
  padding: 6px;
  border: none;
  font-size: var(--font-size-xs);
  font-family: var(--font-body);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-snug);
  min-width: 120px;
  max-width: 200px;
  white-space: normal;
  word-wrap: break-word;
  vertical-align: middle;
  color: var(--color-text-primary);
}

/* Numeric columns - right-aligned with tabular numbers */
.propiedades-table td.views-field-field-precio,
.propiedades-table td.views-field-field-m2,
.propiedades-table td.views-field-field-precio-m2,
.propiedades-table td.views-field-field-dormitorios,
.propiedades-table td.views-field-field-banos,
.residencial-table td.views-field-field-precio,
.residencial-table td.views-field-field-m2,
.residencial-table td.views-field-field-precio-m2,
.residencial-table td.views-field-field-dormitorios,
.residencial-table td.views-field-field-banos,
.suelo-table td.views-field-field-precio,
.suelo-table td.views-field-field-m2,
.suelo-table td.views-field-field-precio-m2,
.suelo-table td.views-field-field-dormitorios,
.suelo-table td.views-field-field-banos,
.terciario-table td.views-field-field-precio,
.anexos-table td.views-field-field-precio,
.inversiones-alternativas-table td.views-field-field-precio,
.terciario-table td.views-field-field-m2,
.anexos-table td.views-field-field-m2,
.inversiones-alternativas-table td.views-field-field-m2,
.terciario-table td.views-field-field-precio-m2,
.anexos-table td.views-field-field-precio-m2,
.inversiones-alternativas-table td.views-field-field-precio-m2,
.terciario-table td.views-field-field-dormitorios,
.anexos-table td.views-field-field-dormitorios,
.inversiones-alternativas-table td.views-field-field-dormitorios,
.terciario-table td.views-field-field-banos,
.anexos-table td.views-field-field-banos,
.inversiones-alternativas-table td.views-field-field-banos {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: var(--font-weight-medium);
}

/* Text columns - left-aligned */
.propiedades-table td.views-field-field-direccion,
.propiedades-table td.views-field-field-municipio,
.propiedades-table td.views-field-field-comarca,
.residencial-table td.views-field-field-direccion,
.residencial-table td.views-field-field-municipio,
.residencial-table td.views-field-field-comarca,
.suelo-table td.views-field-field-direccion,
.suelo-table td.views-field-field-municipio,
.suelo-table td.views-field-field-comarca,
.terciario-table td.views-field-field-direccion,
.anexos-table td.views-field-field-direccion,
.inversiones-alternativas-table td.views-field-field-direccion,
.terciario-table td.views-field-field-municipio,
.anexos-table td.views-field-field-municipio,
.inversiones-alternativas-table td.views-field-field-municipio,
.terciario-table td.views-field-field-comarca,
.anexos-table td.views-field-field-comarca,
.inversiones-alternativas-table td.views-field-field-comarca {
  text-align: left;
}

/* First column left-aligned for better readability */
.propiedades-table td.sticky-column,
.residencial-table td.sticky-column,
.suelo-table td.sticky-column,
.terciario-table td.sticky-column,
.anexos-table td.sticky-column,
.inversiones-alternativas-table td.sticky-column {
  text-align: left;
  min-width: 180px;
  max-width: 250px;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  padding-left: var(--space-xs);
  padding-right: var(--space-xs);
}

/* Maintain background colors on sticky column */
.propiedades-table tbody tr:nth-child(odd) td.sticky-column,
.residencial-table tbody tr:nth-child(odd) td.sticky-column,
.suelo-table tbody tr:nth-child(odd) td.sticky-column,
.terciario-table tbody tr:nth-child(odd) td.sticky-column,
.anexos-table tbody tr:nth-child(odd) td.sticky-column,
.inversiones-alternativas-table tbody tr:nth-child(odd) td.sticky-column {
  background-color: var(--color-bg-cream);
}

.propiedades-table tbody tr:nth-child(even) td.sticky-column,
.residencial-table tbody tr:nth-child(even) td.sticky-column,
.suelo-table tbody tr:nth-child(even) td.sticky-column,
.terciario-table tbody tr:nth-child(even) td.sticky-column,
.anexos-table tbody tr:nth-child(even) td.sticky-column,
.inversiones-alternativas-table tbody tr:nth-child(even) td.sticky-column {
  background-color: var(--color-white);
}

.propiedades-table tbody tr:hover td.sticky-column,
.residencial-table tbody tr:hover td.sticky-column,
.suelo-table tbody tr:hover td.sticky-column,
.terciario-table tbody tr:hover td.sticky-column,
.anexos-table tbody tr:hover td.sticky-column,
.inversiones-alternativas-table tbody tr:hover td.sticky-column {
  background-image: linear-gradient(90deg,
    rgba(232, 196, 184, 0.12) 0%,
    rgba(232, 196, 184, 0.15) 100%
  );
}

/* Links in cells */
.propiedades-table td a,
.residencial-table td a,
.suelo-table td a,
.terciario-table td a,
.anexos-table td a,
.inversiones-alternativas-table td a {
  color: var(--color-text-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all var(--transition-fast);
  padding-bottom: 1px;
}

.propiedades-table td a:hover,
.residencial-table td a:hover,
.suelo-table td a:hover,
.terciario-table td a:hover,
.anexos-table td a:hover,
.inversiones-alternativas-table td a:hover {
  color: var(--color-peach-dark);
  border-bottom-color: var(--color-peach);
  transform: translateX(2px);
}

/* ========================================
 * EMPTY STATE
 * ======================================== */

.propiedades-table tbody tr.views-row-empty td,
.residencial-table tbody tr.views-row-empty td,
.suelo-table tbody tr.views-row-empty td,
.terciario-table tbody tr.views-row-empty td,
.anexos-table tbody tr.views-row-empty td,
.inversiones-alternativas-table tbody tr.views-row-empty td {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--color-text-muted);
  font-style: italic;
}

/* ========================================
 * RESPONSIVE BEHAVIOR
 * ======================================== */

/* Tablet adjustments */
@media (max-width: 991px) {
  .propiedades-table th,
  .residencial-table th,
  .suelo-table th,
  .terciario-table th,
  .anexos-table th,
  .inversiones-alternativas-table th {
    padding: 6px var(--space-2xs);
    font-size: 0.7rem;
  }

  .propiedades-table td,
  .residencial-table td,
  .suelo-table td,
  .terciario-table td,
  .anexos-table td,
  .inversiones-alternativas-table td {
    padding: var(--space-2xs);
    font-size: 0.7rem;
  }

  .propiedades-table th,
  .propiedades-table td,
  .residencial-table th,
  .residencial-table td,
  .suelo-table th,
  .suelo-table td,
  .terciario-table th,
  .anexos-table th,
  .inversiones-alternativas-table th,
  .terciario-table td,
  .anexos-table td,
  .inversiones-alternativas-table td {
    min-width: 100px;
  }

  .propiedades-table td.sticky-column,
  .residencial-table td.sticky-column,
  .suelo-table td.sticky-column,
  .terciario-table td.sticky-column,
  .anexos-table td.sticky-column,
  .inversiones-alternativas-table td.sticky-column {
    min-width: 150px;
    padding-left: 6px;
    padding-right: 6px;
  }

  .propiedades-table .sticky-column,
  .residencial-table .sticky-column,
  .suelo-table .sticky-column,
  .terciario-table .sticky-column,
  .anexos-table .sticky-column,
  .inversiones-alternativas-table .sticky-column {
    box-shadow: 2px 0 6px -1px rgba(0, 0, 0, 0.1);
  }

  .propiedades-table tbody tr:hover,
  .residencial-table tbody tr:hover,
  .suelo-table tbody tr:hover,
  .terciario-table tbody tr:hover,
  .anexos-table tbody tr:hover,
  .inversiones-alternativas-table tbody tr:hover {
    transform: translateY(0);
  }
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .table-scroll-container {
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
    /* Constrain to viewport width minus container padding */
    max-width: calc(100vw - 2 * var(--space-md));
  }

  .propiedades-table th,
  .residencial-table th,
  .suelo-table th,
  .terciario-table th,
  .anexos-table th,
  .inversiones-alternativas-table th {
    padding: 4px 3px;
    font-size: 0.7rem;
    letter-spacing: 0;
  }

  .propiedades-table td,
  .residencial-table td,
  .suelo-table td,
  .terciario-table td,
  .anexos-table td,
  .inversiones-alternativas-table td {
    padding: 4px 3px;
    font-size: 0.7rem;
    line-height: 1.3;
  }

  .propiedades-table th,
  .propiedades-table td,
  .residencial-table th,
  .residencial-table td,
  .suelo-table th,
  .suelo-table td,
  .terciario-table th,
  .anexos-table th,
  .inversiones-alternativas-table th,
  .terciario-table td,
  .anexos-table td,
  .inversiones-alternativas-table td {
    min-width: 75px;
  }

  .propiedades-table td.sticky-column,
  .residencial-table td.sticky-column,
  .suelo-table td.sticky-column,
  .terciario-table td.sticky-column,
  .anexos-table td.sticky-column,
  .inversiones-alternativas-table td.sticky-column {
    min-width: 100px;
    padding-left: var(--space-2xs);
    padding-right: var(--space-2xs);
    font-size: 0.7rem;
  }

  .propiedades-table .sticky-column,
  .residencial-table .sticky-column,
  .suelo-table .sticky-column,
  .terciario-table .sticky-column,
  .anexos-table .sticky-column,
  .inversiones-alternativas-table .sticky-column {
    box-shadow: 1px 0 4px rgba(0, 0, 0, 0.08);
  }

  /* Simplified hover on mobile */
  .propiedades-table tbody tr:hover,
  .residencial-table tbody tr:hover,
  .suelo-table tbody tr:hover,
  .terciario-table tbody tr:hover,
  .anexos-table tbody tr:hover,
  .inversiones-alternativas-table tbody tr:hover {
    background-color: rgba(232, 196, 184, 0.12);
    box-shadow: none;
    transform: none;
  }

  /* Larger touch targets */
  .propiedades-table th a,
  .propiedades-table td a,
  .residencial-table th a,
  .residencial-table td a,
  .suelo-table th a,
  .suelo-table td a,
  .terciario-table th a,
  .anexos-table th a,
  .inversiones-alternativas-table th a,
  .terciario-table td a,
  .anexos-table td a,
  .inversiones-alternativas-table td a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* ---- Override Tablesaw stack mode ----
   * Keep native table layout so the .table-scroll-container
   * provides horizontal scroll instead of vertical stacking.
   * Uses !important to beat Tablesaw's @media only all rules
   * and customizations.css sr-only overrides. */

  .tablesaw-stack.propiedades-table thead,
  .tablesaw-stack.residencial-table thead,
  .tablesaw-stack.suelo-table thead,
  .tablesaw-stack.terciario-table thead,
  .tablesaw-stack.anexos-table thead,
  .tablesaw-stack.inversiones-alternativas-table thead {
    display: table-header-group !important;
  }

  .tablesaw-stack.propiedades-table thead th,
  .tablesaw-stack.propiedades-table thead td,
  .tablesaw-stack.residencial-table thead th,
  .tablesaw-stack.residencial-table thead td,
  .tablesaw-stack.suelo-table thead th,
  .tablesaw-stack.suelo-table thead td,
  .tablesaw-stack.terciario-table thead th,
  .tablesaw-stack.terciario-table thead td,
  .tablesaw-stack.anexos-table thead th,
  .tablesaw-stack.anexos-table thead td,
  .tablesaw-stack.inversiones-alternativas-table thead th,
  .tablesaw-stack.inversiones-alternativas-table thead td {
    display: table-cell !important;
    /* Undo customizations.css sr-only hiding */
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: 4px 3px !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .tablesaw-stack.propiedades-table tbody tr,
  .tablesaw-stack.residencial-table tbody tr,
  .tablesaw-stack.suelo-table tbody tr,
  .tablesaw-stack.terciario-table tbody tr,
  .tablesaw-stack.anexos-table tbody tr,
  .tablesaw-stack.inversiones-alternativas-table tbody tr {
    display: table-row !important;
    width: auto !important;
    float: none !important;
    clear: none !important;
    border-bottom: none !important;
  }

  .tablesaw-stack.propiedades-table td,
  .tablesaw-stack.propiedades-table th,
  .tablesaw-stack.residencial-table td,
  .tablesaw-stack.residencial-table th,
  .tablesaw-stack.suelo-table td,
  .tablesaw-stack.suelo-table th,
  .tablesaw-stack.terciario-table td,
  .tablesaw-stack.terciario-table th,
  .tablesaw-stack.anexos-table td,
  .tablesaw-stack.anexos-table th,
  .tablesaw-stack.inversiones-alternativas-table td,
  .tablesaw-stack.inversiones-alternativas-table th {
    display: table-cell !important;
    float: none !important;
    clear: none !important;
    width: auto !important;
  }

  .tablesaw-stack.propiedades-table td:empty,
  .tablesaw-stack.propiedades-table th:empty,
  .tablesaw-stack.residencial-table td:empty,
  .tablesaw-stack.residencial-table th:empty,
  .tablesaw-stack.suelo-table td:empty,
  .tablesaw-stack.suelo-table th:empty,
  .tablesaw-stack.terciario-table td:empty,
  .tablesaw-stack.terciario-table th:empty,
  .tablesaw-stack.anexos-table td:empty,
  .tablesaw-stack.anexos-table th:empty,
  .tablesaw-stack.inversiones-alternativas-table td:empty,
  .tablesaw-stack.inversiones-alternativas-table th:empty {
    display: table-cell !important;
  }

  /* Hide Tablesaw injected cell labels */
  .tablesaw-stack.propiedades-table .tablesaw-cell-label,
  .tablesaw-stack.residencial-table .tablesaw-cell-label,
  .tablesaw-stack.suelo-table .tablesaw-cell-label,
  .tablesaw-stack.terciario-table .tablesaw-cell-label,
  .tablesaw-stack.anexos-table .tablesaw-cell-label,
  .tablesaw-stack.inversiones-alternativas-table .tablesaw-cell-label {
    display: none !important;
  }

  /* Reset Tablesaw cell content wrapper */
  .tablesaw-stack.propiedades-table .tablesaw-cell-content,
  .tablesaw-stack.residencial-table .tablesaw-cell-content,
  .tablesaw-stack.suelo-table .tablesaw-cell-content,
  .tablesaw-stack.terciario-table .tablesaw-cell-content,
  .tablesaw-stack.anexos-table .tablesaw-cell-content,
  .tablesaw-stack.inversiones-alternativas-table .tablesaw-cell-content {
    display: inline !important;
    max-width: none !important;
  }
}

/* ========================================
 * SCROLLBAR STYLING (Webkit Browsers)
 * ======================================== */

.table-scroll-container::-webkit-scrollbar {
  height: 10px;
}

.table-scroll-container::-webkit-scrollbar-track {
  background: var(--color-bg-light);
  border-radius: var(--radius-sm);
}

.table-scroll-container::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg,
    var(--color-peach-dark) 0%,
    var(--color-peach) 100%
  );
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg,
    var(--color-peach) 0%,
    var(--color-peach-light) 100%
  );
}

/* Firefox scrollbar styling */
.table-scroll-container {
  scrollbar-width: thin;
  scrollbar-color: var(--color-peach) var(--color-bg-light);
}

/* ========================================
 * PRINT STYLES
 * ======================================== */

@media print {
  .table-scroll-container {
    overflow: visible;
    border: none;
  }

  .propiedades-table,
  .residencial-table,
  .suelo-table,
  .terciario-table,
  .anexos-table,
  .inversiones-alternativas-table {
    width: 100%;
  }

  .propiedades-table .sticky-column,
  .residencial-table .sticky-column,
  .suelo-table .sticky-column,
  .terciario-table .sticky-column,
  .anexos-table .sticky-column,
  .inversiones-alternativas-table .sticky-column {
    position: static;
    box-shadow: none;
  }

  .propiedades-table thead,
  .residencial-table thead,
  .suelo-table thead,
  .terciario-table thead,
  .anexos-table thead,
  .inversiones-alternativas-table thead {
    position: static;
  }

  .propiedades-table tbody tr:hover,
  .residencial-table tbody tr:hover,
  .suelo-table tbody tr:hover,
  .terciario-table tbody tr:hover,
  .anexos-table tbody tr:hover,
  .inversiones-alternativas-table tbody tr:hover {
    background-color: inherit;
  }
}

/* ========================================
 * ACCESSIBILITY ENHANCEMENTS
 * ======================================== */

/* Enhanced focus states */
.propiedades-table th:focus,
.propiedades-table td:focus,
.residencial-table th:focus,
.residencial-table td:focus,
.suelo-table th:focus,
.suelo-table td:focus,
.terciario-table th:focus,
.anexos-table th:focus,
.inversiones-alternativas-table th:focus,
.terciario-table td:focus,
.anexos-table td:focus,
.inversiones-alternativas-table td:focus {
  outline: 2px solid var(--color-peach);
  outline-offset: -2px;
  background-color: rgba(232, 196, 184, 0.15);
  border-radius: 2px;
  z-index: 2;
  position: relative;
}

.propiedades-table th a:focus,
.propiedades-table td a:focus,
.residencial-table th a:focus,
.residencial-table td a:focus,
.suelo-table th a:focus,
.suelo-table td a:focus,
.terciario-table th a:focus,
.anexos-table th a:focus,
.inversiones-alternativas-table th a:focus,
.terciario-table td a:focus,
.anexos-table td a:focus,
.inversiones-alternativas-table td a:focus {
  outline: 2px solid var(--color-peach);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .propiedades-table tbody tr,
  .propiedades-table th,
  .propiedades-table th a,
  .propiedades-table th a::after,
  .propiedades-table td a,
  .propiedades-table th .tablesort,
  .residencial-table tbody tr,
  .residencial-table th,
  .residencial-table th a,
  .residencial-table th a::after,
  .residencial-table td a,
  .residencial-table th .tablesort,
  .suelo-table tbody tr,
  .suelo-table th,
  .suelo-table th a,
  .suelo-table th a::after,
  .suelo-table td a,
  .suelo-table th .tablesort,
  .terciario-table tbody tr,
  .anexos-table tbody tr,
  .inversiones-alternativas-table tbody tr,
  .terciario-table th,
  .anexos-table th,
  .inversiones-alternativas-table th,
  .terciario-table th a,
  .anexos-table th a,
  .inversiones-alternativas-table th a,
  .terciario-table th a::after,
  .anexos-table th a::after,
  .inversiones-alternativas-table th a::after,
  .terciario-table td a,
  .anexos-table td a,
  .inversiones-alternativas-table td a,
  .terciario-table th .tablesort,
  .anexos-table th .tablesort,
  .inversiones-alternativas-table th .tablesort,
  .table-scroll-container::-webkit-scrollbar-thumb {
    transition: none;
  }

  .propiedades-table tbody tr:hover,
  .residencial-table tbody tr:hover,
  .suelo-table tbody tr:hover,
  .terciario-table tbody tr:hover,
  .anexos-table tbody tr:hover,
  .inversiones-alternativas-table tbody tr:hover {
    transform: none;
  }

  .propiedades-table td a:hover,
  .residencial-table td a:hover,
  .suelo-table td a:hover,
  .terciario-table td a:hover,
  .anexos-table td a:hover,
  .inversiones-alternativas-table td a:hover {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .propiedades-table th,
  .residencial-table th,
  .suelo-table th,
  .terciario-table th,
  .anexos-table th,
  .inversiones-alternativas-table th {
    border: 2px solid var(--color-black);
  }

  .propiedades-table td,
  .residencial-table td,
  .suelo-table td,
  .terciario-table td,
  .anexos-table td,
  .inversiones-alternativas-table td {
    border: 1px solid var(--color-black);
  }

  .propiedades-table .sticky-column,
  .residencial-table .sticky-column,
  .suelo-table .sticky-column,
  .terciario-table .sticky-column,
  .anexos-table .sticky-column,
  .inversiones-alternativas-table .sticky-column {
    box-shadow: 3px 0 0 var(--color-black);
  }
}
