/**
 * cad-import.css — Estilos del addon Importar CAD.
 * Recreado 2026-06-07 con paleta aurora AuraMap.
 * Sin dependencias, sin frameworks, sin reset global (no toca el SPA).
 */

/* ====================================================================
   Variables — fallback si AuraMap no las define
==================================================================== */

#auramap-cad-fab,
#auramap-cad-modal {
  --cad-blue:    #2B6CFF;
  --cad-purple:  #7B3FE4;
  --cad-cyan:    #00E5FF;
  --cad-gold:    #FFC857;
  --cad-bg:      #121826; /* aura-tokens surface-1 */
  --cad-bg-mid:  #1A2233; /* surface-2 */
  --cad-bg-card: #222C40; /* surface-3 */
  --cad-text:    #E8EDF7;
  --cad-muted:   #9DA9BE;
  --cad-border:  rgba(123, 63, 228, 0.25);
  --cad-success: #22C58B;
  --cad-error:   #FF5D6C;
}

/* ====================================================================
   FAB — botón flotante bottom-right
==================================================================== */

#auramap-cad-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: white;
  background: linear-gradient(135deg, var(--cad-cyan), var(--cad-blue) 55%, var(--cad-purple));
  border: none;
  border-radius: 999px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  box-shadow:
    0 4px 16px rgba(43, 108, 255, 0.35),
    0 1px 3px rgba(0, 0, 0, 0.3);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.15s ease,
    right 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    bottom 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Sin transición durante drag (movimiento instantáneo) */
#auramap-cad-fab.dragging {
  transition: none !important;
}

#auramap-cad-fab:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 8px 28px rgba(43, 108, 255, 0.55),
    0 1px 3px rgba(0, 0, 0, 0.35);
}

#auramap-cad-fab:active {
  transform: translateY(0) scale(1);
}

#auramap-cad-fab.dragging {
  cursor: grabbing;
  opacity: 0.92;
  transform: scale(1.04);
  box-shadow:
    0 12px 36px rgba(43, 108, 255, 0.7),
    0 2px 6px rgba(0, 0, 0, 0.4);
  transition: none;
}

/* Toast de posición */
#auramap-cad-pos-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  z-index: 9999;
  padding: 0.9rem 1.3rem;
  background: linear-gradient(135deg, rgba(43, 108, 255, 0.95), rgba(123, 63, 228, 0.95));
  color: white;
  border-radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.88rem;
  line-height: 1.5;
  text-align: center;
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(0, 229, 255, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(4px);
}

#auramap-cad-pos-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#auramap-cad-pos-toast small {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  opacity: 0.85;
}

#auramap-cad-fab svg {
  flex-shrink: 0;
}

/* En pantallas chicas, FAB compacto (solo icono) */
@media (max-width: 540px) {
  #auramap-cad-fab span {
    display: none;
  }
  #auramap-cad-fab {
    padding: 0.85rem;
    border-radius: 50%;
  }
}

/* ====================================================================
   Modal — backdrop + card
==================================================================== */

#auramap-cad-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--cad-text);
}

#auramap-cad-modal .cad-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 24, 0.72);
  backdrop-filter: blur(6px);
  animation: cad-fadein 0.18s ease;
}

#auramap-cad-modal .cad-modal-card {
  position: relative;
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  background: var(--cad-bg);
  border: 1px solid var(--cad-border);
  border-radius: 16px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(123, 63, 228, 0.15);
  animation: cad-slidein 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes cad-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes cad-slidein {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ====================================================================
   Header / Footer
==================================================================== */

#auramap-cad-modal .cad-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--cad-border);
}

#auramap-cad-modal .cad-modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--cad-cyan), var(--cad-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#auramap-cad-modal .cad-modal-close {
  background: transparent;
  color: var(--cad-muted);
  border: none;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

#auramap-cad-modal .cad-modal-close:hover {
  color: var(--cad-text);
  background: var(--cad-bg-mid);
}

#auramap-cad-modal .cad-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.2rem 1.4rem;
}

#auramap-cad-modal .cad-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--cad-border);
  background: rgba(0, 0, 0, 0.15);
}

/* ====================================================================
   Botones
==================================================================== */

#auramap-cad-modal .cad-btn-primary,
#auramap-cad-modal .cad-btn-ghost {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.65rem 1.3rem;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

#auramap-cad-modal .cad-btn-primary {
  background: linear-gradient(135deg, var(--cad-blue), var(--cad-purple));
  color: white;
  box-shadow: 0 4px 14px rgba(43, 108, 255, 0.35);
}

#auramap-cad-modal .cad-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(43, 108, 255, 0.55);
}

#auramap-cad-modal .cad-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#auramap-cad-modal .cad-btn-ghost {
  background: transparent;
  color: var(--cad-muted);
  border: 1px solid var(--cad-border);
}

#auramap-cad-modal .cad-btn-ghost:hover {
  color: var(--cad-text);
  background: var(--cad-bg-mid);
}

/* ====================================================================
   Dropzone
==================================================================== */

#auramap-cad-modal .cad-dropzone {
  position: relative;
  border: 2px dashed var(--cad-border);
  border-radius: 12px;
  padding: 1.6rem 1rem;
  text-align: center;
  margin-bottom: 1.2rem;
  transition: border-color 0.2s, background 0.2s;
  background: rgba(123, 63, 228, 0.04);
}

#auramap-cad-modal .cad-dropzone:hover,
#auramap-cad-modal .cad-dropzone.drag-over {
  border-color: var(--cad-cyan);
  background: rgba(0, 229, 255, 0.07);
}

#auramap-cad-modal .cad-dropzone svg {
  color: var(--cad-cyan);
  margin-bottom: 0.5rem;
  opacity: 0.85;
}

