/* ── HabitatCart — Drawer, Badge, Toast ── */

/* Admin link */
.hc-admin-link {
  display: flex;
  align-items: center;
  color: var(--accent, #e85d04);
  opacity: 0.6;
  transition: opacity 0.15s;
}
.hc-admin-link:hover { opacity: 1; }

/* Topbar "Konfiguruj" link */
.hc-config-link {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary, rgba(255,255,255,0.5));
  text-decoration: none;
  transition: color 0.15s;
}
.hc-config-link:hover { color: var(--accent, #e85d04); }

/* Topbar cart button */
.hc-topbar-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary, rgba(255,255,255,0.5));
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.hc-topbar-btn:hover { color: var(--text-primary, #fff); }
.hc-topbar-btn svg { opacity: 0.6; transition: opacity 0.15s; }
.hc-topbar-btn:hover svg { opacity: 1; }

/* Cart hover stripe — full-width topbar extension (matches mega-menu style) */
.hc-cart-popover {
  position: fixed;
  top: 48px;
  left: 0;
  right: 0;
  background: var(--glass-bg-heavy, rgba(10,10,10,0.96));
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 16px 48px;
  display: flex;
  align-items: center;
  gap: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, visibility 0.2s, transform 0.2s ease;
  pointer-events: none;
  z-index: 998;
}
.hc-cart-popover.hc-popover-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.hc-cart-popover.hc-cart-popover-empty { display: none; }
.hc-drawer-active .hc-cart-popover { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; }

/* Item list — horizontal, right-justified */
.hc-popover-list {
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
  margin-left: auto;
}
.hc-popover-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 4px 28px;
  border-right: 1px solid rgba(255,255,255,0.07);
}
.hc-popover-item:first-child { padding-left: 0; }
.hc-popover-item-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-primary, #fff);
  white-space: nowrap;
}
.hc-popover-item-price {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary, rgba(255,255,255,0.45));
  white-space: nowrap;
}
.hc-popover-discount {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 4px 28px;
  border-right: 1px solid rgba(255,255,255,0.07);
}
.hc-popover-discount-amount {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent, #e85d04);
  white-space: nowrap;
}
.hc-popover-discount-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--accent, #e85d04);
  opacity: 0.7;
  white-space: nowrap;
}

