/* ==========================================================================
   Fijate Tools - Planificador Visual de Gallery Wall y Colgado de Cuadros
   Estilos corporativos y motor visual a escala milimétrica
   ========================================================================== */

:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colores del tema claro */
  --bg-app: #f4f6fa;
  --surface-card: #ffffff;
  --surface-subtle: #f8fafc;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --primary-accent: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-subtle: #eff6ff;

  --gold-accent: #d97706;
  --gold-subtle: #fef3c7;
  --gold-line: #f59e0b;

  --success-color: #10b981;
  --success-subtle: #ecfdf5;
  --danger-color: #ef4444;
  --danger-hover: #dc2626;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  --bg-app: #0b0f17;
  --surface-card: #151d2c;
  --surface-subtle: #1c2638;
  --border-color: #27354a;
  --border-focus: #60a5fa;

  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;

  --primary-accent: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-subtle: rgba(59, 130, 246, 0.15);

  --gold-accent: #f59e0b;
  --gold-subtle: rgba(245, 158, 11, 0.15);
  --gold-line: #fbbf24;

  --success-color: #34d399;
  --success-subtle: rgba(52, 211, 153, 0.15);
  --danger-color: #f87171;
  --danger-hover: #ef4444;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Estructura general y contención
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title-sm,
.faq-section-title {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  margin-top: 0;
}

.mono, code, .drilling-table td:nth-child(3), .drilling-table td:nth-child(4), .drilling-table td:nth-child(5), .drilling-table td:nth-child(6) {
  font-family: var(--font-mono);
}

.tool-layout {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
}

