/* ================================================================
   Metal-Fach Compare – compare.css v2.0
   Brand: #9b2321 carmine, #152025 graphite, #e7e9e9 grey, #f4f5f5 light
   Fonts: Oxanium 400 (headings), Outfit 300 (body)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Oxanium:wght@400;600;700&family=Outfit:wght@300;400;500&display=swap');

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --mfc-red:        #9b2321;
  --mfc-red-dark:   #7a1b19;
  --mfc-red-light:  #f5e8e8;
  --mfc-graphite:   #152025;
  --mfc-graphite-70:#3e5159;
  --mfc-grey:       #e7e9e9;
  --mfc-light:      #f4f5f5;
  --mfc-white:      #ffffff;
  --mfc-green:      #1a5c2e;
  --mfc-green-bg:   #e8f5ec;
  --mfc-orange:     #7a3b00;
  --mfc-orange-bg:  #fff4e6;
  --mfc-purple:     #4a235a;
  --mfc-purple-bg:  #f5eef8;

  --mfc-font-head:  'Oxanium', sans-serif;
  --mfc-font-body:  'Outfit', sans-serif;
  --mfc-radius:     6px;
  --mfc-shadow:     0 4px 24px rgba(21,32,37,.12);
  --mfc-transition: .2s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
.mfc-compare-btn, .mfc-panel, .mfc-compare-page,
.mfc-btn, .mfc-table-wrap, .mfc-compare-drawer {
  box-sizing: border-box;
  font-family: var(--mfc-font-body);
  font-weight: 300;
}

/* ================================================================
   PRZYCISK "PORÓWNAJ" (na karcie produktu)
   ================================================================ */
.mfc-compare-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: transparent;
  border: 1.5px solid var(--mfc-grey);
  border-radius: var(--mfc-radius);
  color: var(--mfc-graphite);
  font-family: var(--mfc-font-body);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: border-color var(--mfc-transition), background var(--mfc-transition), color var(--mfc-transition);
  white-space: nowrap;
}
.mfc-compare-btn svg { flex-shrink: 0; transition: stroke var(--mfc-transition); }
.mfc-compare-btn:hover {
  border-color: var(--mfc-red);
  color: var(--mfc-red);
  background: var(--mfc-red-light);
}
.mfc-compare-btn.is-active {
  border-color: var(--mfc-red);
  background: var(--mfc-red);
  color: var(--mfc-white);
}
.mfc-compare-btn.is-active svg { stroke: var(--mfc-white); }
.mfc-compare-btn.is-active:hover {
  background: var(--mfc-red-dark);
  border-color: var(--mfc-red-dark);
}

/* ================================================================
   PANEL BOCZNY WYSUWANY (desktop/tablet)
   ================================================================ */
.mfc-panel {
  position: fixed;
  right: 0;
  bottom: 80px;
  z-index: 9990;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  pointer-events: none;
}

/* Uchwyt – widoczny zawsze jeśli coś w koszyku */
.mfc-panel__handle {
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 44px;
  padding: 14px 0;
  background: var(--mfc-red);
  color: var(--mfc-white);
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  box-shadow: -3px 0 12px rgba(0,0,0,.18);
  transition: width var(--mfc-transition), background var(--mfc-transition);
  transform: translateX(0);
  opacity: 0;
  transition: opacity var(--mfc-transition), transform .3s ease;
}
.mfc-panel--visible .mfc-panel__handle {
  opacity: 1;
}
.mfc-panel__handle:hover { background: var(--mfc-red-dark); }

.mfc-panel__handle-icon {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-family: var(--mfc-font-head);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.mfc-panel__count {
  background: var(--mfc-white);
  color: var(--mfc-red);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--mfc-font-head);
  line-height: 1;
}

/* Drawer – wysuwany panel z miniaturkami */
.mfc-panel__drawer {
  pointer-events: all;
  width: 300px;
  background: var(--mfc-white);
  border-radius: 12px 0 0 12px;
  box-shadow: var(--mfc-shadow);
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.mfc-panel--open .mfc-panel__drawer {
  transform: translateX(0);
}

.mfc-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--mfc-grey);
  flex-shrink: 0;
}
.mfc-drawer-header__title {
  font-family: var(--mfc-font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--mfc-graphite);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.mfc-drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--mfc-graphite-70);
  border-radius: 4px;
  transition: background var(--mfc-transition);
}
.mfc-drawer-close:hover { background: var(--mfc-light); }

