/* ═══════════ HEADER + DOCK estilo macOS ═══════════ */

.glass-mac {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 8px 24px -8px rgba(0,0,0,0.18),
    0 24px 48px -16px rgba(0,0,0,0.22);
}

/* ── Header chips ── */
.hdr-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  font-size: 11px;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 140ms;
  white-space: nowrap;
}
.hdr-chip:hover { background: rgba(0,0,0,0.06); }
.hdr-chip.active { background: rgba(0,0,0,0.08); }

.hdr-icon {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
  transition: background 140ms;
}
.hdr-icon:hover { background: rgba(0,0,0,0.08); }

.hdr-sep {
  width: 1px; height: 14px;
  background: rgba(0,0,0,0.12);
  margin: 0 1px;
}

.hdr-segmented {
  display: inline-flex;
  background: rgba(0,0,0,0.06);
  border-radius: 8px;
  padding: 2px;
}
.hdr-seg {
  height: 24px; padding: 0 7px; gap: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
  transition: all 140ms;
}
.hdr-seg-label {
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
  font-family: inherit; line-height: 1;
}
.hdr-seg.active {
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.dock-brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  opacity: 0.8;
  pointer-events: none;
  flex-shrink: 0;
}

/* ── Dock inferior ── */
#dock-items button {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink);
  position: relative;
  transition: all 160ms cubic-bezier(0.2,0.8,0.2,1);
}
#dock-items button:hover {
  background: rgba(0,0,0,0.06);
  transform: translateY(-2px);
}
#dock-items button.active {
  background: linear-gradient(180deg, #4a90ff, #2563eb);
  color: white;
  box-shadow: 0 4px 12px rgba(37,99,235,0.4);
}
#dock-items button.active::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--ink);
}

#dock-items #dock-inventory-btn.inventory-ready {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--inventory-orbit-start) 42%, transparent),
    0 0 18px -6px color-mix(in srgb, var(--inventory-orbit-start) 68%, transparent);
}

#dock-items #dock-inventory-btn.inventory-ready::before {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.96);
  background: linear-gradient(135deg, var(--inventory-orbit-start), var(--inventory-orbit-end));
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.38), 0 0 12px rgba(245, 158, 11, 0.42);
  pointer-events: none;
}

#dock-items #dock-inventory-btn.inventory-ready.active {
  box-shadow:
    0 4px 12px rgba(37,99,235,0.4),
    0 0 20px -4px color-mix(in srgb, var(--inventory-orbit-start) 72%, transparent);
}

#dock-items .dock-sep {
  width: 1px; height: 28px;
  background: rgba(0,0,0,0.12);
  margin: 0 6px;
  flex-shrink: 0;
}

/* ── Dock deslizable en pantallas pequeñas ── */
#dock {
  max-width: calc(100vw - 24px);
}
#dock-items {
  overflow-x: auto;
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge */
}
#dock-items::-webkit-scrollbar { display: none; } /* Chrome/Safari */
#dock-items button { flex-shrink: 0; }

/* ── Catálogo modal ── */
#catalog-modal { animation: catalogIn 240ms cubic-bezier(0.2,0.8,0.2,1) both; }
@keyframes catalogIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1);    }
}

.cat-card {
  background: rgba(255,255,255,0.7);
  border: 0.5px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 14px 10px 10px;
  cursor: pointer;
  transition: all 180ms cubic-bezier(0.2,0.8,0.2,1);
  text-align: center;
}
.cat-card:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -8px rgba(0,0,0,0.2);
  border-color: rgba(0,0,0,0.18);
}
.cat-card .cat-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.cat-card .cat-thumb svg { width: 70%; height: 70%; }
.cat-card .cat-name {
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
}

/* ── PRO category — dock button ── */
@keyframes proDockGlow {
  0%, 100% { box-shadow: 0 0 0 1.5px rgba(255,154,31,0.52), 0 0 10px -3px rgba(255,154,31,0.32); }
  50%       { box-shadow: 0 0 0 1.5px rgba(255,205,55,0.85), 0 0 18px -3px rgba(255,179,32,0.62); }
}

#dock-items button.dock-cat-pro-locked {
  animation: proDockGlow 2.4s ease-in-out infinite;
}
#dock-items button.dock-cat-pro-locked.active {
  box-shadow: 0 4px 12px rgba(37,99,235,0.4), 0 0 0 1.5px rgba(255,154,31,0.7);
  animation: none;
}

