/* ============================================================
   WARBIMPRO — Visor 3D (recorrido tipo Enscape)
   Mismos componentes del visor original (loading, instrucciones,
   panel de info, botón de ayuda), solo reajustado a la paleta
   de marca (graphite/mustard) en vez del verde genérico.
   ============================================================ */

* { margin:0; padding:0; box-sizing:border-box; }

body{
  font-family:'IBM Plex Sans','Segoe UI',Tahoma,Geneva,Verdana,sans-serif;
  overflow:hidden;
  background:#0a0b0d;
}

/* -------- barra de regreso al sitio (mínima, no interfiere con PointerLock) -------- */
#visor-back{
  position:absolute; top:14px; left:14px; z-index:1001;
  display:flex; align-items:center; gap:8px;
  font-family:'IBM Plex Mono',monospace; font-size:12px;
  color:#f5f5f3; text-decoration:none;
  background:rgba(10,11,13,.6); border:1px solid #2a2e38;
  padding:8px 14px; border-radius:2px; backdrop-filter:blur(6px);
  transition:border-color .2s ease;
}
#visor-back:hover{ border-color:#c9a227; }
#visor-back span{ color:#e3c25a; }

/* -------- instrucciones iniciales -------- */
#instructions{
  position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
  background:rgba(10,11,13,.9); color:#f5f5f3;
  padding:34px 42px; border-radius:2px; text-align:center; z-index:1000;
  backdrop-filter:blur(10px); border:1px solid #2a2e38; max-width:480px;
}
#instructions h1{
  margin-bottom:18px; font-size:24px; font-weight:600; color:#e3c25a;
  font-family:'Space Grotesk','Segoe UI',sans-serif;
}
#instructions p{ margin:10px 0; line-height:1.6; font-size:13.5px; color:#c7cad1; }
#instructions .controls{
  margin-top:20px; padding:16px; background:rgba(255,255,255,.04);
  border-radius:2px; border:1px solid #20232b;
}
#instructions .controls h3{
  margin-bottom:10px; font-size:12px; letter-spacing:.06em; text-transform:uppercase;
  color:#8a7020; font-family:'IBM Plex Mono',monospace;
}
#instructions .key{
  display:inline-block; background:#161920; padding:5px 10px; margin:3px;
  border-radius:2px; font-family:'IBM Plex Mono',monospace; font-weight:500;
  border:1px solid #2a2e38; color:#f5f5f3;
}
#instructions .click-hint{
  margin-top:22px; padding:14px; background:#c9a227; color:#14171b;
  border-radius:2px; cursor:pointer; transition:background .2s ease; font-weight:600;
}
#instructions .click-hint:hover{ background:#e3c25a; }

/* -------- pantalla de carga -------- */
#loading{
  position:absolute; inset:0; background:#0a0b0d;
  display:flex; flex-direction:column; justify-content:center; align-items:center;
  z-index:999; color:#f5f5f3;
}
#loading h2{ margin-bottom:20px; font-size:20px; font-weight:600; }
.spinner{
  border:3px solid rgba(255,255,255,.1); border-left-color:#c9a227;
  border-radius:50%; width:44px; height:44px; animation:spin 1s linear infinite;
}
@keyframes spin{ to{ transform:rotate(360deg); } }
#progress{ margin-top:18px; font-size:13px; color:#8a7020; font-family:'IBM Plex Mono',monospace; }

/* -------- panel de info (esquina superior derecha) -------- */
#info{
  position:absolute; top:60px; right:10px;
  background:rgba(10,11,13,.75); color:#f5f5f3; padding:14px 16px;
  border-radius:2px; font-size:12px; backdrop-filter:blur(5px);
  border:1px solid #2a2e38; display:none; font-family:'IBM Plex Mono',monospace;
}
#info.active{ display:block; }
#info p{ margin:5px 0; color:#c7cad1; }
#info p strong{ color:#e3c25a; }

/* -------- carga local de IFC -------- */
#ifc-tools{
  position:absolute; top:60px; left:100px; z-index:100;
  display:flex; align-items:center; gap:10px; max-width:min(420px, calc(100vw - 120px));
}
.ifc-upload-button{
  display:inline-flex; align-items:center; padding:9px 13px;
  color:#14171b; background:#c9a227; border-radius:2px; cursor:pointer;
  font-size:12px; font-weight:600; white-space:nowrap;
}
.ifc-upload-button:hover{ background:#e3c25a; }
.ifc-upload-button input{ display:none; }
#ifc-status{
  color:#c7cad1; font-family:'IBM Plex Mono',monospace; font-size:10px; line-height:1.35;
}

/* -------- botón de ayuda -------- */
#help-button{
  position:absolute; top:60px; left:10px;
  background:rgba(201,162,39,.9); color:#14171b; border:none;
  padding:9px 14px; border-radius:2px; cursor:pointer; font-size:13px;
  z-index:100; font-weight:600; transition:background .2s ease;
}
#help-button:hover{ background:#e3c25a; }