.mfc-drawer-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.mfc-drawer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  transition: background var(--mfc-transition);
}
.mfc-drawer-item:hover { background: var(--mfc-light); }
.mfc-drawer-item__img {
  width: 52px;
  height: 40px;
  object-fit: contain;
  border-radius: 4px;
  background: var(--mfc-light);
  flex-shrink: 0;
}
.mfc-drawer-item__img--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mfc-grey);
}
.mfc-drawer-item__info { flex: 1; min-width: 0; }
.mfc-drawer-item__model {
  font-family: var(--mfc-font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--mfc-graphite);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mfc-drawer-item__variant {
  font-size: 12px;
  color: var(--mfc-graphite-70);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mfc-drawer-item__remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--mfc-graphite-70);
  border-radius: 4px;
  flex-shrink: 0;
  transition: color var(--mfc-transition), background var(--mfc-transition);
}
.mfc-drawer-item__remove:hover { color: var(--mfc-red); background: var(--mfc-red-light); }

.mfc-drawer-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--mfc-grey);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.mfc-drawer-footer__info {
  font-size: 12px;
  color: var(--mfc-graphite-70);
  text-align: center;
}

/* ================================================================
   MOBILE – pasek na dole
   ================================================================ */
.mfc-mobile-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9990;
  background: var(--mfc-graphite);
  color: var(--mfc-white);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(100%);
  transition: transform .3s ease;
  box-shadow: 0 -4px 16px rgba(0,0,0,.25);
}
.mfc-mobile-bar--visible { transform: translateY(0); }
.mfc-mobile-bar__thumbs {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow: hidden;
}
.mfc-mobile-thumb {
  width: 40px;
  height: 32px;
  border-radius: 4px;
  object-fit: contain;
  background: rgba(255,255,255,.1);
  flex-shrink: 0;
}
.mfc-mobile-bar__btn {
  flex-shrink: 0;
  white-space: nowrap;
}
.mfc-mobile-bar__clear {
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 12px;
  font-family: var(--mfc-font-body);
  transition: color var(--mfc-transition);
  flex-shrink: 0;
}
.mfc-mobile-bar__clear:hover { color: var(--mfc-white); }

/* ================================================================
   PRZYCISKI
   ================================================================ */
.mfc-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--mfc-radius);
  font-family: var(--mfc-font-body);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--mfc-transition);
  text-decoration: none;
  white-space: nowrap;
}
.mfc-btn--primary {
  background: var(--mfc-red);
  color: var(--mfc-white);
  border-color: var(--mfc-red);
}
.mfc-btn--primary:hover {
  background: var(--mfc-red-dark);
  border-color: var(--mfc-red-dark);
  color: var(--mfc-white);
}
.mfc-btn--ghost {
  background: transparent;
  color: var(--mfc-graphite);
  border-color: var(--mfc-grey);
}
.mfc-btn--ghost:hover {
  border-color: var(--mfc-graphite);
  background: var(--mfc-light);
}
.mfc-btn--sm { padding: 7px 14px; font-size: 13px; }
.mfc-btn--full { width: 100%; justify-content: center; }
.mfc-btn--active {
  background: var(--mfc-graphite);
  color: var(--mfc-white);
  border-color: var(--mfc-graphite);
}

/* ================================================================
   STRONA PORÓWNANIA /porownanie/
   ================================================================ */
.mfc-compare-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  font-family: var(--mfc-font-body);
}

.mfc-compare-page__header {
  margin-bottom: 28px;
}
.mfc-compare-page__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}
.mfc-compare-page__title {
  font-family: var(--mfc-font-head);
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 400;
  color: var(--mfc-graphite);
  margin: 0;
}
.mfc-compare-page__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.mfc-compare-page__subtitle {
  font-size: 14px;
  color: var(--mfc-graphite-70);
  margin: 0;
}

/* ── Loading / Empty ────────────────────────────────────────── */
.mfc-compare-loading, .mfc-compare-empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--mfc-graphite-70);
}
.mfc-compare-empty svg { color: var(--mfc-grey); margin-bottom: 16px; }
.mfc-compare-empty p { font-size: 16px; margin: 0 0 20px; }

.mfc-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--mfc-grey);
  border-top-color: var(--mfc-red);
  border-radius: 50%;
  animation: mfc-spin .8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes mfc-spin { to { transform: rotate(360deg); } }