#auramap-cad-modal .cad-dropzone p {
  margin: 0.3rem 0;
  font-size: 0.95rem;
  color: var(--cad-text);
}

#auramap-cad-modal .cad-dropzone .cad-hint {
  font-size: 0.8rem;
  color: var(--cad-muted);
  margin-top: 0.5rem;
}

#auramap-cad-modal .cad-dropzone code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--cad-bg-mid);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

#auramap-cad-modal .cad-dropzone a {
  color: var(--cad-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

#auramap-cad-modal .cad-dropzone-selected {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
}

#auramap-cad-modal .cad-file-icon {
  font-size: 2.2rem;
}

#auramap-cad-modal .cad-file-info {
  flex: 1 1 auto;
  min-width: 0;
}

#auramap-cad-modal .cad-file-name {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#auramap-cad-modal .cad-file-size {
  font-size: 0.85rem;
  color: var(--cad-muted);
  margin-top: 0.2rem;
}

#auramap-cad-modal .cad-file-remove {
  background: transparent;
  color: var(--cad-muted);
  border: 1px solid var(--cad-border);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
}

#auramap-cad-modal .cad-file-remove:hover {
  color: var(--cad-error);
  border-color: var(--cad-error);
}

/* ====================================================================
   Secciones (radio + check)
==================================================================== */

#auramap-cad-modal .cad-section {
  border: 1px solid var(--cad-border);
  border-radius: 10px;
  padding: 0.9rem 1rem 1rem;
  margin: 0 0 1rem;
}

#auramap-cad-modal .cad-section legend {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--cad-muted);
  padding: 0 0.4rem;
}

#auramap-cad-modal .cad-radio,
#auramap-cad-modal .cad-check {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.5rem 0;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.4;
}

#auramap-cad-modal .cad-radio input,
#auramap-cad-modal .cad-check input {
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--cad-cyan);
  width: 16px;
  height: 16px;
}

#auramap-cad-modal .cad-radio span,
#auramap-cad-modal .cad-check span {
  flex: 1 1 auto;
}

#auramap-cad-modal .cad-radio em,
#auramap-cad-modal .cad-check em {
  font-style: normal;
  color: var(--cad-muted);
  font-size: 0.85em;
}

/* ====================================================================
   Barra de progreso
==================================================================== */

#auramap-cad-modal .cad-progress {
  margin-top: 0.8rem;
  padding: 1rem;
  background: var(--cad-bg-card);
  border: 1px solid var(--cad-border);
  border-radius: 10px;
}

#auramap-cad-modal .cad-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--cad-bg-mid);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}

#auramap-cad-modal .cad-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cad-cyan), var(--cad-blue), var(--cad-purple));
  border-radius: 999px;
  transition: width 0.5s ease;
  background-size: 200% 100%;
  animation: cad-shimmer 2s linear infinite;
}

@keyframes cad-shimmer {
  from { background-position: 0% 0%; }
  to   { background-position: 200% 0%; }
}

#auramap-cad-modal .cad-progress-text {
  font-size: 0.88rem;
  color: var(--cad-muted);
}

/* ====================================================================
   Resultados (success / error)
==================================================================== */

#auramap-cad-modal .cad-result-success,
#auramap-cad-modal .cad-result-error {
  margin-top: 0.8rem;
  padding: 1.1rem 1.2rem;
  border-radius: 10px;
  border: 1px solid;
}

#auramap-cad-modal .cad-result-success {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.35);
}

#auramap-cad-modal .cad-result-error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.4);
}

#auramap-cad-modal .cad-result-success h3,
#auramap-cad-modal .cad-result-error h3 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
  font-weight: 700;
}

#auramap-cad-modal .cad-result-success h3 { color: var(--cad-success); }
#auramap-cad-modal .cad-result-error h3 { color: var(--cad-error); }

#auramap-cad-modal .cad-result-success ul,
#auramap-cad-modal .cad-result-success ol {
  margin: 0.5rem 0;
  padding-left: 1.4rem;
  font-size: 0.92rem;
}

#auramap-cad-modal .cad-result-success li,
#auramap-cad-modal .cad-result-error p {
  margin: 0.25rem 0;
  color: var(--cad-text);
}

#auramap-cad-modal .cad-result-success details {
  margin-top: 0.7rem;
  font-size: 0.9rem;
}

#auramap-cad-modal .cad-result-success summary {
  cursor: pointer;
  color: var(--cad-cyan);
  font-weight: 600;
  padding: 0.3rem 0;
}

#auramap-cad-modal .cad-result-success .cad-hint,
#auramap-cad-modal .cad-result-error .cad-hint {
  margin-top: 0.8rem;
  font-size: 0.82rem;
  color: var(--cad-muted);
}

/* ====================================================================
   Scrollbar custom para el body del modal
==================================================================== */

#auramap-cad-modal .cad-modal-body::-webkit-scrollbar {
  width: 8px;
}

#auramap-cad-modal .cad-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

#auramap-cad-modal .cad-modal-body::-webkit-scrollbar-thumb {
  background: var(--cad-bg-mid);
  border-radius: 4px;
}

#auramap-cad-modal .cad-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--cad-border);
}

/* ── FIX 2026-06-10: el atributo hidden debe ganar siempre ──
   Los bloques (.cad-dropzone-selected, #cad-progress, #cad-result) se togglean
   con el.hidden, pero sus reglas display:flex/block pisaban el [hidden] del UA
   → "Quitar" parecía no funcionar y quedaba un archivo fantasma visible. */
#auramap-cad-modal [hidden],
#auramap-cad-fab[hidden] { display: none !important; }
