/* =========================================================
   COMPONENT: COMPARISON TABLE
   Responsiv tabell (desktop + mobilkort)
   ========================================================= */

/* Wrapper (scroll support) */
.comparison-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}


/* =========================================================
   BASE TABLE
   ========================================================= */

table.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  background: var(--color-bg);
}

table.comparison-table th,
table.comparison-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

table.comparison-table thead th {
  background: var(--color-bg-alt);
  font-weight: 600;
}


/* =========================================================
   DESKTOP / TABLET
   ========================================================= */

@media (min-width: 769px) {

  table.comparison-table {
    table-layout: auto;
  }

  /* Första kolumn (aspekt) */
  table.comparison-table th[scope="row"] {
    width: 22%;
    background: var(--color-bg-alt);
    font-weight: 600;
  }

  /* Zebra rows */
  table.comparison-table tbody tr:nth-child(even) {
    background: var(--color-bg-alt);
  }

  table.comparison-table tbody tr:hover {
    background: rgba(0,0,0,0.03);
  }

  /* Många kolumner → scroll */
  table.comparison-table.comparison-cols-6,
  table.comparison-table.comparison-cols-7 {
    min-width: 1000px;
  }
}


/* =========================================================
   MOBILE (CARD LAYOUT)
   ========================================================= */

@media (max-width: 768px) {

  table.comparison-table thead {
    display: none;
  }

  table.comparison-table,
  table.comparison-table tbody,
  table.comparison-table tr {
    display: block;
    width: 100%;
  }

  table.comparison-table tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    background: var(--color-bg);
  }

  /* Titel */
  table.comparison-table th[scope="row"] {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.6rem;
    background: transparent;
    border: none;
  }

  /* Data */
  table.comparison-table td {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: var(--spacing-sm);
    padding: 0.4rem 0;
    border: none;
    border-bottom: 1px dashed var(--color-border);
  }

  table.comparison-table td:last-child {
    border-bottom: none;
  }

  table.comparison-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-text-light);
  }
}


/* =========================================================
   SCROLL HINT
   ========================================================= */

@media (min-width: 769px) {

  .comparison-table-wrapper {
    position: relative;
    padding-bottom: 28px;
  }

  .comparison-table-wrapper.has-scroll-hint::after {
    content: "↔ Dra åt sidan för fler kolumner";
    position: absolute;
    left: 8px;
    bottom: 4px;
    font-size: 0.8rem;
    color: var(--color-text-light);
    background: linear-gradient(to right, var(--color-bg), rgba(255,255,255,0));
    pointer-events: none;
    white-space: nowrap;
  }
}


/* =========================================================
   STICKY COLUMN
   ========================================================= */

@media (min-width: 769px) {

  table.comparison-table th[scope="row"] {
    position: sticky;
    left: 0;
    background: var(--color-bg-alt);
    z-index: 2;
  }

  table.comparison-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
  }
}


/* =========================================================
   TITLE
   ========================================================= */

.comparison-title {
  margin-bottom: var(--spacing-sm);
}