/* ── Kategoria label ────────────────────────────────────────── */
.mfc-category-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0 16px;
  border-bottom: 2px solid var(--mfc-red);
  margin-bottom: 0;
}
.mfc-category-bar__name {
  font-family: var(--mfc-font-head);
  font-size: 18px;
  font-weight: 400;
  color: var(--mfc-graphite);
}
.mfc-category-bar__actions { display: flex; gap: 8px; }

/* ── Tabela porównania ──────────────────────────────────────── */
.mfc-table-outer {
  overflow: visible;
  position: relative;
  margin-bottom: 48px;
}

.mfc-table-wrap {
  overflow-x: auto;
  overflow-y: visible; /* NIE hidden/auto – pozwala sticky działać */
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 var(--mfc-radius) var(--mfc-radius);
}
/* Gdy tabela jest w kontenerze ze scrollem pionowym,
   sticky wymaga że ŻADEN ancestor nie ma overflow:hidden/auto w pionie */
.mfc-table-outer {
  overflow: visible;
}

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

/* Kolumna etykiet */
.mfc-cell--label {
  width: 240px;
  min-width: 200px;
  text-align: left;
  background: var(--mfc-light);
  position: sticky;
  left: 0;
  z-index: 2;
  font-size: 13px;
  color: var(--mfc-graphite);
  font-weight: 400;
  padding: 10px 16px;
  border-bottom: 1px solid var(--mfc-grey);
  border-right: 1px solid var(--mfc-grey);
  word-break: break-word;
}
.mfc-cell--label.shadow { box-shadow: 3px 0 8px rgba(0,0,0,.08); }

/* Kolumna modelu */
.mfc-cell--model {
  width: 200px;
  min-width: 160px;
  text-align: center;
  vertical-align: middle;
  padding: 10px 12px;
  border-bottom: 1px solid var(--mfc-grey);
  border-right: 1px solid var(--mfc-grey);
  font-size: 13px;
  color: var(--mfc-graphite);
}

/* ── Wiersz zdjęć / nagłówek modeli – STICKY ───────────────── */
.mfc-row--models th {
  /* Sticky działa na th/td, nie tr – każda komórka musi być sticky */
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--mfc-white);
  border-bottom: 2px solid var(--mfc-grey);
  vertical-align: top;
}
.mfc-row--models .mfc-cell--label {
  z-index: 4; /* wyżej niż model cells bo sticky left + top */
  font-size: 12px;
  color: var(--mfc-graphite-70);
  font-style: italic;
  background: var(--mfc-white);
}
.mfc-row--models .mfc-cell--model {
  padding: 12px 8px 10px;
}

.mfc-model-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}
.mfc-model-card__img-wrap {
  width: 100%;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mfc-light);
  border-radius: 4px;
  overflow: hidden;
}
.mfc-model-card__img {
  max-width: 100%;
  max-height: 90px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.mfc-model-card__img--placeholder {
  color: var(--mfc-grey);
  font-size: 28px;
}
.mfc-model-card__model {
  font-family: var(--mfc-font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--mfc-graphite);
  text-align: center;
}
.mfc-model-card__variant {
  font-size: 12px;
  color: var(--mfc-graphite-70);
  text-align: center;
  line-height: 1.3;
}
.mfc-model-card__link {
  font-size: 11px;
  color: var(--mfc-red);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 3px;
}
.mfc-model-card__link:hover { text-decoration: underline; }
.mfc-model-card__remove {
  position: absolute;
  top: 0; right: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--mfc-graphite-70);
  line-height: 1;
  border-radius: 4px;
  transition: color var(--mfc-transition);
}
.mfc-model-card__remove:hover { color: var(--mfc-red); }

/* Nav arrows – w pierwszym wierszu nagłówka, widoczne */
.mfc-nav-arrows {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 4px 6px 2px;
}
.mfc-nav-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--mfc-white);
  border: 2px solid var(--mfc-grey);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: all var(--mfc-transition);
  flex-shrink: 0;
  padding: 0;
}
.mfc-nav-arrow img {
  width: 18px;
  height: 18px;
  display: block;
  filter: brightness(0) saturate(100%) invert(17%) sepia(15%) saturate(600%) hue-rotate(155deg) brightness(95%);
  transition: filter var(--mfc-transition);
}
.mfc-nav-arrow:hover {
  background: var(--mfc-red);
  border-color: var(--mfc-red);
  box-shadow: 0 4px 14px rgba(155,35,33,.30);
}
.mfc-nav-arrow:hover img { filter: brightness(0) invert(1); }
.mfc-nav-arrow:disabled { opacity: .28; cursor: not-allowed; pointer-events: none; }