.dock-pro-pip {
  display: none;
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #ffb320 0%, #ff7a00 100%);
  border-radius: 3px;
  padding: 1px 3px;
  line-height: 1.3;
  pointer-events: none;
}
#dock-items button.dock-cat-pro-locked .dock-pro-pip { display: block; }

/* ── PRO category — catalog cards ── */
@keyframes proCardGlow {
  0%, 100% {
    border-color: rgba(255,154,31,0.50);
    box-shadow: 0 0 8px -3px rgba(255,154,31,0.32);
  }
  50% {
    border-color: rgba(255,205,55,0.85);
    box-shadow: 0 0 18px -4px rgba(255,179,32,0.65);
  }
}

.cat-card--pro-locked {
  border-color: rgba(255,154,31,0.55);
  border-width: 1.5px;
  position: relative;
  animation: proCardGlow 2.4s ease-in-out infinite;
}
.cat-card--pro-locked:hover {
  border-color: rgba(255,205,55,0.9);
  box-shadow: 0 8px 20px -8px rgba(0,0,0,0.2), 0 0 16px -4px rgba(255,179,32,0.6);
}
.cat-card--pro-locked::after {
  content: 'PRO';
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fff;
  background: linear-gradient(135deg, #ffb320 0%, #ff7a00 100%);
  border-radius: 4px;
  padding: 2px 4px;
  line-height: 1.2;
  pointer-events: none;
}

body.placement-pending #scene-canvas {
  cursor: copy;
}

.placement-indicator {
  position: fixed;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 14px 28px -18px rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
  z-index: 80;
  transform: translate3d(0, 0, 0);
}

.placement-indicator.hidden {
  display: none;
}

.placement-indicator-box {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px dashed var(--brand-primary);
  background:
    linear-gradient(135deg, rgba(var(--brand-primary-rgb), 0.14), rgba(var(--brand-primary-rgb), 0.03));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.72);
  flex: 0 0 auto;
  position: relative;
}

.placement-indicator-box::after {
  content: '+';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-primary);
}

.placement-indicator-copy {
  display: grid;
  gap: 2px;
  min-width: 180px;
}

.placement-indicator-copy strong {
  font-size: 12px;
  line-height: 1.15;
  font-weight: 600;
  color: var(--ink);
}

.placement-indicator-copy small {
  font-size: 11px;
  line-height: 1.2;
  color: rgba(17,24,39,0.72);
}

/* Escondemos el sidebar viejo */
#sidebar { display: none !important; }

/* Empty hint se oculta cuando hay items */
body.has-items #empty-hint { display: none; }

/* ── Centrado forzado del header ── */
#header-mac {
  height: 44px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) transparent;
}
#header-mac::-webkit-scrollbar { height: 3px; }
#header-mac::-webkit-scrollbar-track { background: transparent; }
#header-mac::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 2px; }
/* Header: hijos no se contraen ni saltan línea */
#header-inner > * {
  flex-shrink: 0;
}
#header-inner {
  justify-content: center;
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px 0 4px;
}

.header-brand-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-grid;
  place-items: center;
  position: relative;
}

.header-brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  position: relative;
  z-index: 1;
}

.header-brand-fallback {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,0,0,0.16);
  border-radius: 6px;
  background: rgba(255,255,255,0.72);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  color: var(--ink);
}

.header-brand-logo:not([src=""]) + .header-brand-fallback {
  opacity: 0;
}

.header-brand-logo.is-missing {
  display: none;
}

.header-brand-logo.is-missing + .header-brand-fallback {
  opacity: 1;
}

.header-brand-name {
  font-family: 'Fraunces', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}

.btn-company-logo,
.btn-company-logo-empty {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 6px;
}

.btn-company-logo {
  object-fit: contain;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(0,0,0,0.12);
}

.btn-company-logo-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,0,0,0.16);
  background: rgba(255,255,255,0.72);
  color: var(--muted, #6a6a6e);
}

/* Nombre de empresa en el botón */
.btn-company-name {
  font-family: 'Inter Tight', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ── Dock centrado ── */
#dock {
  left: 50% !important;
  transform: translateX(-50%) !important;
  bottom: 18px !important;
  z-index: 34;
}

#catalog-modal {
  bottom: 90px !important;
}

