/* ============== GLASSMORPHISM PANELS ============== */
.glass {
  background: rgba(245, 243, 238, 0.78);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--hairline);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 30px 60px -20px rgba(10, 10, 11, 0.25),
    0 8px 24px -12px rgba(10, 10, 11, 0.18);
}

.glass-dark {
  background: rgba(10, 10, 11, 0.86);
  backdrop-filter: blur(18px) saturate(140%);
  color: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ============== SCROLLBAR ============== */
.panel-scroll::-webkit-scrollbar { width: 6px; }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-scroll::-webkit-scrollbar-thumb { background: rgba(10, 10, 11, 0.2); border-radius: 0; }
.panel-scroll::-webkit-scrollbar-thumb:hover { background: rgba(10, 10, 11, 0.4); }

/* ============== TOOLTIP FLOTANTE ============== */
#tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 16px));
  transition: opacity 160ms ease;
  opacity: 0;
}
#tooltip.visible { opacity: 1; }
#tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: rgba(10, 10, 11, 0.86);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ============== STATUS BAR INFERIOR ============== */
.status-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 8px 18px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.06em;
}

.status-bar.glass {
  display: none;
}

/* Hide collapsed panel content */
.collapsed .collapse-content { display: none; }
.collapsed .collapse-chevron { transform: rotate(-90deg); }
.collapse-chevron { transition: transform 220ms; }

/* Mark divider */
.rule {
  height: 1px;
  background: var(--hairline);
  margin: 14px 0;
}
.rule-thick {
  height: 1px;
  background: var(--ink);
  margin: 14px 0;
}

/* Modal (preparado para Entrega 2) */
.modal-bg {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 10, 11, 0.45);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-bg.visible { display: flex; animation: fadeIn 200ms both; }

/* ============== ANIMACIONES ============== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.anim-in { animation: fadeIn 400ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }

.delay-1 { animation-delay: 80ms; }
.delay-2 { animation-delay: 160ms; }
.delay-3 { animation-delay: 240ms; }
.delay-4 { animation-delay: 320ms; }

/* ============== DEMO CALIBRACIÓN ============== */
@keyframes calPop     { from { opacity:0; transform:scale(0.5); } to { opacity:1; transform:scale(1); } }
@keyframes calRing    { from { opacity:0.6; transform:scale(1); } to { opacity:0; transform:scale(2.4); } }
@keyframes calAppear  { from { opacity:0; } to { opacity:1; } }
@keyframes calDraw    { to { stroke-dashoffset:0; } }

.cal-demo-run .cd-cursor  { animation: calAppear 0.2s ease 0.05s both; }
.cal-demo-run .cd-p1-ring { animation: calRing   0.5s ease 0.25s both; }
.cal-demo-run .cd-p1-dot  { animation: calPop    0.25s cubic-bezier(0.2,0.8,0.2,1) 0.2s both; }
.cal-demo-run .cd-p1-txt  { animation: calAppear 0.2s ease 0.45s both; }

.cal-demo-run .cd-cursor2 { animation: calAppear 0.2s ease 0.75s both; }
.cal-demo-run .cd-p2-ring { animation: calRing   0.5s ease 0.95s both; }
.cal-demo-run .cd-p2-dot  { animation: calPop    0.25s cubic-bezier(0.2,0.8,0.2,1) 0.9s both; }
.cal-demo-run .cd-p2-txt  { animation: calAppear 0.2s ease 1.1s both; }

.cal-demo-run .cd-line    { animation: calDraw   0.45s ease 1.2s both; }
.cal-demo-run .cd-br1     { animation: calAppear 0.15s ease 1.6s both; }
.cal-demo-run .cd-br2     { animation: calAppear 0.15s ease 1.65s both; }
.cal-demo-run .cd-lbl     { animation: calAppear 0.25s ease 1.7s both; }

/* ============== DEMO WALLPAINTER (triángulo) ============== */
@keyframes wpDraw   { to { stroke-dashoffset: 0; } }
@keyframes wpAppear { from { opacity:0; } to { opacity:1; } }
@keyframes wpPop    { from { opacity:0; transform:scale(0.3); } to { opacity:1; transform:scale(1); } }

#wp-demo-stage.wp-demo-run .wp-dot-a  { animation: wpPop    0.2s cubic-bezier(0.2,0.8,0.2,1) 0.1s  both; }
#wp-demo-stage.wp-demo-run .wp-seg-ab { animation: wpDraw   0.5s ease                         0.3s  both; }
#wp-demo-stage.wp-demo-run .wp-dot-b  { animation: wpPop    0.2s cubic-bezier(0.2,0.8,0.2,1) 0.85s both; }
#wp-demo-stage.wp-demo-run .wp-lbl-ab { animation: wpAppear 0.2s ease                         0.9s  both; }
#wp-demo-stage.wp-demo-run .wp-seg-bc { animation: wpDraw   0.4s ease                         1.2s  both; }
#wp-demo-stage.wp-demo-run .wp-dot-c  { animation: wpPop    0.2s cubic-bezier(0.2,0.8,0.2,1) 1.65s both; }
#wp-demo-stage.wp-demo-run .wp-lbl-bc { animation: wpAppear 0.2s ease                         1.7s  both; }
#wp-demo-stage.wp-demo-run .wp-seg-ca { animation: wpDraw   0.4s ease                         2.0s  both; }
#wp-demo-stage.wp-demo-run .wp-lbl-ca { animation: wpAppear 0.2s ease                         2.45s both; }

