/**
 * Magma Energy – Schnellvergleich (Product Compare) Styling
 * Design System: Clean-Tech Engineering, Glassmorphism, B2B High Contrast
 */

/* =========================================================================
   1. STICKY BOTTOM COMPARE BAR
   ========================================================================= */
.magma-compare-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9990;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
  transform: translateY(115%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 12px 24px;
  color: #ffffff;
  font-family: inherit;
}

.magma-compare-bar.magma-compare-bar--visible {
  transform: translateY(0);
}

.mcb-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.mcb-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.mcb-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.mcb-count {
  background: #186a72;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.mcb-thumbs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mcb-thumb {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.mcb-thumb:hover {
  border-color: #186a72;
  transform: translateY(-2px);
}

.mcb-thumb picture,
.mcb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mcb-thumb .mcb-label {
  display: none;
}

.mcb-thumb--empty {
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  font-size: 1.2rem;
  font-weight: 400;
}

.mcb-remove {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #9b2121;
  color: #ffffff;
  border: none;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  transition: background 0.15s ease, transform 0.15s ease;
  z-index: 2;
}

.mcb-remove:hover {
  background: #dc2626;
  transform: scale(1.15);
}

.mcb-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mcb-compare-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, #1d7b85 0%, #186a72 100%);
  color: #ffffff !important;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 22px;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 4px 14px rgba(24, 106, 114, 0.35);
  transition: all 0.2s ease;
  cursor: pointer;
}

.mcb-compare-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #248e9a 0%, #1c7881 100%);
  box-shadow: 0 6px 18px rgba(24, 106, 114, 0.48);
  transform: translateY(-1px);
}

.mcb-compare-btn:disabled,
.mcb-compare-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.mcb-clear-btn {
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mcb-clear-btn:hover {
  color: #ffffff;
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.06);
}

/* =========================================================================
   2. TOAST NOTIFICATION
   ========================================================================= */
.magma-compare-toast {
  position: fixed;
  bottom: 84px;
  right: 24px;
  z-index: 9999;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.35);
  border-left: 4px solid #186a72;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.magma-compare-toast.magma-compare-toast--show {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================================
   3. COMPARE BUTTONS (CARDS & DETAIL PAGES)
   ========================================================================= */
.magma-compare-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  user-select: none;
}

.magma-compare-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.magma-compare-btn svg {
  flex-shrink: 0;
  transition: stroke 0.2s ease;
}

.magma-compare-btn.magma-compare-btn--active {
  background: rgba(24, 106, 114, 0.08);
  border-color: #186a72;
  color: #186a72;
}

.magma-compare-btn.magma-compare-btn--active svg {
  stroke: #186a72;
}

/* Compact button layout for system-card actions row: Details | Vergleichen | Cart */
.system-card-actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr 42px !important;
  gap: 6px !important;
  align-items: center !important;
  width: 100% !important;
}

.system-card-actions .btn-card-details {
  flex: unset;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b !important;
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 8px;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.system-card-actions .btn-card-details:hover {
  background: #ffffff !important;
  border-color: #186a72 !important;
  color: #186a72 !important;
}

.system-card-actions .magma-compare-btn {
  flex: unset;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1e293b !important;
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 8px;
  white-space: nowrap;
  justify-content: center;
}

.system-card-actions .magma-compare-btn svg {
  stroke: #1e293b !important;
}

.system-card-actions .magma-compare-btn:hover {
  background: #ffffff !important;
  border-color: #186a72 !important;
  color: #186a72 !important;
}

.system-card-actions .magma-compare-btn:hover svg {
  stroke: #186a72 !important;
}

.system-card-actions .magma-compare-btn.magma-compare-btn--active {
  background: #e6f4f5 !important;
  border-color: #186a72 !important;
  color: #186a72 !important;
}

.system-card-actions .magma-compare-btn.magma-compare-btn--active svg {
  stroke: #186a72 !important;
}

/* Cart button: square icon-only in the card actions row */
.system-card-actions .btn-card-cart {
  flex: unset;
  width: 42px;
  height: 42px;
  padding: 0;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  font-size: 0;
  /* hide any remaining text */
}

.system-card-actions .btn-card-cart svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

/* Detail page compare button */
.product-action-buttons .magma-compare-btn {
  height: 50px;
  padding: 0 18px;
  font-size: 0.95rem;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
}

/* Heat pump card compare button */
.catalog-card .magma-compare-btn {
  padding: 7px 12px;
  font-size: 0.78rem;
}

/* =========================================================================
   4. FULL COMPARISON PAGE (/vergleich/)
   ========================================================================= */
.compare-page {
  padding: 40px 0 80px;
  background: #f8fafc;
  min-height: 80vh;
}

.compare-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.compare-actions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.compare-table-wrapper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 40px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 760px;
}

