/* ================================================================
   INTERACTIVE SERVICE COMPARISON TABLE - Phase 3
   ================================================================ */

/* ================================================================
   TABLE CONTAINER
   ================================================================ */

.comparison-table-section {
  padding: 80px 0;
  background: var(--bg-elevated);
}

.comparison-table-wrapper {
  overflow-x: auto;
  margin: 48px 0;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  background: var(--bg-card);
}

/* Hide scrollbar but keep functionality */
.comparison-table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.comparison-table-wrapper::-webkit-scrollbar-track {
  background: var(--bg-elevated);
  border-radius: 4px;
}

.comparison-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

.comparison-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* ================================================================
   TABLE STRUCTURE
   ================================================================ */

.comparison-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 800px;
}

/* ================================================================
   TABLE HEADER
   ================================================================ */

.comparison-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-card);
}

.comparison-table thead tr {
  border-bottom: 2px solid var(--border-light);
}

.comparison-table th {
  padding: 24px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-card);
  position: relative;
}

/* Feature column (first column) - sticky on scroll */
.comparison-table th:first-child,
.comparison-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 5;
  min-width: 200px;
  font-weight: 500;
}

.comparison-table thead th:first-child {
  z-index: 11;
}

/* Service column headers */
.comparison-table th:not(:first-child) {
  text-align: center;
  border-left: 1px solid var(--border-light);
}

.comparison-service-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.comparison-service-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  margin-bottom: 4px;
}

.comparison-service-icon.automation {
  background: linear-gradient(135deg, var(--color-primary), #5c6bc0);
}

.comparison-service-icon.ai {
  background: linear-gradient(135deg, var(--color-accent), #42a5f5);
}

.comparison-service-icon.cloud {
  background: linear-gradient(135deg, #00897b, #26a69a);
}

.comparison-service-icon.data {
  background: linear-gradient(135deg, #6a1b9a, #8e24aa);
}

.comparison-service-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.comparison-service-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ================================================================
   TABLE BODY
   ================================================================ */

.comparison-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.2s ease;
}

.comparison-table tbody tr:hover {
  background: var(--bg-elevated);
}

.comparison-table tbody tr:last-child {
  border-bottom: none;
}

.comparison-table td {
  padding: 20px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-secondary);
  border-left: 1px solid var(--border-light);
  vertical-align: middle;
}

.comparison-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text-primary);
  border-left: none;
}

/* ================================================================
   CATEGORY HEADERS (group rows)
   ================================================================ */

.comparison-category-row {
  background: var(--bg-elevated) !important;
}

.comparison-category-row td {
  padding: 16px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-primary);
  border-top: 2px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.comparison-category-row:hover {
  background: var(--bg-elevated) !important;
}

/* ================================================================
   CELL CONTENT TYPES
   ================================================================ */

/* Check mark (included) */
.comparison-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #4caf50;
  color: white;
  font-size: 18px;
}

.comparison-check .material-icons {
  font-size: 20px;
}

/* X mark (not included) */
.comparison-cross {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f44336;
  color: white;
  font-size: 18px;
}

.comparison-cross .material-icons {
  font-size: 20px;
}

/* Partial/Optional */
.comparison-partial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ff9800;
  color: white;
  font-size: 18px;
  font-weight: 600;
}

/* Text values */
.comparison-value {
  font-weight: 500;
  color: var(--text-primary);
}

.comparison-value-small {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 4px;
}

/* Highlighted values */
.comparison-highlight {
  padding: 4px 12px;
  border-radius: 16px;
  background: var(--color-primary-alpha-20);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-block;
}

/* ================================================================
   FOOTER CTA ROW
   ================================================================ */

.comparison-table tfoot {
  border-top: 2px solid var(--border-light);
}

.comparison-table tfoot td {
  padding: 24px 20px;
  text-align: center;
  border-left: 1px solid var(--border-light);
}

.comparison-table tfoot td:first-child {
  border-left: none;
}

.comparison-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 8px;
  background: var(--color-primary);
  color: white;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  border: none;
  cursor: pointer;
}

.comparison-cta-btn:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--color-primary-alpha-40);
  color: white;
  text-decoration: none;
}

.comparison-cta-btn .material-icons {
  font-size: 18px;
}

/* ================================================================
   LEGEND
   ================================================================ */

.comparison-legend {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 32px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: 12px;
  flex-wrap: wrap;
}

.comparison-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.comparison-legend-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
}

.comparison-legend-icon.included {
  background: #4caf50;
}

.comparison-legend-icon.excluded {
  background: #f44336;
}

.comparison-legend-icon.optional {
  background: #ff9800;
}

/* ================================================================
   MOBILE RESPONSIVENESS
   ================================================================ */

@media only screen and (max-width: 1024px) {
  .comparison-table-section {
    padding: 60px 0;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 16px 12px;
  }

  .comparison-service-title {
    font-size: 1rem;
  }

  .comparison-service-subtitle {
    font-size: 0.75rem;
  }
}

@media only screen and (max-width: 768px) {
  .comparison-table {
    min-width: 600px;
  }

  .comparison-table th:first-child,
  .comparison-table td:first-child {
    min-width: 150px;
  }

  .comparison-service-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .comparison-service-title {
    font-size: 0.9rem;
  }

  .comparison-service-subtitle {
    display: none;
  }

  .comparison-legend {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
}

@media only screen and (max-width: 480px) {
  .comparison-table th:first-child,
  .comparison-table td:first-child {
    min-width: 120px;
    font-size: 0.85rem;
  }

  .comparison-check,
  .comparison-cross,
  .comparison-partial {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .comparison-value {
    font-size: 0.85rem;
  }

  .comparison-cta-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
}

/* ================================================================
   SCROLL HINT
   ================================================================ */

.comparison-scroll-hint {
  text-align: center;
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.comparison-scroll-hint .material-icons {
  font-size: 20px;
  animation: swipe 1.5s ease-in-out infinite;
}

@keyframes swipe {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(10px);
  }
}

/* Hide scroll hint on desktop */
@media only screen and (min-width: 1200px) {
  .comparison-scroll-hint {
    display: none;
  }
}

/* ================================================================
   DARK MODE ADJUSTMENTS
   ================================================================ */

[data-theme="dark"] .comparison-table-wrapper {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .comparison-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .comparison-cta-btn:hover {
  box-shadow: 0 4px 12px rgba(63, 81, 181, 0.5);
}

/* ================================================================
   PRINT STYLES
   ================================================================ */

@media print {
  .comparison-table-wrapper {
    overflow: visible;
    box-shadow: none;
  }

  .comparison-table {
    min-width: 100%;
  }

  .comparison-table th:first-child,
  .comparison-table td:first-child {
    position: static;
  }

  .comparison-cta-btn {
    display: none;
  }

  .comparison-scroll-hint {
    display: none;
  }
}

/* ================================================================
   ACCESSIBILITY
   ================================================================ */

.comparison-check,
.comparison-cross,
.comparison-partial {
  position: relative;
}

/* Screen reader text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ================================================================
   REDUCED MOTION
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
  .comparison-table tbody tr,
  .comparison-cta-btn,
  .comparison-scroll-hint .material-icons {
    transition: none;
    animation: none;
  }

  .comparison-cta-btn:hover {
    transform: none;
  }
}