@media (max-width:640px){
  #instructions{ max-width:88vw; padding:26px 24px; }
  #info, #help-button{ top:52px; }
  #ifc-tools{ top:94px; left:10px; max-width:calc(100vw - 20px); }
  #ifc-status{ display:none; }
  #visor-tools{ bottom:12px; }
  #touch-instructions{ z-index:120; pointer-events:none; }
}

/* -------- panel de herramientas (rayos X / calidad) -------- */
#visor-tools{
  position:absolute; bottom:22px; left:50%; transform:translateX(-50%);
  z-index:100; display:flex; gap:8px;
}
#visor-tools button{
  font-family:'IBM Plex Mono',monospace; font-size:12.5px; font-weight:500;
  color:#f5f5f3; background:rgba(10,11,13,.7); border:1px solid #2a2e38;
  padding:10px 16px; border-radius:2px; cursor:pointer;
  backdrop-filter:blur(6px); transition:border-color .2s ease, background .2s ease;
}
#visor-tools button:hover{ border-color:#8a7020; }
#visor-tools button.active{ background:#c9a227; color:#14171b; border-color:#c9a227; }

#measurement-panel, #selection-panel{
  position:absolute; left:18px; bottom:24px; z-index:100; display:none;
  width:min(300px, calc(100vw - 30px)); padding:12px 14px;
  color:#f5f5f3; background:rgba(10,11,13,.82); border:1px solid #2a2e38;
  border-radius:2px; backdrop-filter:blur(8px); font:12px/1.55 'IBM Plex Mono',monospace;
}
#measurement-panel.active, #selection-panel.active{ display:block; }
.tool-panel-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; color:#e3c25a; }
.tool-panel-header button{ color:#f5f5f3; background:transparent; border:0; cursor:pointer; font-size:20px; line-height:1; }
#measurement-status, #selection-result{ color:#c7cad1; }
#measurement-result{ margin-top:8px; color:#f5f5f3; }
#isolate-button{
  margin-top:10px; width:100%; padding:8px 10px; border:1px solid #2388ff;
  color:#f5f5f3; background:rgba(35,136,255,.18); border-radius:2px;
  cursor:pointer; font:500 11px 'IBM Plex Mono',monospace;
}
#isolate-button:hover{ background:rgba(35,136,255,.35); }
#isolate-button:disabled{ opacity:.45; cursor:not-allowed; }
#quantities-panel{
  position:absolute; left:18px; top:150px; z-index:100; display:none; width:min(760px, calc(100vw - 36px));
  max-height:250px; padding:12px 14px; color:#f5f5f3; background:rgba(10,11,13,.86);
  border:1px solid #2a2e38; border-radius:2px; backdrop-filter:blur(8px);
  font:11px/1.4 'IBM Plex Mono',monospace;
}
#quantities-panel.active{ display:block; }
#quantities-panel .tool-panel-header button{ padding:6px 9px; color:#14171b; background:#c9a227; border:0; border-radius:2px; cursor:pointer; font:600 10px 'IBM Plex Mono',monospace; }
#quantities-panel .tool-panel-header button:disabled{ opacity:.45; cursor:not-allowed; }
#quantities-empty{ margin:0 0 8px; color:#8d929c; }
.quantities-table-wrap{ max-height:175px; overflow:auto; }
#quantities-panel table{ width:100%; border-collapse:collapse; }
#quantities-panel th, #quantities-panel td{ padding:5px 7px; border-bottom:1px solid #2a2e38; text-align:left; white-space:nowrap; }
#quantities-panel th{ color:#e3c25a; font-weight:500; position:sticky; top:0; background:#17191f; }
#quantities-panel td{ color:#c7cad1; }
.measurement-label{
  position:fixed; transform:translate(-50%, -50%); z-index:110; pointer-events:none;
  padding:5px 8px; color:#14171b; background:#e3c25a; border-radius:2px;
  font:600 12px 'IBM Plex Mono',monospace; white-space:nowrap;
}

#exploded-panel{
  position:absolute; right:18px; bottom:24px; z-index:100;
  width:min(240px, calc(100vw - 30px));
  background:rgba(10,11,13,.72); border:1px solid #2a2e38;
  border-radius:10px; padding:10px 12px 12px; backdrop-filter:blur(8px);
  box-shadow:0 18px 36px rgba(0,0,0,.28);
}
.exploded-header{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; font-family:'IBM Plex Mono',monospace; font-size:11px;
  color:#d8d9dd; text-transform:uppercase; letter-spacing:.08em;
  margin-bottom:8px;
}
.explode-status{
  margin:-2px 0 8px; color:#8d929c; font-size:10px; line-height:1.35;
  font-family:'IBM Plex Mono',monospace;
}
#explode-slider{
  width:100%; accent-color:#c9a227; cursor:pointer;
}
#explode-slider:disabled{ cursor:not-allowed; opacity:.45; }

@media (max-width:640px){
  #exploded-panel{ right:10px; bottom:80px; }
  #measurement-panel, #selection-panel{ left:10px; bottom:80px; }
  #quantities-panel{ left:10px; top:142px; width:calc(100vw - 20px); }
}