/* ── Section header row ─────────────────────────────────────── */
.mfc-row--section .mfc-cell--label,
.mfc-row--section td {
  background: var(--mfc-graphite);
  color: var(--mfc-white);
  font-family: var(--mfc-font-head);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 7px 16px;
  border-bottom: none;
  border-right: 1px solid rgba(255,255,255,.1);
  position: sticky;
  left: 0;
}

/* ── Tech rows ──────────────────────────────────────────────── */
.mfc-row--tech:nth-child(even) .mfc-cell--label,
.mfc-row--tech:nth-child(even) .mfc-cell--model {
  background: var(--mfc-light);
}
.mfc-cell--tech-val {
  font-weight: 400;
  font-size: 13px;
}

/* ── Equip rows ─────────────────────────────────────────────── */
.mfc-val-S { background: var(--mfc-green-bg) !important; }
.mfc-val-S .mfc-equip-icon { color: var(--mfc-green); }
.mfc-val-O { background: var(--mfc-orange-bg) !important; }
.mfc-val-O .mfc-equip-icon { color: var(--mfc-orange); }
.mfc-val-T { background: var(--mfc-purple-bg) !important; }
.mfc-val-T .mfc-equip-icon { color: var(--mfc-purple); }
.mfc-val-dash { }
.mfc-val-dash .mfc-equip-icon { color: var(--mfc-grey); }

.mfc-equip-icon {
  font-size: 16px;
  line-height: 1;
  display: block;
}

/* ── Różnice (diff mode) ────────────────────────────────────── */
.mfc-diff-mode .mfc-row--diff .mfc-cell--label {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  font-weight: 500;
}
.mfc-diff-mode .mfc-row--diff .mfc-cell--model {
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
}

/* ── Legenda ─────────────────────────────────────────────────── */
.mfc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--mfc-grey);
  margin-top: 8px;
}
.mfc-legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--mfc-graphite-70);
}
.mfc-legend__dot {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.mfc-legend__dot--S { background: var(--mfc-green-bg); color: var(--mfc-green); }
.mfc-legend__dot--O { background: var(--mfc-orange-bg); color: var(--mfc-orange); }
.mfc-legend__dot--T { background: var(--mfc-purple-bg); color: var(--mfc-purple); }
.mfc-legend__dot--dash { background: var(--mfc-grey); color: #888; }

/* ── Toast ──────────────────────────────────────────────────── */
.mfc-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--mfc-graphite);
  color: var(--mfc-white);
  padding: 11px 22px;
  border-radius: 8px;
  font-family: var(--mfc-font-body);
  font-size: 14px;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--mfc-shadow);
}
.mfc-toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* Tablet */
@media (max-width: 1024px) {
  .mfc-cell--label { width: 200px; min-width: 160px; }
}

/* Mobile – panel boczny ukryty, pasek na dole */
@media (max-width: 767px) {
  .mfc-panel { display: none; }

  .mfc-compare-page { padding: 20px 16px 80px; }
  .mfc-compare-page__title { font-size: 20px; }

  .mfc-cell--label { width: 140px; min-width: 120px; font-size: 12px; padding: 8px 10px; }
  .mfc-cell--model { width: 130px; min-width: 120px; font-size: 12px; padding: 8px 8px; }
  .mfc-model-card__img-wrap { height: 60px; }
  .mfc-model-card__model { font-size: 12px; }
  .mfc-model-card__variant { font-size: 11px; }

  .mfc-nav-arrow { width: 28px; height: 28px; }
  .mfc-nav-arrow--prev { left: 144px; }

  .mfc-mobile-bar { display: flex; }
}

@media (min-width: 768px) {
  .mfc-mobile-bar { display: none !important; }
}

/* Screen reader */
.mfc-sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Print */
@media print {
  .mfc-panel, .mfc-mobile-bar, .mfc-toast,
  .mfc-nav-arrow, .mfc-compare-page__actions { display: none !important; }
  .mfc-cell--label { position: static; }
}