/* ============== MODO MEDICIÓN ============== */
body.cursor-measure,
body.cursor-measure * { cursor: crosshair !important; }

/* ============== INVENTORY GLOW (post-save plan) ============== */
@property --inv-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes inventoryGlowSpin {
  to { --inv-angle: 360deg; }
}
#dock-inventory-btn.inventory-glow {
  position: relative;
}
#dock-inventory-btn.inventory-glow::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from var(--inv-angle), #22c55e, #3b82f6, #a855f7, #f59e0b, #22c55e);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: inventoryGlowSpin 1.2s linear infinite;
  pointer-events: none;
  z-index: 1;
}

/* ============== PLAN SAVE MODAL FIELD ERROR ============== */
.psm-field-error {
  outline: 2px solid #e53e3e !important;
  outline-offset: 1px;
  animation: psmShake 0.35s ease;
}
@keyframes psmShake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-5px); }
  75%      { transform: translateX(5px); }
}

/* ============== GRID WATERMARK ============== */
#grid-watermark {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
  font-family: 'Inter', sans-serif;
  font-size: clamp(36px, 5.5vw, 76px);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: rgba(26, 26, 28, 0.075);
  filter: blur(1.5px);
  user-select: none;
  animation: wmFadeIn 1.4s cubic-bezier(0.2, 0.8, 0.2, 1) 1.8s both,
             wmPulse 5s ease-in-out 3.2s infinite;
  transition: opacity 900ms ease, filter 900ms ease;
}
#grid-watermark.wm-hidden {
  opacity: 0 !important;
  filter: blur(6px) !important;
  animation: none;
}
@keyframes wmFadeIn {
  from { opacity: 0; filter: blur(8px); }
  to   { opacity: 1; filter: blur(1.5px); }
}
@keyframes wmPulse {
  0%, 100% { opacity: 0.7;  filter: blur(1.5px); }
  50%       { opacity: 1;   filter: blur(0.4px); }
}

/* ============== DEMO ZONAS ============== */
@keyframes zdDraw { to { stroke-dashoffset: 0; } }
@keyframes zdFill { from { opacity: 0; } to { opacity: 0.12; } }

/* Vértices marcados en secuencia */
.zones-demo-run .zd-v1 { animation: calPop 0.25s cubic-bezier(0.2,0.8,0.2,1) 0.15s both; }
.zones-demo-run .zd-v2 { animation: calPop 0.25s cubic-bezier(0.2,0.8,0.2,1) 0.45s both; }
.zones-demo-run .zd-v3 { animation: calPop 0.25s cubic-bezier(0.2,0.8,0.2,1) 0.75s both; }
.zones-demo-run .zd-v4 { animation: calPop 0.25s cubic-bezier(0.2,0.8,0.2,1) 1.05s both; }
.zones-demo-run .zd-v5 { animation: calPop 0.25s cubic-bezier(0.2,0.8,0.2,1) 1.35s both; }
.zones-demo-run .zd-v6 { animation: calPop 0.25s cubic-bezier(0.2,0.8,0.2,1) 1.65s both; }

/* Contorno trazándose mientras se marcan los vértices */
.zones-demo-run .zd-zone-path { animation: zdDraw 1.7s ease 0.25s both; }

/* Anillo de cierre sobre el primer vértice, luego relleno y etiqueta */
.zones-demo-run .zd-close-ring { animation: calRing 0.55s ease 1.95s both; }
.zones-demo-run .zd-zone-fill  { animation: zdFill  0.4s  ease 2.25s both; }
.zones-demo-run .zd-lbl-bg     { animation: calAppear 0.25s ease 2.45s both; }
.zones-demo-run .zd-lbl-txt    { animation: calAppear 0.25s ease 2.5s both; }

/* ══════════════════════════════════════════════════════
   APP LOADER — cubre el app desde el primer render
   ══════════════════════════════════════════════════════ */
#app-loader {
  position: fixed;
  inset: 0;
  z-index: 310;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}
#app-loader.al-fade { opacity: 0; pointer-events: none; }
#app-loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
#app-loader-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(26,26,28,0.38);
  min-height: 16px;
  transition: opacity 0.3s ease;
}
#app-loader-bar-wrap {
  width: 140px;
  height: 1.5px;
  background: rgba(26,26,28,0.1);
  border-radius: 1px;
  overflow: hidden;
}
#app-loader-bar {
  height: 100%;
  width: 0%;
  background: #1a1a1c;
  border-radius: 1px;
  transition: width 2s cubic-bezier(0.4,0,0.2,1);
}

/* ══════════════════════════════════════════════════════
   SPLASH SCREEN + GRID_ONDA
   ══════════════════════════════════════════════════════ */
#splash-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}
#splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
#splash-logo {
  filter: drop-shadow(0 0 8px rgba(0,0,0,0.15));
}
#splash-wordmark {
  font-family: 'Inter Tight', sans-serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: #1a1a1c;
  margin-top: -4px;
}
#splash-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(26,26,28,0.4);
  margin-top: -10px;
}
#splash-bar-wrap {
  width: 180px;
  height: 1.5px;
  background: rgba(26,26,28,0.12);
  border-radius: 1px;
  overflow: hidden;
  margin-top: 6px;
}
#splash-bar {
  height: 100%;
  width: 0%;
  background: #1a1a1c;
  border-radius: 1px;
}
#splash-canvas {
  position: fixed;
  inset: 0;
  z-index: 185;
}