.compare-table col.col-label {
  width: 240px;
}

.compare-table col.col-prod {
  width: 260px;
}

.compare-table th,
.compare-table td {
  padding: 16px 20px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.92rem;
  line-height: 1.5;
}

.compare-table th.col-label,
.compare-table td.col-label {
  font-weight: 700;
  color: #1e293b;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  position: sticky;
  left: 0;
  z-index: 10;
  box-shadow: 2px 0 4px rgba(0,0,0,0.02);
}

/* Category header section */
.compare-section-header td {
  background: #0f172a !important;
  color: #ffffff !important;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 20px;
  border-top: 2px solid #9b2121;
}

/* Product header card row */
.compare-prod-head {
  background: #ffffff;
  padding: 24px 20px 20px;
  position: relative;
  text-align: center;
  border-right: 1px solid #f1f5f9;
}

.compare-prod-remove {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #f1f5f9;
  color: #64748b;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-prod-remove:hover {
  background: #fee2e2;
  color: #dc2626;
  transform: scale(1.1);
}

.compare-prod-img {
  width: 140px;
  height: 140px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  padding: 8px;
}

.compare-prod-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.compare-prod-cat {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9b2121;
  background: rgba(155, 33, 33, 0.08);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.compare-prod-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px;
  line-height: 1.35;
}

.compare-prod-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

.compare-prod-title a:hover {
  color: #9b2121;
}

.compare-prod-price {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 16px;
}

.compare-prod-price small {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  margin-top: 2px;
}

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

.compare-table tr:hover td:not(.col-label) {
  background-color: #fcfdfe;
}

.compare-val-highlight {
  color: #0f172a;
  font-weight: 600;
}

.compare-val-badge {
  display: inline-block;
  background: #dcfce7;
  color: #166534;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

/* Empty State */
.compare-empty-state {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 60px 32px;
  text-align: center;
  max-width: 680px;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.compare-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #fef2f2;
  color: #9b2121;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.compare-empty-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 10px;
}

.compare-empty-text {
  font-size: 1rem;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 28px;
}

.compare-empty-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .magma-compare-bar {
    padding: 10px 14px;
  }
  .mcb-inner {
    gap: 10px;
  }
  .mcb-title {
    font-size: 0.82rem;
  }
  .mcb-thumb {
    width: 44px;
    height: 44px;
  }
  .mcb-compare-btn {
    padding: 8px 14px;
    font-size: 0.82rem;
  }
  .mcb-clear-btn {
    padding: 7px 10px;
    font-size: 0.78rem;
  }
  .compare-table col.col-label {
    width: 160px;
  }
  .compare-table col.col-prod {
    width: 220px;
  }
  .compare-table th,
  .compare-table td {
    padding: 12px 14px;
    font-size: 0.85rem;
  }
}

/* Header compare link */
.header-compare-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  transition: all 0.2s ease;
  margin-right: 4px;
}

.header-compare-link:hover {
  background: #f0fdfa;
  color: #186a72;
  border-color: #99f6e4;
  transform: translateY(-1px);
}

.header-compare-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #186a72;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  line-height: 1;
}
