/**
 * Comparison Feature Styles
 * Floating comparison bar and comparison button styling
 *
 * @package Kosmetix
 */

/* ===================================
   Comparison Button (on product card)
   =================================== */

/* Comparison button inherits from icon-action-btn component */
/* Only comparison-specific overrides here */
.comparison-btn:hover {
  background: transparent;
  box-shadow: var(--wp--custom--shadow--glow);
}

.comparison-btn:hover .material-symbols-outlined {
  color: var(--wp--preset--color--rose-gold);
}

/* Active state - matches icon-action-btn.active (rose-gold bg + white icon) */
.comparison-btn.active {
  background: var(--wp--preset--color--rose-gold);
}

.comparison-btn.active .material-symbols-outlined {
  color: var(--wp--preset--color--white);
  transform: scale(1.1);
}

.comparison-btn.active:hover {
  background: var(--wp--preset--color--rose-gold-dark);
}

.comparison-btn .material-symbols-outlined {
  font-size: 20px;
  transition: transform 0.2s ease, color 0.2s ease;
}

/* ===================================
   Floating Comparison Bar
   =================================== */

.comparison-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--wp--preset--color--charcoal);
  padding: var(--wp--preset--spacing--sm) var(--wp--preset--spacing--lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--wp--preset--spacing--lg);
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

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

.comparison-bar__items {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.comparison-bar__item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.comparison-bar__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comparison-bar__item-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--wp--preset--color--rose-gold, #b76e79);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: transform 0.2s;
}

.comparison-bar__item-remove:hover {
  transform: scale(1.2);
}

.comparison-bar__placeholder {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.3);
}

.comparison-bar__placeholder .material-symbols-outlined {
  font-size: 24px;
}

.comparison-bar__actions {
  display: flex;
  gap: 1rem;
}

.comparison-bar__btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.comparison-bar__btn--compare {
  background: var(--wp--preset--gradient--rose-gold-shimmer);
  color: var(--wp--preset--color--white);
  border: none;
}

.comparison-bar__btn--compare:hover {
  transform: translateY(-2px);
  box-shadow: var(--wp--custom--shadow--glow);
}

.comparison-bar__btn--clear {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.comparison-bar__btn--clear:hover {
  color: white;
  border-color: white;
}

.comparison-bar__count {
  background: var(--wp--preset--color--rose-gold, #b76e79);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* ===================================
   Comparison Page
   =================================== */

.kosmetix-comparison {
  padding: 4rem 0;
  min-height: 60vh;
}

.comparison-header {
  text-align: center;
  margin-bottom: 3rem;
}

.comparison-header h1 {
  font-family: var(--wp--preset--font-family--heading);
  font-size: var(--wp--preset--font-size--4xl);
  font-weight: 700;
  margin-bottom: var(--wp--preset--spacing--2xs);
  background: var(--wp--preset--gradient--rose-gold-shimmer);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.comparison-table-wrapper {
  overflow-x: auto;
  margin-bottom: 2rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--wp--custom--radius--lg);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  table-layout: fixed;
}

.comparison-table th,
.comparison-table td {
  padding: var(--wp--preset--spacing--md);
  text-align: center;
  border-bottom: 1px solid var(--wp--preset--color--mist);
  vertical-align: middle;
}

/* Zebra striping */
.comparison-table tbody tr:nth-child(even) {
  background: var(--wp--preset--color--cloud);
}

.comparison-table tbody tr:hover {
  background: var(--wp--preset--color--blush-light);
}

.comparison-table th {
  background: var(--wp--preset--color--blush-light);
  font-weight: 600;
  color: var(--wp--preset--color--charcoal);
  text-transform: uppercase;
  font-size: var(--wp--preset--font-size--xs);
  letter-spacing: var(--wp--custom--letter-spacing--wider);
  padding: var(--wp--preset--spacing--sm) var(--wp--preset--spacing--md);
  border-bottom: 2px solid var(--wp--preset--color--rose-gold);
}

/* First column (labels) */
.comparison-table th:first-child,
.comparison-table td:first-child {
  width: 140px;
  min-width: 140px;
  text-align: left;
  background: var(--wp--preset--color--cloud);
}

.comparison-table td:first-child {
  font-weight: 600;
  color: var(--wp--preset--color--slate);
  font-size: var(--wp--preset--font-size--sm);
}

/* Product columns - max width */
.comparison-table th:not(:first-child),
.comparison-table td:not(:first-child) {
  max-width: 250px;
  min-width: 200px;
}

/* Product images */
.comparison-product-image {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--wp--custom--radius--md);
  margin: 0 auto var(--wp--preset--spacing--xs);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Product name with truncation and tooltip */
.comparison-product-name {
  font-weight: 600;
  color: var(--wp--preset--color--charcoal);
  margin-bottom: var(--wp--preset--spacing--3xs);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  cursor: help;
  font-size: var(--wp--preset--font-size--sm);
  line-height: 1.4;
}

.comparison-product-name[title]:hover {
  color: var(--wp--preset--color--rose-gold);
}

/* Product price */
.comparison-product-price {
  color: var(--wp--preset--color--rose-gold-dark);
  font-weight: 700;
  font-size: var(--wp--preset--font-size--lg);
}

.comparison-product-price del {
  color: var(--wp--preset--color--slate);
  font-weight: 400;
  font-size: var(--wp--preset--font-size--sm);
  margin-right: var(--wp--preset--spacing--2xs);
}

.comparison-product-price ins {
  text-decoration: none;
}

/* Remove button - use icon-action-btn */
.comparison-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: var(--wp--preset--color--slate);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: var(--wp--preset--spacing--xs);
}

.comparison-remove-btn:hover {
  background: var(--wp--preset--color--rose-gold);
  color: white;
  transform: scale(1.1);
}

.comparison-remove-btn .material-symbols-outlined {
  font-size: 18px;
}

/* Add to cart button - premium style */
.comparison-add-to-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--wp--preset--spacing--2xs);
  padding: var(--wp--preset--spacing--xs) var(--wp--preset--spacing--md);
  background: var(--wp--preset--gradient--rose-gold-shimmer);
  color: var(--wp--preset--color--white);
  border: none;
  border-radius: var(--wp--custom--radius--md);
  font-weight: 600;
  font-size: var(--wp--preset--font-size--sm);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  text-decoration: none;
}

