/* 
 * SmartTV Matrix — Component Styles (components.css)
 * Product cards, comparison table, filter controls, badges, and interactive popups.
 */

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.75rem;
}

/* Product Card */
.product-card {
  background-color: var(--pure-white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--slate-300);
}

.card-media {
  position: relative;
  background-color: #0f172a;
  padding: 1.25rem;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-media img {
  max-height: 100%;
  width: auto;
  object-fit: contain;
  transition: transform var(--transition-normal);
}

.product-card:hover .card-media img {
  transform: scale(1.04);
}

.card-badges {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  z-index: 10;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--pure-white);
}

.badge-oled { background-color: var(--badge-oled); }
.badge-qled { background-color: var(--badge-qled); }
.badge-miniled { background-color: var(--badge-miniled); }
.badge-led { background-color: var(--badge-led); }
.badge-hz { background-color: var(--accent-indigo); }
.badge-hdmi21 { background-color: var(--success-green); }

.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-brand-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--slate-500);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-navy);
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.card-title a {
  color: inherit;
}

.card-title a:hover {
  color: var(--accent-blue);
}

.card-specs-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.75rem;
  background-color: var(--slate-50);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.82rem;
}

.spec-item {
  display: flex;
  flex-direction: column;
}

.spec-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--slate-400);
  font-weight: 700;
}

.spec-value {
  color: var(--slate-700);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-highlights {
  list-style: none;
  font-size: 0.83rem;
  color: var(--slate-600);
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

.card-highlights li {
  position: relative;
  padding-left: 1.1rem;
}

.card-highlights li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success-green);
  font-weight: 800;
}

.card-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--slate-100);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.compare-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  user-select: none;
}

.compare-checkbox-label input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.affiliate-notice-small {
  font-size: 0.73rem;
  color: var(--slate-400);
  text-align: center;
  line-height: 1.3;
}

/* Floating Comparison Toolbar */
.comparison-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background-color: var(--primary-navy);
  color: var(--pure-white);
  padding: 1rem 1.75rem;
  border-radius: var(--radius-full);
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  z-index: 2000;
  transition: transform var(--transition-normal);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.comparison-bar.active {
  transform: translateX(-50%) translateY(0);
}

.comparison-bar-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}

.comparison-items-preview {
  display: flex;
  gap: 0.4rem;
}

.preview-thumb {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--radius-sm);
  background-color: var(--slate-700);
  object-fit: cover;
  border: 1.5px solid var(--accent-blue);
}

/* Shop Filter Layout */
.shop-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  align-items: start;
}

.filter-sidebar {
  background-color: var(--pure-white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 5.5rem;
}

.filter-group {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--slate-100);
}

.filter-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.filter-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-navy);
  margin-bottom: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
}

.filter-checkbox-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--slate-600);
  cursor: pointer;
}

.filter-checkbox-label input {
  margin-right: 0.5rem;
  accent-color: var(--accent-blue);
}

.filter-count {
  font-size: 0.78rem;
  color: var(--slate-400);
}

.shop-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--pure-white);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  margin-bottom: 1.5rem;
}

.search-input-wrapper {
  position: relative;
  flex-grow: 1;
  max-width: 400px;
}

.search-input-wrapper input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  font-size: 0.9rem;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
}

/* Comparison Table Matrix */
.comparison-table-wrapper {
  overflow-x: auto;
  background-color: var(--pure-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-md);
}

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

.comparison-table th, .comparison-table td {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--slate-200);
  border-right: 1px solid var(--slate-100);
  vertical-align: top;
}

.comparison-table th:first-child, .comparison-table td:first-child {
  position: sticky;
  left: 0;
  background-color: var(--slate-50);
  z-index: 10;
  font-weight: 700;
  min-width: 180px;
  color: var(--primary-navy);
}

.comparison-table tr.highlight-diff {
  background-color: #fefce8;
}

.comparison-header-card {
  text-align: center;
  min-width: 240px;
}

.comparison-header-card img {
  height: 120px;
  width: auto;
  margin: 0 auto 1rem auto;
  object-fit: contain;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background-color: var(--primary-navy);
  color: var(--pure-white);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 900px) {
  .shop-layout {
    grid-template-columns: 1fr;
  }

  .filter-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .shop-controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .search-input-wrapper {
    max-width: 100%;
  }

  .comparison-bar {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    width: auto;
    max-width: calc(100vw - 1.5rem);
    flex-direction: flex-start;
    padding: 0.75rem 1rem;
    box-sizing: border-box;
  }

  .comparison-items-preview {
    display: none; /* Hide small image chips on narrow mobile bar */
  }

  .comparison-table-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 0 1.5rem 0;
    border-radius: var(--radius-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .comparison-table th, .comparison-table td {
    padding: 0.85rem 0.65rem;
    font-size: 0.85rem;
  }

  .comparison-table th:first-child, .comparison-table td:first-child {
    min-width: 130px;
    font-size: 0.82rem;
  }
}
