/* Sprint 9.4.7 - Comparador de productos */
.product-compare-toggle {
  width: 100%;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 10px;
  border: 1px solid rgba(0, 180, 216, 0.42);
  border-radius: 10px;
  background: rgba(0, 180, 216, 0.07);
  color: #c9f6ff;
  font: inherit;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.product-compare-toggle:hover { transform: translateY(-1px); border-color: #38d9ff; background: rgba(0,180,216,.14); }
.product-compare-toggle.is-selected { color: #06131f; border-color: #38d9ff; background: linear-gradient(135deg,#38d9ff,#00b4d8); }

.product-compare-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 1200;
  width: min(760px, calc(100% - 28px));
  transform: translate(-50%, 140%);
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border: 1px solid rgba(56,217,255,.45);
  border-radius: 16px;
  background: rgba(5,18,29,.96);
  box-shadow: 0 16px 46px rgba(0,0,0,.45);
  backdrop-filter: blur(14px);
  transition: transform .24s ease, opacity .24s ease;
}
.product-compare-bar.is-visible { transform: translate(-50%,0); opacity: 1; pointer-events: auto; }
.product-compare-summary { color:#fff; font-weight:800; }
.product-compare-summary small { display:block; margin-top:3px; color:#93a9b8; font-weight:600; }
.product-compare-bar-actions { display:flex; gap:9px; }
.product-compare-bar button { min-height:40px; padding:0 15px; border-radius:10px; font-weight:900; cursor:pointer; }
.product-compare-open { border:0; color:#06131f; background:linear-gradient(135deg,#38d9ff,#00b4d8); }
.product-compare-clear { border:1px solid rgba(255,255,255,.2); color:#fff; background:transparent; }

.product-compare-modal[hidden] { display:none; }
.product-compare-modal { position:fixed; inset:0; z-index:1300; display:grid; place-items:center; padding:22px; }
.product-compare-backdrop { position:absolute; inset:0; background:rgba(0,7,14,.82); backdrop-filter:blur(5px); }
.product-compare-dialog { position:relative; width:min(1080px,100%); max-height:88vh; overflow:auto; border:1px solid rgba(56,217,255,.35); border-radius:18px; background:#071827; color:#fff; box-shadow:0 24px 70px rgba(0,0,0,.58); }
.product-compare-header { position:sticky; top:0; z-index:2; display:flex; align-items:center; justify-content:space-between; gap:20px; padding:18px 20px; border-bottom:1px solid rgba(255,255,255,.09); background:rgba(7,24,39,.97); }
.product-compare-header h2 { margin:0; font-size:1.15rem; }
.product-compare-close { width:40px; height:40px; border:1px solid rgba(255,255,255,.18); border-radius:50%; color:#fff; background:transparent; font-size:1.35rem; cursor:pointer; }
.product-compare-grid { display:grid; grid-template-columns:repeat(3,minmax(220px,1fr)); gap:14px; padding:18px; }
.product-compare-item { overflow:hidden; border:1px solid rgba(255,255,255,.1); border-radius:14px; background:rgba(255,255,255,.035); }
.product-compare-image { height:210px; display:grid; place-items:center; padding:14px; background:rgba(0,0,0,.18); }
.product-compare-image img { width:100%; height:100%; object-fit:contain; }
.product-compare-body { padding:15px; }
.product-compare-body h3 { min-height:44px; margin:0 0 12px; font-size:1rem; }
.product-compare-price { margin:0 0 13px; color:#ffd166; font-size:1.35rem; font-weight:950; }
.product-compare-specs { margin:0; }
.product-compare-specs div { display:flex; justify-content:space-between; gap:14px; padding:9px 0; border-top:1px solid rgba(255,255,255,.08); }
.product-compare-specs dt { color:#91a8b8; }
.product-compare-specs dd { margin:0; text-align:right; font-weight:800; }
.product-compare-item-actions { display:grid; grid-template-columns:1fr auto; gap:8px; margin-top:14px; }
.product-compare-item-actions a,.product-compare-remove { min-height:40px; display:inline-flex; align-items:center; justify-content:center; border-radius:9px; font-weight:900; text-decoration:none; }
.product-compare-item-actions a { color:#06131f; background:#38d9ff; }
.product-compare-remove { border:1px solid rgba(255,255,255,.18); color:#fff; background:transparent; cursor:pointer; padding:0 12px; }
body.compare-modal-open { overflow:hidden; }
@media(max-width:760px){
  .product-compare-bar { align-items:stretch; flex-direction:column; }
  .product-compare-bar-actions { display:grid; grid-template-columns:1fr 1fr; }
  .product-compare-grid { grid-template-columns:1fr; }
  .product-compare-image { height:250px; }
}


/* Sprint 10.2.2 - Integración visual del comparador con el catálogo */
.product-card {
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.product-card.is-compared {
  border-color: rgba(56, 217, 255, .9);
  box-shadow: 0 0 0 2px rgba(56, 217, 255, .18), 0 18px 42px rgba(0, 180, 216, .16);
}

.product-card.is-compared .product-compare-toggle {
  box-shadow: 0 8px 22px rgba(0, 180, 216, .2);
}

.product-compare-toggle:focus-visible {
  outline: 3px solid rgba(255, 209, 102, .95);
  outline-offset: 3px;
}

.product-compare-toggle.is-limit-disabled,
.product-compare-toggle:disabled {
  cursor: not-allowed;
  opacity: .5;
  transform: none;
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .035);
  color: #91a3af;
}

.product-card.compare-limit-reached:not(.is-compared) {
  opacity: .88;
}

.product-compare-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  transition: transform .2s ease;
}

.product-compare-toggle.is-selected .product-compare-icon {
  transform: rotate(-8deg) scale(1.08);
}

.product-compare-toggle.compare-pulse {
  animation: compareCatalogPulse .34s ease;
}

@keyframes compareCatalogPulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.055); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .product-card,
  .product-compare-toggle,
  .product-compare-icon {
    transition: none;
  }

  .product-compare-toggle.compare-pulse {
    animation: none;
  }
}

@media (max-width: 560px) {
  .product-compare-toggle {
    min-height: 44px;
    font-size: .82rem;
  }
}


/* Sprint 10.2.3 - Barra flotante formal del comparador */
.product-compare-bar {
  width: min(920px, calc(100% - 28px));
  padding: 12px 14px;
}

.product-compare-bar-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-compare-bar-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #06131f;
  background: linear-gradient(135deg,#38d9ff,#00b4d8);
  box-shadow: 0 8px 24px rgba(0,180,216,.24);
  font-size: 1.15rem;
}

.product-compare-summary {
  min-width: 170px;
}

.product-compare-summary strong,
.product-compare-summary span {
  display: block;
}

.product-compare-summary strong {
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #38d9ff;
}

.product-compare-summary span {
  margin-top: 1px;
  font-size: .98rem;
}

.product-compare-preview {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.product-compare-preview-item {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 52px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(255,255,255,.07);
  color: #fff;
  font-size: .8rem;
  font-weight: 900;
}

.product-compare-preview-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-compare-preview-item img + span { opacity: 0; }
.product-compare-preview-item.no-image span { opacity: 1; }
.product-compare-open:disabled { cursor: not-allowed; opacity: .5; }
.product-compare-clear:hover { border-color: rgba(255,255,255,.42); background: rgba(255,255,255,.07); }
.product-compare-open:not(:disabled):hover { filter: brightness(1.06); transform: translateY(-1px); }
.product-compare-bar button:focus-visible { outline: 3px solid #ffd166; outline-offset: 3px; }

@media (max-width: 760px) {
  .product-compare-bar { gap: 10px; }
  .product-compare-bar-main { width: 100%; }
  .product-compare-preview { margin-left: auto; }
  .product-compare-summary { min-width: 0; flex: 1; }
}

@media (max-width: 520px) {
  .product-compare-bar { bottom: 10px; width: calc(100% - 18px); padding: 10px; border-radius: 14px; }
  .product-compare-bar-icon { width: 38px; height: 38px; }
  .product-compare-preview-item { width: 30px; height: 38px; border-radius: 6px; }
  .product-compare-summary small { display: none; }
  .product-compare-bar-actions button { min-height: 42px; }
}

/* Sprint 10.2.4 - Página formal de comparación */
.compare-page-body { min-height: 100vh; background: #04111d; color: #fff; }
.compare-page-main { padding: 110px 0 70px; }
.compare-page-hero { padding: 34px 0 18px; }
.compare-page-eyebrow { display:inline-block; margin-bottom:10px; color:#38d9ff; font-size:.78rem; font-weight:900; letter-spacing:.12em; text-transform:uppercase; }
.compare-page-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; }
.compare-page-heading h1 { margin:0 0 8px; font-size:clamp(2rem,5vw,3.5rem); }
.compare-page-heading p { margin:0; color:#9db1bf; }
.compare-page-clear { min-height:44px; padding:0 16px; border:1px solid rgba(255,255,255,.18); border-radius:11px; color:#fff; background:rgba(255,255,255,.04); font-weight:800; cursor:pointer; }
.compare-page-clear:disabled { opacity:.45; cursor:not-allowed; }
.compare-page-section { padding-top:18px; }
.compare-page-status { min-height:24px; margin-bottom:10px; color:#9db1bf; font-weight:700; }
.compare-page-empty { max-width:620px; margin:36px auto 0; padding:42px 24px; text-align:center; border:1px solid rgba(56,217,255,.22); border-radius:20px; background:rgba(255,255,255,.035); }
.compare-page-empty > span { display:block; margin-bottom:14px; font-size:3.2rem; }
.compare-page-empty h2 { margin:0 0 10px; }
.compare-page-empty p { margin:0 0 20px; color:#9db1bf; }
.compare-page-empty a { display:inline-flex; min-height:44px; align-items:center; justify-content:center; padding:0 18px; border-radius:10px; color:#06131f; background:#38d9ff; font-weight:900; text-decoration:none; }
.compare-page-table-wrap { overflow-x:auto; border:1px solid rgba(56,217,255,.22); border-radius:18px; background:rgba(255,255,255,.025); box-shadow:0 20px 55px rgba(0,0,0,.28); }
.compare-page-table { width:100%; min-width:820px; border-collapse:collapse; }
.compare-page-table th,.compare-page-table td { padding:16px; border-right:1px solid rgba(255,255,255,.07); border-bottom:1px solid rgba(255,255,255,.07); vertical-align:middle; }
.compare-page-table thead th { position:relative; background:rgba(8,31,48,.96); }
.compare-feature-column { width:190px; text-align:left; color:#9db1bf; }
.compare-product-column { min-width:210px; text-align:center; }
.compare-product-column strong { display:block; margin:10px 0 8px; }
.compare-product-column a { color:#38d9ff; font-size:.84rem; font-weight:800; text-decoration:none; }
.compare-page-product-image { height:180px; display:grid; place-items:center; }
.compare-page-product-image img { width:100%; height:100%; object-fit:contain; }
.compare-page-product-image span { font-size:3rem; }
.compare-page-remove { position:absolute; top:10px; right:10px; width:34px; height:34px; border:1px solid rgba(255,255,255,.16); border-radius:50%; color:#fff; background:rgba(0,0,0,.28); font-size:1.15rem; cursor:pointer; }
.compare-page-table tbody th { text-align:left; color:#9db1bf; background:rgba(255,255,255,.025); }
.compare-page-table tbody td { text-align:center; font-weight:700; }
.compare-price-row td { background:rgba(255,209,102,.04); }
.compare-page-price { color:#ffd166; font-size:1.28rem; }
.compare-stock { display:inline-flex; padding:6px 10px; border-radius:999px; font-size:.76rem; font-weight:900; }
.compare-stock.is-available { color:#9ff2c4; background:rgba(56,211,130,.12); }
.compare-stock.is-unavailable { color:#ff9b9b; background:rgba(255,91,91,.12); }
.compare-page-table code { color:#b9d6e6; }
.compare-page-clear:focus-visible,.compare-page-remove:focus-visible,.compare-product-column a:focus-visible { outline:3px solid #ffd166; outline-offset:3px; }
@media (max-width:760px) {
  .compare-page-main { padding-top:86px; }
  .compare-page-heading { align-items:stretch; flex-direction:column; }
  .compare-page-clear { width:100%; }
  .compare-page-nav { display:flex; }
}

/* Sprint 10.2.5 - Comparación inteligente */
.compare-smart-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.compare-smart-card {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px;
  border: 1px solid rgba(56,217,255,.18);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(56,217,255,.075), rgba(255,255,255,.025));
}

.compare-smart-card > span {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(56,217,255,.12);
  font-size: 1.05rem;
}

.compare-smart-card div { min-width: 0; }
.compare-smart-card small { display: block; color: #8ea7b8; font-size: .7rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.compare-smart-card strong { display: block; overflow: hidden; margin-top: 3px; color: #fff; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.compare-smart-card p { margin: 4px 0 0; color: #bcd0dc; font-size: .78rem; }

.compare-page-table td.compare-smart-winner {
  position: relative;
  background: linear-gradient(145deg, rgba(56,217,255,.13), rgba(255,209,102,.075));
  box-shadow: inset 0 0 0 1px rgba(56,217,255,.28);
}

.compare-smart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 7px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #07141e;
  background: linear-gradient(135deg, #ffd166, #38d9ff);
  font-size: .66rem;
  font-weight: 950;
  letter-spacing: .02em;
}

.compare-offer-value {
  display: block;
  color: #9ff2c4;
  font-size: 1.05rem;
  font-weight: 950;
}

.compare-offer-saving {
  display: block;
  margin-top: 3px;
  color: #afc4d0;
  font-size: .7rem;
}

@media (max-width: 760px) {
  .compare-smart-summary { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .compare-smart-card,
  .compare-page-table td.compare-smart-winner { transition: none; }
}


/* Sprint 10.2.6 - Acciones rápidas */
.compare-actions-row td{padding:12px;background:rgba(56,217,255,.025)}
.compare-quick-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;min-width:190px}
.compare-action-button{min-height:38px;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:7px 9px;border:1px solid rgba(255,255,255,.14);border-radius:9px;color:#dbeaf2;background:rgba(255,255,255,.045);font:inherit;font-size:.72rem;font-weight:850;text-decoration:none;cursor:pointer;transition:transform .16s ease,border-color .16s ease,background .16s ease}
.compare-action-button:hover:not(:disabled){transform:translateY(-1px);border-color:rgba(56,217,255,.55);background:rgba(56,217,255,.1)}
.compare-action-button.is-primary{color:#06131f;border-color:transparent;background:linear-gradient(135deg,#38d9ff,#00b4d8)}
.compare-action-button.is-active{color:#ffb6c8;border-color:rgba(255,99,132,.45);background:rgba(255,99,132,.12)}
.compare-action-button.is-danger{color:#ffaaaa}.compare-action-button:disabled{opacity:.45;cursor:not-allowed}
.compare-action-button:focus-visible{outline:3px solid #ffd166;outline-offset:2px}
.compare-action-toast{position:fixed;z-index:1400;right:18px;bottom:18px;max-width:min(360px,calc(100% - 36px));padding:13px 16px;border:1px solid rgba(56,217,255,.3);border-radius:12px;color:#fff;background:#0b2233;box-shadow:0 16px 40px rgba(0,0,0,.35);font-weight:800;opacity:0;pointer-events:none;transform:translateY(14px);transition:opacity .2s ease,transform .2s ease}
.compare-action-toast.is-visible{opacity:1;transform:translateY(0)}
.compare-action-toast[data-type="success"]{border-color:rgba(56,211,130,.5)}.compare-action-toast[data-type="error"]{border-color:rgba(255,91,91,.55)}.compare-action-toast[data-type="warning"]{border-color:rgba(255,209,102,.55)}
@media(max-width:760px){.compare-quick-actions{grid-template-columns:1fr;min-width:150px}.compare-action-button{min-height:42px}}
@media(prefers-reduced-motion:reduce){.compare-action-button,.compare-action-toast{transition:none}}


/* Sprint 10.2.7 - Optimización, estabilidad y cierre responsivo */
.compare-page-table-wrap {
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}
.compare-page-product-image img {
  content-visibility: auto;
  contain-intrinsic-size: 210px 180px;
}
.compare-page-table td,
.compare-page-table th {
  contain: paint;
}
@media (max-width: 760px) {
  .compare-page-table thead .compare-feature-column,
  .compare-page-table tbody th {
    position: sticky;
    left: 0;
    z-index: 4;
    box-shadow: 8px 0 18px rgba(0,0,0,.22);
  }
  .compare-page-table thead .compare-feature-column { z-index: 6; }
  .compare-page-table tbody th { background: #091a28; }
}
@media (prefers-reduced-motion: reduce) {
  .product-compare-bar,
  .product-compare-toggle,
  .compare-action-toast,
  .compare-page-clear,
  .compare-page-remove,
  .compare-action-button {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
@media print {
  .site-header,
  .compare-page-clear,
  .compare-page-remove,
  .compare-actions-row,
  .compare-action-toast { display: none !important; }
  .compare-page-main { padding-top: 0; }
  .compare-page-table-wrap { overflow: visible; border-color: #bbb; box-shadow: none; }
  .compare-page-table { min-width: 0; color: #000; background: #fff; }
}