/* Summary — right side */
.hc-popover-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  padding-left: 48px;
}
.hc-cart-popover-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}
.hc-cart-popover-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #fff);
  white-space: nowrap;
}
.hc-cart-popover-btn {
  padding: 9px 20px;
  background: var(--accent, #e85d04);
  color: #fff;
  border: none;
  border-radius: 0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.hc-cart-popover-btn:hover { opacity: 0.8; }

/* Light mode */
[data-theme="light"] .hc-cart-popover {
  background: rgba(245,245,245,0.97);
  border-bottom-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .hc-cart-popover-label { color: rgba(0,0,0,0.4); }
[data-theme="light"] .hc-cart-popover-price { color: #111; }
[data-theme="light"] .hc-popover-item { border-right-color: rgba(0,0,0,0.08); }
[data-theme="light"] .hc-popover-item-name { color: #111; }
[data-theme="light"] .hc-popover-item-price { color: rgba(0,0,0,0.45); }
[data-theme="light"] .hc-popover-discount { border-right-color: rgba(0,0,0,0.08); }
[data-theme="light"] .hc-cart-popover-btn { background: var(--accent, #e85d04); color: #fff; }

/* Badge */
.hc-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  background: #e85d04;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* Drawer backdrop */
.hc-drawer { display: contents; }
.hc-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.hc-drawer-open .hc-drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* On configurator: match sidebar width exactly — desktop only (mobile gets full width) */
@media (min-width: 769px) {
  body:has(.configurator) .hc-drawer-panel {
    width: 480px;
    max-width: 480px;
  }
}
@media (min-width: 1800px) {
  body:has(.configurator) .hc-drawer-panel {
    width: 540px;
    max-width: 540px;
  }
}

/* Drawer panel */
.hc-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  width: 440px;
  max-width: 90vw;
  background: var(--bg, #0a0a0a);
  border-left: 1px solid var(--border, rgba(255,255,255,0.06));
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.hc-drawer-open .hc-drawer-panel {
  transform: translateX(0);
}

/* Header */
.hc-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
  flex-shrink: 0;
}
.hc-drawer-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-primary, #fff);
}
.hc-drawer-close {
  background: none;
  border: none;
  color: var(--text-secondary, rgba(255,255,255,0.5));
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s;
}
.hc-drawer-close:hover { color: var(--text-primary, #fff); }

/* Empty state */
.hc-drawer-empty {
  padding: 60px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary, rgba(255,255,255,0.5));
}

/* Item list */
.hc-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 24px;
}

/* Section label */
.hc-drawer-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-secondary, rgba(255,255,255,0.3));
  padding: 16px 0 6px;
}
.hc-drawer-section:first-child { padding-top: 4px; }

/* Section subtotal */
.hc-section-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, rgba(255,255,255,0.35));
  padding: 8px 0 4px;
  border-top: 1px solid var(--border, rgba(255,255,255,0.06));
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.hc-section-total span:last-child {
  color: var(--text-primary, #fff);
  font-size: 13px;
}

/* SNAP auto row */
.hc-item-snap { opacity: 0.7; }
.hc-item-qty-auto {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary, rgba(255,255,255,0.4));
  min-width: 54px;
  justify-content: center;
}


/* Single item */
.hc-item {
  display: grid;
  grid-template-columns: 56px 1fr auto auto auto;
  column-gap: 12px;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
}
.hc-item:last-child { border-bottom: none; }

/* Thumbnail */
.hc-item-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.hc-item-thumb picture { display: flex; align-items: center; justify-content: center; }
.hc-item-thumb img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  display: block;
}

.hc-item-info { min-width: 0; }
.hc-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hc-item-color {
  display: none;
}
.hc-item-meta {
  font-size: 11px;
  color: var(--text-secondary, rgba(255,255,255,0.35));
  margin-top: 2px;
}

/* Quantity */
.hc-item-qty {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-primary, #fff);
}
.hc-qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  background: none;
  color: var(--text-secondary, rgba(255,255,255,0.5));
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.hc-qty-btn:hover {
  border-color: var(--text-secondary, rgba(255,255,255,0.3));
  color: var(--text-primary, #fff);
}

/* Price */
.hc-item-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  white-space: nowrap;
  min-width: 48px;
  text-align: right;
}

/* Remove */
.hc-item-remove {
  background: none;
  border: none;
  color: var(--text-secondary, rgba(255,255,255,0.25));
  font-size: 12px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s;
}
.hc-item-remove:hover { color: #e53935; }

/* Footer */
.hc-drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border, rgba(255,255,255,0.06));
  flex-shrink: 0;
}
.hc-drawer-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary, rgba(255,255,255,0.5));
}
.hc-drawer-total {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent, #e85d04);
}
.hc-drawer-order {
  width: 100%;
  padding: 14px;
  background: var(--text-primary, #fff);
  color: var(--bg, #0a0a0a);
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.hc-drawer-order:hover {
  background: #e85d04;
  color: #fff;
}
.hc-drawer-clear {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-align: center;
  color: #e85d04;
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 0.15s;
}
.hc-drawer-clear:hover { opacity: 1; }

/* Preview hint */

.hc-preview-hint {
  padding: 16px 0;
  text-align: center;
}
.hc-preview-hint a {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent, #e85d04);
  text-decoration: none;
  letter-spacing: 0.3px;
  transition: opacity 0.15s;
}
.hc-preview-hint a:hover { opacity: 0.7; }

/* Upsell hint */
.hc-upsell {
  padding: 12px 0;
  font-size: 12px;
  color: var(--accent, #e85d04);
  border: 1.5px solid var(--accent, #e85d04);
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 12px;
  line-height: 1.5;
}
.hc-upsell-add {
  display: inline-block;
  font-weight: 600;
  color: var(--accent, #e85d04);
  text-decoration: underline;
  cursor: pointer;
  margin-top: 4px;
}
.hc-upsell-add:hover {
  text-decoration: none;
}

/* Toast */
.hc-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary, #fff);
  color: var(--bg, #0a0a0a);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: 8px;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.hc-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Body lock when drawer open */
body.hc-drawer-active { overflow: hidden; }

/* Mobile */
@media (max-width: 768px) {
  .hc-drawer-panel {
    width: 100%;
    max-width: 100%;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    border-left: none;
    border-top: 1px solid var(--border, rgba(255,255,255,0.06));
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  .hc-drawer-open .hc-drawer-panel {
    transform: translateY(0);
  }
  .hc-toast { bottom: 165px; }
}

/* Light mode adjustments */
[data-theme="light"] .hc-topbar-btn { color: rgba(0,0,0,0.45); }
[data-theme="light"] .hc-topbar-btn:hover { color: #111; }
[data-theme="light"] .hc-drawer-panel {
  background: #f5f5f5;
  border-left-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .hc-drawer-header { border-bottom-color: rgba(0,0,0,0.06); }
[data-theme="light"] .hc-drawer-title { color: #111; }
[data-theme="light"] .hc-drawer-close { color: rgba(0,0,0,0.4); }
[data-theme="light"] .hc-drawer-close:hover { color: #111; }
[data-theme="light"] .hc-drawer-empty { color: #666; }
[data-theme="light"] .hc-drawer-section { color: rgba(0,0,0,0.3); }
[data-theme="light"] .hc-item-thumb { background: rgba(0,0,0,0.04); }
[data-theme="light"] .hc-item-name { color: #111; }
[data-theme="light"] .hc-item-meta { color: #999; }
[data-theme="light"] .hc-item-qty { color: #111; }
[data-theme="light"] .hc-qty-btn { border-color: rgba(0,0,0,0.12); color: #666; }
[data-theme="light"] .hc-qty-btn:hover { border-color: rgba(0,0,0,0.3); color: #111; }
[data-theme="light"] .hc-item-price { color: #111; }
[data-theme="light"] .hc-item-remove { color: rgba(0,0,0,0.25); }
[data-theme="light"] .hc-item { border-bottom-color: rgba(0,0,0,0.06); }
[data-theme="light"] .hc-drawer-footer { border-top-color: rgba(0,0,0,0.06); }
[data-theme="light"] .hc-drawer-total-row { color: #666; }
[data-theme="light"] .hc-drawer-order { background: #111; color: #fff; }
[data-theme="light"] .hc-toast { background: #111; color: #fff; }

/* ─── OS-preference light mode ─────────────────────────
   Mirrors the [data-theme="light"] rules but fires via
   @media (prefers-color-scheme: light). Scoped with
   html:not([data-theme="dark"]) so pages forcing dark
   (e.g. idea.html) aren't overridden when OS is light. */
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .hc-cart-popover {
    background: rgba(245,245,245,0.97);
    border-bottom-color: rgba(0,0,0,0.08);
  }
  html:not([data-theme="dark"]) .hc-cart-popover-label { color: rgba(0,0,0,0.4); }
  html:not([data-theme="dark"]) .hc-cart-popover-price { color: #111; }
  html:not([data-theme="dark"]) .hc-popover-item { border-right-color: rgba(0,0,0,0.08); }
  html:not([data-theme="dark"]) .hc-popover-item-name { color: #111; }
  html:not([data-theme="dark"]) .hc-popover-item-price { color: rgba(0,0,0,0.45); }
  html:not([data-theme="dark"]) .hc-popover-discount { border-right-color: rgba(0,0,0,0.08); }
  html:not([data-theme="dark"]) .hc-cart-popover-btn { background: var(--accent, #e85d04); color: #fff; }
  html:not([data-theme="dark"]) .hc-topbar-btn { color: rgba(0,0,0,0.45); }
  html:not([data-theme="dark"]) .hc-topbar-btn:hover { color: #111; }
  html:not([data-theme="dark"]) .hc-drawer-panel {
    background: #f5f5f5;
    border-left-color: rgba(0,0,0,0.06);
  }
  html:not([data-theme="dark"]) .hc-drawer-header { border-bottom-color: rgba(0,0,0,0.06); }
  html:not([data-theme="dark"]) .hc-drawer-title { color: #111; }
  html:not([data-theme="dark"]) .hc-drawer-close { color: rgba(0,0,0,0.4); }
  html:not([data-theme="dark"]) .hc-drawer-close:hover { color: #111; }
  html:not([data-theme="dark"]) .hc-drawer-empty { color: #666; }
  html:not([data-theme="dark"]) .hc-drawer-section { color: rgba(0,0,0,0.3); }
  html:not([data-theme="dark"]) .hc-item-thumb { background: rgba(0,0,0,0.04); }
  html:not([data-theme="dark"]) .hc-item-name { color: #111; }
  html:not([data-theme="dark"]) .hc-item-meta { color: #999; }
  html:not([data-theme="dark"]) .hc-item-qty { color: #111; }
  html:not([data-theme="dark"]) .hc-qty-btn { border-color: rgba(0,0,0,0.12); color: #666; }
  html:not([data-theme="dark"]) .hc-qty-btn:hover { border-color: rgba(0,0,0,0.3); color: #111; }
  html:not([data-theme="dark"]) .hc-item-price { color: #111; }
  html:not([data-theme="dark"]) .hc-item-remove { color: rgba(0,0,0,0.25); }
  html:not([data-theme="dark"]) .hc-item { border-bottom-color: rgba(0,0,0,0.06); }
  html:not([data-theme="dark"]) .hc-drawer-footer { border-top-color: rgba(0,0,0,0.06); }
  html:not([data-theme="dark"]) .hc-drawer-total-row { color: #666; }
  html:not([data-theme="dark"]) .hc-drawer-order { background: #111; color: #fff; }
  html:not([data-theme="dark"]) .hc-toast { background: #111; color: #fff; }
}
