/**
 * Product Comparison Page Styles
 */

.product-comparison-wrapper {
  padding: 40px 0;
}

.comparison-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 30px;
  color: #333;
}

/* Product Selection Interface */
.comparison-selector {
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 40px;
}

.variant-badge {
  display: none;
}

.selector-header {
  text-align: center;
  margin-bottom: 30px;
}

.selector-header p {
  font-size: 18px;
  color: #666;
}

.product-dropdowns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.dropdown-item label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

.product-select {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  transition: border-color 0.3s;
}

/* Dropdown optgroup styling for section headers */
.product-select optgroup {
  font-weight: 700;
  font-size: 14px;
  color: #dc3545;
  background-color: #e3f2fd;
  padding: 8px 10px;
  font-style: normal;
}

.product-select option {
  padding: 6px 20px;
  font-weight: 400;
  color: #333;
}

.compare-row:not(.category-row):hover {
  background-color: #f8f9fa;
}

/* Highlight rows where values differ across columns */
.compare-row.row-highlight-diff {
  background-color: #fef9e7;
}

.compare-row.row-highlight-diff:hover {
  background-color: #fdf3ce;
}

.product-select:hover {
  border-color: #1e9dd8;
}

.product-select:focus {
  outline: none;
  border-color: #1e9dd8;
  box-shadow: 0 0 0 3px rgba(30, 157, 216, 0.1);
}

.selector-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.btn {
  padding: 12px 30px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: #1e9dd8;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #1a8bc4;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30, 157, 216, 0.3);
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

/* Comparison Grid Layout */
.comparison-grid {
  margin-top: 30px;
}

/* Product Cards Row - Dark Design Preserved */
.product-cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.product-cards-row .comparison-column {
  display: flex;
  flex-direction: column;
  text-align: center;
  position: relative;
}

.product-image-container {
  padding: 20px;
  background: white;
  border-radius: 4px;
  text-align: center;
  margin: 0 auto;
}

.product-image-placeholder {
  min-height: 265px;
  background: #fff;
}

.product-image {
  display: block;
  margin: 0 auto;
  width: 100%;
  max-width: 225px;
  height: 225px;
  object-fit: contain;
}

/* View Relevant Resources Link */
.view-resources-link {
  text-align: center;
  padding: 0px 20px 20px;
  background: white;
}

.view-resources-link .link-with-chevron {
  color: #1e9dd8;
  text-decoration: none;
  font-weight: 400;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.3s ease;
}

.view-resources-link .link-with-chevron:hover {
  color: #1e9dd8;
  text-decoration: none;
  transform: translateX(3px);
}

.view-resources-link .link-with-chevron .chevron-icon {
  font-size: 20px;
  transition: transform 0.3s ease;
  display: inline-block;
  font-weight: 400;
  margin-top: -4px;
}

.view-resources-link .link-with-chevron:hover .chevron-icon {
  transform: translateX(4px);
}

.product-dropdown {
  width: 100%;
  padding: 12px 15px;
  font-size: 16px;
  font-weight: 700;
  color: #000;
  background: #2c3e50;
  border: 2px solid #000;
  border-radius: 6px !important;
  cursor: pointer;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
  padding-right: 40px;
}

.product-dropdown:hover {
  border-color: #ffc222;
}

.product-dropdown:focus {
  outline: none;
  border-color: #ffc222;
  box-shadow: 0 0 0 3px rgba(255, 194, 34, 0.2);
}

.product-dropdown optgroup {
  font-weight: 700;
  font-size: 14px;
  padding: 8px 10px;
  font-style: normal;
  text-align: left;
}

.product-dropdown option {
  background: white;
  color: #333;
  padding: 10px;
  font-weight: 400;
  text-align: left;
}

.product-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: white;
}

.lattice-logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #ffc222;
}

.product-name {
  font-size: 22px;
  font-weight: 700;
  color: white;
}

/* Specification Sections */
/* Horizontal Comparison Table - Mac Style */
.compare-table {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.compare-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compare-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.category-row .category-cell span {
  font-size: 20px;
  font-weight: 700;
  color: #1e9dd8;
}

.compare-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}

.compare-column .spec-label {
  font-size: 16px;
  font-weight: 600;
  color: #555;
}

