/* ==========================================================================
   PERLITE COMPARISON TABLE (THE SOFTWARE DILEMMA)
   ========================================================================== */

/* Container for Table and Sticky Navigation Rail */
.comparison-table-box {
  position: relative;
  width: 100%;
}

.table-sticky-nav-rail {
  display: none;
}

@media (max-width: 1140px) {
  .table-sticky-nav-rail {
    position: -webkit-sticky;
    position: sticky;
    top: 50vh;
    top: 50dvh;
    transform: translateY(-50%);
    height: 0;
    width: calc(100% + 48px);
    margin-left: -24px;
    margin-right: -24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 30;
    pointer-events: none;
    box-sizing: border-box;
  }

  .table-nav-arrow {
    position: relative;
    width: 32px;
    height: 56px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65);
    opacity: 0.92;
    pointer-events: auto;
    transition: opacity 0.25s ease, background 0.2s ease, border-color 0.2s ease;
  }

  .table-nav-arrow.arrow-prev {
    margin-left: 0;
    border-radius: 0 22px 22px 0;
    border-left: none;
    padding-right: 4px;
  }

  .table-nav-arrow.arrow-next {
    margin-right: 0;
    border-radius: 22px 0 0 22px;
    border-right: none;
    padding-left: 4px;
  }

  .table-nav-arrow:hover {
    background: rgba(15, 23, 42, 0.98);
    border-color: var(--accent-emerald);
    color: var(--accent-emerald);
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.45);
  }

  .table-nav-arrow.is-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }
}

.comparison-table-wrapper {
  overflow-x: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  margin-top: 32px;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.comparison-table {
  width: 100%;
  min-width: 1140px;
  border-collapse: collapse;
  text-align: left;
}

.comparison-table th, .comparison-table td {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
  line-height: 1.5;
  vertical-align: top;
}

.comparison-table th {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: #0B101D;
  position: sticky;
  top: 0;
  z-index: 2;
}

.comparison-table .col-feature,
.comparison-table .feature-title {
  width: 230px;
  min-width: 230px;
  position: sticky;
  left: 0;
  background: #0E1626;
  z-index: 3;
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.45);
}

.comparison-table th.col-feature {
  background: #080D1A;
  z-index: 5;
}

.comparison-table .col-traditional,
.comparison-table .col-saas,
.comparison-table .col-lowcode,
.comparison-table .col-aigen {
  width: 180px;
  min-width: 170px;
}

.comparison-table .col-perlite {
  width: 230px;
  min-width: 220px;
}

.comparison-table th.highlight-header {
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
  border-left: 2px solid rgba(16, 185, 129, 0.4);
  border-right: 2px solid rgba(16, 185, 129, 0.4);
  border-top: 2px solid var(--accent-emerald);
}

.perlite-header-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.perlite-pill-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 2px 8px;
  border-radius: 4px;
  width: fit-content;
}

.perlite-col-name {
  font-size: 0.98rem;
  font-weight: 800;
  color: #F8FAFC;
}

.feature-title strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.92rem;
  margin-bottom: 4px;
  line-height: 1.35;
}

.feature-title span {
  display: block;
  font-size: 0.76rem;
  color: var(--text-tertiary);
  line-height: 1.35;
}

.pos-td {
  color: #34D399;
  font-weight: 600;
}

.neg-td {
  color: #F87171;
  font-size: 0.85rem;
}

.neutral-td {
  color: #94A3B8;
  font-size: 0.85rem;
}

.dim-td {
  color: #64748B;
  font-size: 0.85rem;
}

.highlight-cell {
  background: rgba(16, 185, 129, 0.04);
  border-left: 2px solid rgba(16, 185, 129, 0.3);
  border-right: 2px solid rgba(16, 185, 129, 0.3);
  color: #E2E8F0;
  font-size: 0.88rem;
}

/* Scroll hint for mobile screens */
.table-scroll-hint {
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-emerald);
  margin-bottom: 12px;
  padding: 0 4px;
}

.table-scroll-hint svg {
  animation: pulseArrow 1.5s infinite ease-in-out;
}

@keyframes pulseArrow {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

@media (max-width: 768px) {
  .table-scroll-hint {
    display: flex;
  }

  .comparison-table {
    min-width: 880px;
  }

  .comparison-table th, .comparison-table td {
    padding: 14px 10px;
    font-size: 0.80rem;
  }

  .comparison-table .col-feature,
  .comparison-table .feature-title {
    width: 145px;
    min-width: 145px;
    padding: 14px 10px;
  }

  .feature-title strong {
    font-size: 0.82rem;
    margin-bottom: 2px;
  }

  .feature-title span {
    font-size: 0.68rem;
    line-height: 1.3;
  }

  .comparison-table .col-perlite {
    width: 185px;
    min-width: 185px;
    padding: 14px 12px;
  }

  .comparison-table .col-traditional,
  .comparison-table .col-saas,
  .comparison-table .col-lowcode,
  .comparison-table .col-aigen {
    width: 140px;
    min-width: 135px;
  }
}