#catalog-grid {
  max-height: 286px;
  overflow-y: auto;
  padding-right: 4px;
  grid-auto-rows: minmax(126px, auto);
  overscroll-behavior: contain;
}

#catalog-grid::-webkit-scrollbar { width: 6px; }
#catalog-grid::-webkit-scrollbar-track { background: transparent; }
#catalog-grid::-webkit-scrollbar-thumb { background: rgba(10,10,11,0.18); border-radius: 999px; }

.cat-card {
  min-height: 126px;
}

#dock-items button.active {
  background: linear-gradient(180deg, var(--brand-primary), color-mix(in srgb, var(--brand-primary) 80%, black));
  color: white;
  box-shadow: 0 4px 12px rgba(var(--brand-primary-rgb), 0.4);
}

.hdr-icon.active {
  background: linear-gradient(180deg, var(--brand-primary), color-mix(in srgb, var(--brand-primary) 80%, black));
  color: white;
  box-shadow: 0 4px 12px rgba(var(--brand-primary-rgb), 0.4);
}

/* ── Dock rotating shine border ── */
@property --dock-shine {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes dockShine {
  to { --dock-shine: 360deg; }
}

#dock {
  isolation: isolate;
}
#dock.dock-collapsed::before { display: none; }
#dock::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--dock-shine),
    rgba(48,48,54,0.9)  0deg,
    rgba(48,48,54,0.9)  300deg,
    rgba(160,160,170,0.6) 322deg,
    rgba(255,255,255,0.95) 338deg,
    rgba(255,255,255,0.95) 346deg,
    rgba(160,160,170,0.6) 358deg,
    rgba(48,48,54,0.9)  360deg
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box,
                linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: dockShine 3s linear infinite;
  pointer-events: none;
  z-index: -1;
}

@property --collab-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes collabSpin {
  to { --collab-angle: 360deg; }
}

.hdr-chip.collab-spinning {
  position: relative;
}

.hdr-chip.collab-spinning::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from var(--collab-angle), #ff0055, #00ffcc, #0055ff, #ff00ff, #ff0055);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: collabSpin 1.2s linear infinite;
  pointer-events: none;
}

.wp-toolbar-glow {
  position: relative;
}
.wp-toolbar-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  padding: 2px;
  background: conic-gradient(from var(--collab-angle), #ff0055, #00ffcc, #0055ff, #ff00ff, #ff0055);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: collabSpin 1.2s linear infinite;
  pointer-events: none;
}

#wp-shortcuts-panel.wp-shortcuts-glow {
  position: relative;
}
#wp-shortcuts-panel.wp-shortcuts-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  padding: 2px;
  background: conic-gradient(from var(--collab-angle), #ff0055, #00ffcc, #0055ff, #ff00ff, #ff0055);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: collabSpin 1.2s linear infinite;
  pointer-events: none;
}

/* Borde de colores temporal en el botón de cámara (hint 5s) */
.hdr-seg.cam-hint { position: relative; overflow: visible; }
.hdr-seg.cam-hint::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from var(--collab-angle), #ff0055, #00ffcc, #0055ff, #ff00ff, #ff0055);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: collabSpin 1.2s linear infinite;
  pointer-events: none;
}

/* ─── Dock móvil ≤768px ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #dock { bottom: 10px; left: 6px; right: 6px; width: auto; }
  .dock-items { gap: 4px; padding: 4px 6px; }
  .dock-items button { min-width: 48px; height: 50px; }
  .dock-sep { height: 32px; }
}

/* ═══════════ PANEL GRUPOS GUARDADOS ═══════════ */

.sg-card {
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  transition: background 140ms ease;
}
.sg-card:hover { background: rgba(10,10,11,0.04); }

.sg-card-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  background: rgba(10,10,11,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  overflow: hidden;
}
.sg-card-thumb svg { width: 100%; height: 100%; display: block; }

.sg-card-name {
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-card-meta {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 6px;
  flex: 1;
}
.sg-card-actions { display: flex; gap: 4px; }
.sg-card-actions .btn {
  flex: 1;
  padding: 5px 8px;
  font-size: 10px;
  justify-content: center;
  min-height: 0;
}
.sg-card-more { flex: 0 0 auto !important; padding: 5px 6px !important; }

.sg-empty {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  padding: 8px 4px;
}