.card-main {
  background-color: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

/* Botón de impresión en cabecera */
.btn-action-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 40px;
  padding: 0 1rem;
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action-ghost:hover {
  background: var(--primary-subtle);
  color: var(--primary-accent);
  border-color: var(--primary-accent);
}

@media (max-width: 768px) {
  .btn-text-desktop {
    display: none;
  }
}

/* ==========================================================================
   Panel de configuración de pared y mueble
   ========================================================================== */
.planner-config-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.config-group-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.inputs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.input-field {
  flex: 1 1 0%;
  min-width: 110px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.input-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-field input[type="number"],
.input-field select,
.ctx-moldure-picker select,
.wall-type-selector select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 0.75rem;
  font-family: var(--font-main);
  font-size: 0.875rem;
  color: var(--text-main);
  background-color: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-field select,
.ctx-moldure-picker select,
.wall-type-selector select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.input-field input:focus,
.input-field select:focus,
.ctx-moldure-picker select:focus,
.wall-type-selector select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ==========================================================================
   Botonera de herramientas y opciones
   ========================================================================== */
.toolbar-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.toolbar-left, .toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.toggle-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 38px;
  padding: 0.35rem 0.75rem;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.toggle-pill input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-pill .pill-slider {
  width: 28px;
  height: 16px;
  background-color: var(--border-color);
  border-radius: var(--radius-full);
  position: relative;
  transition: background-color 0.2s;
}

.toggle-pill .pill-slider::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  left: 2px;
  top: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-pill input:checked + .pill-slider {
  background-color: var(--primary-accent);
}

.toggle-pill input:checked + .pill-slider::before {
  transform: translateX(12px);
}

.toggle-pill input:checked ~ .pill-label {
  color: var(--text-main);
}

/* Separación entre marcos */
.spacing-selector {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.segmented-control {
  display: inline-flex;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.btn-segment {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.75rem;
  font-weight: 600;
  height: 32px;
  padding: 0 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-segment.active {
  background: var(--primary-accent);
  color: #ffffff;
}

.action-buttons-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-action-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 38px;
  padding: 0 0.85rem;
  font-family: var(--font-main);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-action-sm:hover {
  border-color: var(--primary-accent);
  color: var(--primary-accent);
}

.btn-action-danger {
  color: var(--danger-color);
}

.btn-action-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger-color);
  color: var(--danger-hover);
}

/* ==========================================================================
   Catálogo de marcos y presets
   ========================================================================== */
.frames-catalog-section {
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.catalog-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.catalog-tabs {
  display: flex;
  gap: 0.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--surface-card);
  color: var(--primary-accent);
  box-shadow: var(--shadow-sm);
}

.wall-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.count-badge {
  color: var(--primary-accent);
}

.coverage-badge {
  color: var(--text-muted);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Presets Grid */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.preset-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.preset-card:hover {
  border-color: var(--primary-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.preset-icon {
  width: 54px;
  height: 38px;
  background: var(--surface-subtle);
  border: 1px dashed var(--border-color);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  position: relative;
}

.preset-icon span {
  background: var(--primary-accent);
  opacity: 0.75;
  border-radius: 2px;
}

.triptych-icon span { width: 12px; height: 26px; }
.grid-2x2-icon { display: grid; grid-template-columns: repeat(2, 1fr); padding: 4px; gap: 3px; }
.grid-2x2-icon span { width: 18px; height: 13px; }
.grid-3x2-icon { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; gap: 2px; }
.grid-3x2-icon span { width: 13px; height: 13px; }
.duo-vertical-icon { flex-direction: column; }
.duo-vertical-icon span { width: 24px; height: 13px; }
.pano-3-icon span { width: 14px; height: 10px; }

.gallery-5-icon { display: block; position: relative; }
.gallery-5-icon .box-main { position: absolute; left: 6px; top: 5px; width: 18px; height: 26px; }
.gallery-5-icon .box-top-r { position: absolute; right: 6px; top: 5px; width: 18px; height: 11px; }
.gallery-5-icon .box-bot-r { position: absolute; right: 6px; bottom: 5px; width: 18px; height: 11px; }

.preset-info strong {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-main);
  line-height: 1.2;
}

.preset-info small {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* Chips de tamaños estándar */
.standard-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.6rem;
}

.chip-frame-add {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  font-family: var(--font-main);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-frame-add:hover {
  border-color: var(--primary-accent);
  background: var(--primary-subtle);
  color: var(--primary-accent);
}

.chip-shape {
  display: inline-block;
  background: var(--border-color);
  border-radius: 2px;
  flex-shrink: 0;
}

.shape-v-a4 { width: 10px; height: 14px; }
.shape-v-3040 { width: 12px; height: 16px; }
.shape-v-4050 { width: 14px; height: 18px; }
.shape-v-5070 { width: 15px; height: 21px; }
.shape-v-70100 { width: 17px; height: 24px; }
.shape-sq-30 { width: 13px; height: 13px; }
.shape-sq-50 { width: 17px; height: 17px; }
.shape-v-1318 { width: 9px; height: 13px; }
.shape-v-1015 { width: 8px; height: 12px; }

/* Custom Frame Form */
.custom-frame-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.btn-primary-form {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 40px;
  padding: 0 1.25rem;
  background: var(--primary-accent);
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary-form:hover {
  background: var(--primary-hover);
}

/* ==========================================================================
   Lienzo visual interactivo de la pared
   ========================================================================== */
.wall-stage-section {
  position: relative;
  margin-bottom: 2rem;
}

.stage-info-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.stage-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-145 { background: var(--gold-line); }
.dot-drill { background: #ef4444; }
.dot-sofa { background: rgba(59, 130, 246, 0.4); }

.stage-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.btn-zoom {
  width: 32px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-main);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8125rem;
}

.btn-zoom:hover {
  background: var(--surface-card);
}

.btn-zoom-reset {
  width: auto;
  padding: 0 0.5rem;
  font-weight: 600;
  font-size: 0.6875rem;
}

.zoom-level-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0 0.4rem;
  color: var(--text-muted);
}

/* Viewport del muro con reglas métricas */
.wall-viewport {
  width: 100%;
  min-height: 480px;
  max-height: 650px;
  overflow: auto;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  position: relative;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.25);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 40px 20px 0 45px;
}

.wall-canvas-wrapper {
  position: relative;
  display: inline-block;
}

/* Reglas graduadas métricas */
.ruler-horizontal {
  position: absolute;
  top: -24px;
  left: 0;
  height: 24px;
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 9px;
  color: #94a3b8;
  overflow: hidden;
}

.ruler-vertical {
  position: absolute;
  top: 0;
  left: -28px;
  width: 28px;
  height: 100%;
  background: rgba(15, 23, 42, 0.85);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 9px;
  color: #94a3b8;
  overflow: hidden;
}

/* Pared interactiva */
.interactive-wall {
  position: relative;
  background-color: #eae7df;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  user-select: none;
  transition: background-color 0.25s ease;
}

/* Rodapié y suelo de la pared */
.wall-baseboard {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 10px;
  background: #ffffff;
  border-top: 1px solid #cbd5e1;
  z-index: 10;
}

.wall-floor {
  position: absolute;
  bottom: -20px;
  left: 0;
  width: 100%;
  height: 20px;
  background: #78350f;
  z-index: 9;
}

/* Línea de guía a 145 cm */
.guide-line-145 {
  position: absolute;
  left: 0;
  width: 100%;
  height: 0;
  border-top: 2px dashed var(--gold-line);
  z-index: 20;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
}

.guide-tag {
  background: var(--gold-line);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  transform: translateY(-50%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Franja sobre sofá */
.guide-band-sofa {
  position: absolute;
  left: 0;
  width: 100%;
  background: rgba(59, 130, 246, 0.12);
  border-top: 1px dashed rgba(59, 130, 246, 0.4);
  border-bottom: 1px dashed rgba(59, 130, 246, 0.4);
  z-index: 15;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-band-tag {
  font-size: 10px;
  font-weight: 600;
  color: #2563eb;
  background: rgba(255, 255, 255, 0.9);
  padding: 1px 6px;
  border-radius: 3px;
}

/* Centroide de composición */
.composition-centroid-indicator {
  position: absolute;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  margin-bottom: -10px;
  z-index: 25;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.centroid-crosshair {
  width: 14px;
  height: 14px;
  border: 2px solid #ef4444;
  border-radius: 50%;
  position: relative;
}

.centroid-crosshair::before,
.centroid-crosshair::after {
  content: '';
  position: absolute;
  background: #ef4444;
}
.centroid-crosshair::before { width: 22px; height: 1.5px; left: -5px; top: 4px; }
.centroid-crosshair::after { width: 1.5px; height: 22px; top: -5px; left: 4px; }

.centroid-label {
  position: absolute;
  top: 18px;
  white-space: nowrap;
  background: #ef4444;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
}

/* Capas */
.frames-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
}

.dimensions-svg-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 35;
  pointer-events: none;
}

/* Silueta de mueble */
.furniture-silhouette {
  position: absolute;
  bottom: 0;
  z-index: 28;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.furniture-body {
  width: 100%;
  height: 100%;
  background: #334155;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.25);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.furniture-cushions {
  width: 100%;
  height: 45%;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  gap: 4px;
  padding: 4px;
}

.furniture-cushions span {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.furniture-label {
  position: absolute;
  top: -22px;
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Elementos de marco interactivo
   ========================================================================== */
.frame-box {
  position: absolute;
  cursor: grab;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25), 0 2px 5px rgba(0, 0, 0, 0.15);
  transition: transform 0.05s ease, box-shadow 0.15s ease;
  touch-action: none;
}

.frame-box:active, .frame-box.dragging {
  cursor: grabbing;
  z-index: 100 !important;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.35), 0 0 0 2px var(--primary-accent);
}

.frame-box.selected {
  outline: 2px solid var(--primary-accent);
  outline-offset: 2px;
}

/* Molduras fotorrealistas */
.frame-box.moldure-wood-oak {
  background-color: #c7a76c;
  background-image: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(0,0,0,0.15) 100%);
  border: 3px solid #8e6c38;
}

.frame-box.moldure-wood-walnut {
  background-color: #5c3a21;
  background-image: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.3) 100%);
  border: 3px solid #382112;
}

.frame-box.moldure-black-matte {
  background-color: #1a1a1a;
  border: 3px solid #0a0a0a;
}

.frame-box.moldure-white-matte {
  background-color: #ffffff;
  border: 3px solid #e2e8f0;
}

.frame-box.moldure-gold-nordic {
  background-color: #dfba63;
  background-image: linear-gradient(135deg, #f7e096 0%, #b8933b 100%);
  border: 3px solid #9c7827;
}

/* Paspartú interior */
.frame-mat {
  width: 86%;
  height: 86%;
  background-color: #faf9f5;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
  border: 1px solid #e5e5df;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Ventana de lámina artística SVG */
.frame-artwork {
  width: 78%;
  height: 78%;
  background-color: #f1ede4;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.artwork-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Punto de taladro / alcayata */
.frame-drill-marker {
  position: absolute;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  background-color: #ef4444;
  border: 2px solid #ffffff;
  border-radius: 50%;
  z-index: 40;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
  pointer-events: none;
}

.frame-tag-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
  z-index: 45;
  pointer-events: none;
}

/* ==========================================================================
   Barra contextual del marco seleccionado
   ========================================================================== */
.frame-context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  margin-top: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.context-item-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-frame-id {
  background: var(--primary-accent);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.ctx-dimensions {
  font-weight: 700;
  font-size: 0.875rem;
}

.context-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.btn-ctx {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 34px;
  padding: 0 0.65rem;
  font-family: var(--font-main);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-ctx:hover {
  background: var(--primary-subtle);
  color: var(--primary-accent);
  border-color: var(--primary-accent);
}

.btn-ctx-delete {
  color: var(--danger-color);
}
.btn-ctx-delete:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger-color);
  color: var(--danger-hover);
}

.ctx-moldure-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.ctx-moldure-picker select {
  height: 34px;
  font-size: 0.75rem;
  padding: 0 0.5rem;
}

.ctx-hook-input {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.ctx-hook-input input {
  width: 55px;
  height: 34px;
  text-align: center;
  padding: 0 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
}

.ctx-nudge-group {
  display: inline-flex;
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.btn-nudge {
  width: 28px;
  height: 32px;
  background: transparent;
  border: none;
  font-weight: 700;
  font-size: 0.8125rem;
  cursor: pointer;
  color: var(--text-main);
}
.btn-nudge:hover {
  background: var(--surface-card);
  color: var(--primary-accent);
}

/* ==========================================================================
   Diagnóstico de armonía e interiorismo
   ========================================================================== */
.harmony-diagnosis-section {
  margin-bottom: 2rem;
}

.section-title-sm {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.875rem;
  color: var(--text-main);
}

.diagnosis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.diagnosis-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: border-color 0.2s ease;
}

.diagnosis-card.status-ok {
  border-left: 4px solid var(--success-color);
}
.diagnosis-card.status-warn {
  border-left: 4px solid var(--gold-accent);
}

.diag-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-accent);
  flex-shrink: 0;
}

.diag-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.diag-value {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0.2rem 0;
}

.diag-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.35;
}

/* ==========================================================================
   Ficha técnica de taladrado y replanteo
   ========================================================================== */
.drilling-table-section {
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.sheet-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.sheet-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.wall-type-selector {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.wall-type-selector select {
  height: 38px;
  font-size: 0.8125rem;
}

.btn-action-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 38px;
  padding: 0 1rem;
  background: var(--primary-accent);
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 0.8125rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-action-primary:hover {
  background: var(--primary-hover);
}

.table-responsive-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  margin-bottom: 1.25rem;
}

.drilling-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  text-align: left;
}

.drilling-table th {
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.drilling-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.drilling-table tbody tr:hover {
  background: var(--primary-subtle);
}

.drilling-table tbody tr:last-child td {
  border-bottom: none;
}

.empty-table-msg {
  text-align: center;
  color: var(--text-dim);
  padding: 2rem !important;
  font-style: italic;
}

.coord-tag {
  display: inline-block;
  background: var(--surface-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  color: var(--primary-accent);
  border: 1px solid var(--border-color);
}

.drilling-tips-callout {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--gold-accent);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.callout-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.callout-body strong {
  color: var(--text-main);
}
.callout-body p {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
}

/* ==========================================================================
   Guía técnica y FAQs SEO
   ========================================================================== */
.seo-guide-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.faq-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.faq-accordion-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.faq-accordion-item {
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.faq-accordion-item[open] {
  border-color: var(--primary-accent);
}

.faq-accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-main);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.faq-accordion-summary::-webkit-details-marker {
  display: none;
}

.faq-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.faq-accordion-item[open] .faq-chevron {
  transform: rotate(180deg);
  color: var(--primary-accent);
}

.faq-accordion-body {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.faq-accordion-body p {
  margin: 0;
}

.workshop-guide-block {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

.workshop-guide-block h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.workshop-guide-block p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 0.75rem;
}
.workshop-guide-block p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Modales de confirmación accesibles (Sin alerts)
   ========================================================================== */
.app-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.app-modal-box {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.app-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.app-modal-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.btn-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
}

.app-modal-body {
  padding: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.app-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface-subtle);
  border-top: 1px solid var(--border-color);
}

.btn-modal-cancel {
  height: 38px;
  padding: 0 1rem;
  font-family: var(--font-main);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-modal-confirm {
  height: 38px;
  padding: 0 1.25rem;
  font-family: var(--font-main);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--danger-color);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-modal-confirm:hover {
  background: var(--danger-hover);
}

/* ==========================================================================
   Modo de impresión A4 profesional (@media print)
   ========================================================================== */
@media print {
  /* Ocultar elementos publicitarios, cabeceras web, footers y herramientas interactivas */
  .app-header,
  .fijate-footer,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .related-tools-section,
  .affiliate-showcase-section,
  .seo-guide-section,
  .planner-config-card,
  .frames-catalog-section,
  .frame-context-bar,
  .stage-info-bar,
  .sheet-actions button,
  .wall-type-selector select,
  .app-modal-overlay {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
  }

  .tool-layout {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .card-main {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .wall-viewport {
    min-height: 350px !important;
    max-height: 400px !important;
    background: #f1ede4 !important;
    border: 1px solid #000000 !important;
    page-break-inside: avoid;
  }

  .interactive-wall {
    box-shadow: none !important;
  }

  .drilling-table-section {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    page-break-before: auto;
  }

  .drilling-table {
    border: 1px solid #000000;
  }

  .drilling-table th, .drilling-table td {
    border: 1px solid #000000;
    color: #000000 !important;
  }

  .coord-tag {
    border: 1px solid #000000;
    color: #000000 !important;
    background: #f0f0f0 !important;
  }
}
