/**
 * @file
 * Styles for comparison table display.
 */

.comparison-table-wrapper {
  overflow-x: auto;
  margin: 1.5em 0;
  max-width: 100%;
  width: 100%;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
  margin-top: 50px;
  margin-bottom: 50px;
}

.comparison-table thead th {
  border: none;
}

.comparison-table thead {
  background-color: #fff;
  border-bottom: 2px solid #132048;
}

.comparison-table th {
  padding: 5px 10px;
  text-align: center;
  font-weight: 600;
  border: none;
}

.comparison-table tbody th {
  @media (max-width: 992px) {
    text-align: left;
  }
}

.comparison-table__feature-column {
  min-width: 200px;
}

.comparison-table__product-column {
  min-width: 190px;
}

.comparison-table__product-header {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.comparison-table__product-title {
  font-weight: 600;
  margin-bottom: 0.5em;
  font-size: 14px;
}

.comparison-table__product-description {
  font-weight: 500;
  font-size: 12px;
}

.comparison-table tbody tr:nth-child(odd) {
  background-color: #F3F3F4;
}

.comparison-table tbody tr:nth-child(even) {
  background-color: #fff;
}

.comparison-table__feature-row {
  min-width: 272px;
}

.comparison-table__feature-header {
  display: flex;
  align-items: center;
  gap: 0.5em;
  position: relative;
}

.comparison-table__feature-title {
  font-size: 14px;
  font-weight: 700;
}

.comparison-table__tooltip-trigger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #666;
  color: #fff;
  font-size: 0.75em;
  font-weight: bold;
  transition: background-color 0.2s;
}

.comparison-table__tooltip-trigger:hover,
.comparison-table__tooltip-trigger:focus {
  background-color: #333;
  outline: 2px solid #005fcc;
  outline-offset: 2px;
}

.comparison-table__tooltip-icon {
  display: block;
  line-height: 1;
}

.comparison-table__tooltip {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 0.5em;
  background-color: #333;
  color: #fff;
  padding: 0.75em 1em;
  border-radius: 4px;
  font-size: 0.9em;
  max-width: 300px;
  min-width: 200px;
  z-index: 1000;
  display: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.comparison-table__tooltip-trigger[aria-expanded="true"] + .comparison-table__tooltip,
.comparison-table__tooltip-trigger:hover + .comparison-table__tooltip,
.comparison-table__tooltip-trigger:focus + .comparison-table__tooltip {
  display: block;
}

.comparison-table__cell {
  text-align: center;
  padding: 1em;
  border: none;
}

.comparison-table__checkmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #D6001C;
  width: 24px;
  height: 24px;
}

.comparison-table__checkmark-icon {
  width: 100%;
  height: 100%;
}

.comparison-table__empty {
  display: inline-block;
  width: 24px;
  height: 24px;
}

/* Accessibility: visually hidden but available to screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Responsive design */
@media (max-width: 992px) {
  .comparison-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  .comparison-table {
    width: 100%;
  }

  .comparison-table__feature-column {
    width: 162px;
    min-width: 162px;
    max-width: 162px;
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: #fff;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
  }

  .comparison-table__feature-row {
    width: 162px;
    min-width: 162px;
    max-width: 162px;
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: #fff;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
  }

  .comparison-table thead .comparison-table__feature-column {
    background-color: #fff;
    z-index: 11;
  }

  .comparison-table tbody tr:nth-child(odd) .comparison-table__feature-row {
    background-color: #F3F3F4;
  }

  .comparison-table tbody tr:nth-child(even) .comparison-table__feature-row {
    background-color: #fff;
  }

  .comparison-table__product-column {
    width: calc(100vw - 194px);
    min-width: calc(100vw - 194px);
  }
  
  .comparison-table {
    table-layout: fixed;
    width: auto;
  }
}