.comparison-add-to-cart:hover {
  transform: translateY(-2px);
  box-shadow: var(--wp--custom--shadow--glow);
}

.comparison-add-to-cart .material-symbols-outlined {
  font-size: 18px;
}

/* Availability badge */
.comparison-availability {
  display: inline-flex;
  align-items: center;
  gap: var(--wp--preset--spacing--3xs);
  padding: var(--wp--preset--spacing--3xs) var(--wp--preset--spacing--xs);
  border-radius: var(--wp--custom--radius--sm);
  font-size: var(--wp--preset--font-size--xs);
  font-weight: 500;
}

.comparison-availability--in-stock {
  background: var(--wp--preset--color--success-light);
  color: var(--wp--preset--color--success);
}

.comparison-availability--out-of-stock {
  background: var(--wp--preset--color--error-light);
  color: var(--wp--preset--color--error);
}

/* Text cells with truncation */
.comparison-text-cell {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
  font-size: var(--wp--preset--font-size--sm);
  line-height: 1.5;
}

/* Empty state */
.comparison-empty {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: var(--wp--custom--radius--lg);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  max-width: 500px;
  margin: 0 auto;
}

.comparison-empty-icon {
  font-size: 4rem;
  color: var(--wp--preset--color--mist);
  margin-bottom: var(--wp--preset--spacing--md);
}

.comparison-empty h2 {
  font-family: var(--wp--preset--font-family--heading);
  font-size: var(--wp--preset--font-size--xl);
  color: var(--wp--preset--color--charcoal);
  margin-bottom: var(--wp--preset--spacing--xs);
}

.comparison-empty p {
  color: var(--wp--preset--color--slate);
  margin-bottom: var(--wp--preset--spacing--lg);
}

.comparison-empty .btn-shop {
  display: inline-flex;
  align-items: center;
  gap: var(--wp--preset--spacing--2xs);
  padding: var(--wp--preset--spacing--sm) var(--wp--preset--spacing--lg);
  background: var(--wp--preset--gradient--rose-gold-shimmer);
  color: var(--wp--preset--color--white);
  text-decoration: none;
  border-radius: var(--wp--custom--radius--md);
  font-weight: 600;
  transition: transform var(--wp--custom--transition--normal),
    box-shadow var(--wp--custom--transition--normal);
}

.comparison-empty .btn-shop:hover {
  transform: translateY(-2px);
  box-shadow: var(--wp--custom--shadow--glow);
}

/* Hide comparison bar ON the comparison page */
.page-template-page-comparison .comparison-bar {
  display: none !important;
}

/* ===================================
   Responsive
   =================================== */

@media (max-width: 768px) {
  .comparison-bar {
    padding: 0.75rem 1rem;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .comparison-bar__item {
    width: 50px;
    height: 50px;
  }

  .comparison-bar__placeholder {
    width: 50px;
    height: 50px;
  }

  .comparison-bar__btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .comparison-header h1 {
    font-size: 1.75rem;
  }
}

/* ===================================
   Footer Padding when bar is active
   =================================== */
body:has(.comparison-bar.active) .site-footer {
  padding-bottom: 80px;
}

body:has(.comparison-bar.active) .site-content {
  padding-bottom: 80px;
}