.compare-column .spec-value {
  font-size: 14px;
  color: #333;
  line-height: 1.6;
}

/* Legacy table styles - kept for backward compatibility */
.comparison-table-wrapper {
  background: white;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.comparison-section {
  margin-bottom: 40px;
}

.comparison-data-table {
  width: 100%;
  border-collapse: collapse;
}

.comparison-data-table tr {
  border-bottom: 1px solid #e9ecef;
}

.comparison-data-table td {
  padding: 15px 20px;
  vertical-align: top;
}

.spec-name {
  font-weight: 600;
  color: #495057;
  width: 30%;
  background: #f8f9fa;
}

.na-value {
  color: #999;
  font-style: italic;
}

.no-comparison {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
  font-size: 18px;
}

/* Print Styles */
@media print {
  .comparison-column {
    page-break-inside: avoid;
  }

  .spec-section {
    page-break-inside: avoid;
  }
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
  .compare-table {
    overflow-x: auto;
  }

  .compare-row {
    min-width: 900px;
  }

  .product-cards-row {
    gap: 15px;
  }
}

/* Responsive - Mobile Layout */
@media (max-width: 768px) {
  .product-dropdowns {
    grid-template-columns: 1fr;
  }

  /* Hide desktop table on mobile */
  .compare-table {
    display: none;
  }

  .product-cards-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* View Relevant Resources Link - Mobile */
  .view-resources-link {
    padding: 8px 15px 15px;
  }

  .view-resources-link .link-with-chevron {
    font-size: 14px;
  }

  /* Show mobile layout */
  .comparison-grid {
    display: block;
  }

  .comparison-mobile {
    display: block !important;
  }

  .mobile-category-section {
    margin-bottom: 30px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .mobile-category-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e9dd8;
    margin-bottom: 20px;
    text-align: left;
  }

  .mobile-product-group {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e9ecef;
  }

  .mobile-product-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }

  .mobile-product-content {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: start;
  }

  .mobile-product-name {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    padding-top: 2px;
  }

  .mobile-spec-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .mobile-spec-item {
    margin-bottom: 12px;
  }

  .mobile-spec-item:last-child {
    margin-bottom: 0;
  }

  .mobile-spec-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
  }

  .mobile-spec-value {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
  }

  .comparison-data-table {
    font-size: 14px;
  }

  .comparison-data-table td {
    padding: 10px;
  }

  .spec-name {
    width: 40%;
  }

  .selector-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

/* Desktop - hide mobile layout */
@media (min-width: 769px) {
  .comparison-mobile {
    display: none !important;
  }
}

/* Footnote Markers in Table */
.footnote-marker {
  color: #17a2b8;
  cursor: help;
  position: relative;
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
}

.footnote-marker svg {
  width: 16px;
  height: 16px;
  fill: #17a2b8;
  display: block;
}

.footnote-marker:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: #1a1a1a;
  color: #ffffff;
  font-size: 14px;
  font-weight: normal;
  white-space: normal;
  max-width: 300px;
  width: max-content;
  border-radius: 4px;
  z-index: 1000;
  margin-bottom: 5px;
  text-align: left;
  line-height: 1.4;
}

.footnote-marker:hover::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1a1a1a;
  margin-bottom: -5px;
}

/* Fix tooltip overflow in rightmost comparison column - desktop only */
@media (min-width: 769px) {
  .compare-row .compare-column:last-child .footnote-marker:hover::after {
    left: auto;
    right: 0;
    transform: none;
  }

  .compare-row .compare-column:last-child .footnote-marker:hover::before {
    left: auto;
    right: 5px;
    transform: none;
  }
}

/* Mobile: tooltip above info icon, no arrow, prevent cutoff */
@media (max-width: 768px) {
  .footnote-marker:hover::before,
  .mobile-product-group .footnote-marker:hover::before {
    display: none;
  }

  .footnote-marker:hover::after {
    left: auto;
    right: 0;
    transform: none;
    max-width: 210px;
  }
}

/* Disabled Options Styling */
.product-dropdown option.option-disabled {
  color: #ccc !important;
  background-color: #f5f5f5 !important;
  font-style: italic;
  cursor: not-allowed;
}

/* Firefox specific styling for disabled options */
@-moz-document url-prefix() {
  .product-dropdown option.option-disabled {
    color: #999 !important;
  }
}
