/* ==========================================================================
   DIAGRAMAS GENEALÓGICOS - ESTILOS PRINCIPALES
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --male-color: #3b82f6;
  --female-color: #ec4899;
  --neutral-color: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px 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.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   BARRA SUPERIOR (NAVBAR & TOOLBAR)
   -------------------------------------------------------------------------- */
.app-header {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 20;
  flex-shrink: 0;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1e293b;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buscador */
.search-box-wrapper {
  position: relative;
  width: 240px;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-main);
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 0.85rem;
  pointer-events: none;
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
  display: none;
  z-index: 50;
}

.search-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
  transition: background 0.15s ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--primary-light);
}

/* Botones y dropdowns */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-outline {
  background: white;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-icon {
  padding: 8px 10px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover:not(:disabled) {
  background: #f1f5f9;
}

.btn-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.select-mode {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: white;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
}

.select-mode:focus {
  outline: none;
  border-color: var(--primary);
}

/* --------------------------------------------------------------------------
   ÁREA DE TRABAJO PRINCIPAL (CANVAS Y SIDEBAR)
   -------------------------------------------------------------------------- */
.main-workspace {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   BARRA LATERAL IZQUIERDA: GESTIÓN DE ÁRBOLES FAMILIARES
   -------------------------------------------------------------------------- */
.trees-sidebar {
  width: 290px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 15;
  flex-shrink: 0;
  transition: margin-left 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.trees-sidebar.collapsed {
  margin-left: -290px;
  opacity: 0;
  pointer-events: none;
}

.trees-sidebar-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
  background: #f8fafc;
}

.trees-sidebar-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
}

.trees-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trees-empty-hint {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.tree-project-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #ffffff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.16s ease;
}

.tree-project-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.tree-project-item.active {
  border: 2px solid var(--primary);
  background: #eff6ff;
  box-shadow: 0 4px 8px -2px rgba(37, 99, 235, 0.12);
}

.tree-project-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tree-project-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-project-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tree-project-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
}

.trees-sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
}

/* Contenedor SVG */
.canvas-container {
  flex: 1;
  position: relative;
  background: radial-gradient(circle, #e2e8f0 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: #f8fafc;
  overflow: hidden;
}

#tree-svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  user-select: none;
}

/* Overlay de inicio limpio */
.empty-canvas-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
  padding: 20px;
}

.empty-canvas-card {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  padding: 36px 40px;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px -12px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(226, 232, 240, 0.9);
  text-align: center;
  max-width: 480px;
  animation: modalIn 0.25s ease-out;
}

.empty-canvas-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Controles flotantes de Zoom */
.floating-zoom-bar {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  padding: 6px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
}

.floating-zoom-bar .btn-zoom {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-main);
  transition: background 0.15s ease;
}

.floating-zoom-bar .btn-zoom:hover {
  background: #f1f5f9;
}

.zoom-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 4px;
}

/* --------------------------------------------------------------------------
   PANEL LATERAL DERECHO (DETALLES Y ACCIONES DE PERSONA)
   -------------------------------------------------------------------------- */
.side-panel {
  width: 360px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 16px rgba(0,0,0,0.03);
  z-index: 15;
  flex-shrink: 0;
  overflow-y: auto;
}

.side-panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.side-panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.side-panel-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Estado sin selección */
.empty-selection {
  text-align: center;
  padding: 40px 10px;
  color: var(--text-muted);
}

.empty-selection-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Ficha de persona */
.person-profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #f8fafc;
  border-radius: var(--radius-lg);
  border: 1px solid #e2e8f0;
}

.profile-avatar-container {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-initials {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #3b82f6, #9333ea);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.profile-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  width: fit-content;
}

.badge-male {
  background: #dbeafe;
  color: #1e40af;
}

.badge-female {
  background: #fce7f3;
  color: #9d174d;
}

.badge-neutral {
  background: #f3e8ff;
  color: #6b21a8;
}

/* Botonera de acciones rápidas sobre persona */
.quick-relatives-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-relative-action {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: white;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-relative-action:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger-outline {
  border-color: #fecaca;
  color: var(--danger);
  grid-column: span 2;
}

.btn-danger-outline:hover {
  background: #fef2f2;
  border-color: var(--danger);
}

/* Secciones de Información Detallada */
.info-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.info-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.84rem;
}

.info-row-label {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.info-row-value {
  color: var(--text-main);
  font-weight: 500;
}

/* Listas de Relaciones */
.relations-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.relation-item {
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.relation-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.relation-name {
  font-weight: 600;
  color: #1e293b;
}

.btn-icon-xs {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   BARRA INFERIOR DE ESTADO
   -------------------------------------------------------------------------- */
.app-footer {
  height: 36px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 0.76rem;
  color: var(--text-muted);
  flex-shrink: 0;
  z-index: 10;
}

.tree-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-divider {
  color: var(--text-light);
}

/* --------------------------------------------------------------------------
   ESTILOS SVG PARA NODOS Y ENLACES
   -------------------------------------------------------------------------- */
.tree-node-interactive {
  cursor: pointer;
  transition: transform 0.15s ease;
}

.tree-node-interactive:hover .card-background {
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.12));
}

.card-background {
  fill: #ffffff;
  stroke-width: 1.5;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.06));
}

.card-background.gender-male {
  stroke: var(--male-color);
}

.card-background.gender-female {
  stroke: var(--female-color);
}

.card-background.gender-neutral {
  stroke: var(--neutral-color);
}

.card-accent.gender-male {
  fill: var(--male-color);
}

.card-accent.gender-female {
  fill: var(--female-color);
}

.card-accent.gender-neutral {
  fill: var(--neutral-color);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  fill: #0f172a;
}

.card-subtitle {
  font-size: 11px;
  fill: #64748b;
  font-weight: 500;
}

.card-subinfo {
  font-size: 10px;
  fill: #94a3b8;
  font-style: italic;
}

.status-living {
  fill: var(--success);
}

.status-deceased {
  fill: #94a3b8;
}

.tree-link-marriage {
  stroke: #e11d48;
  stroke-width: 2.2;
  stroke-dasharray: 4 3;
  fill: none;
}

.tree-link-parental {
  stroke: #64748b;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.tree-union-node {
  fill: #e11d48;
  stroke: white;
  stroke-width: 2;
  transition: r 0.2s ease, fill 0.2s ease;
}

.tree-marriage-indicator:hover .tree-union-node {
  r: 9;
  fill: #be123c;
}

.tree-marriage-badge-rect {
  fill: #ffffff;
  stroke: #e11d48;
  stroke-width: 1.5;
  filter: drop-shadow(0 2px 4px rgba(225, 29, 72, 0.15));
  transition: all 0.2s ease;
}

.tree-marriage-indicator:hover .tree-marriage-badge-rect {
  fill: #fff1f2;
  stroke: #be123c;
  stroke-width: 2;
  filter: drop-shadow(0 4px 6px rgba(225, 29, 72, 0.25));
}

.tree-marriage-badge-text {
  font-size: 11px;
  font-weight: 700;
  fill: #be123c;
  font-family: system-ui, -apple-system, sans-serif;
  user-select: none;
}

.tree-node-interactive.selected .card-background {
  stroke-width: 3.5;
  stroke: var(--warning);
  filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.6));
}

/* --------------------------------------------------------------------------
   PUERTOS Y CABLES INTERACTIVOS
   -------------------------------------------------------------------------- */
.tree-card-ports {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tree-node-interactive:hover .tree-card-ports,
.tree-node-interactive.selected .tree-card-ports {
  opacity: 1;
}

.tree-cable-port {
  cursor: crosshair;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.tree-cable-port:hover {
  transform: scale(1.35);
  filter: drop-shadow(0 0 6px rgba(79, 70, 229, 0.6));
}

.tree-cable-port .port-circle {
  transition: all 0.15s ease;
}

.tree-cable-port:hover .port-circle {
  stroke-width: 3;
}

/* Cable arrastrado en tiempo real */
.dynamic-drag-cable {
  stroke: #4f46e5;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 6 4;
  fill: none;
  filter: drop-shadow(0 2px 6px rgba(79, 70, 229, 0.4));
  animation: cableDashAnim 0.8s linear infinite;
}

@keyframes cableDashAnim {
  to {
    stroke-dashoffset: -20;
  }
}

/* Píldora de ayuda que sigue al cable */
.cable-drag-badge rect {
  fill: #1e1b4b;
  stroke: #818cf8;
  stroke-width: 1.5;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.cable-drag-badge text {
  fill: #ffffff;
  font-size: 11px;
  font-weight: 600;
  font-family: system-ui, -apple-system, sans-serif;
  user-select: none;
}

/* Tarjeta resaltada como destino válido */
.tree-node-interactive.cable-target-active .card-background {
  stroke: #10b981 !important;
  stroke-width: 4px !important;
  filter: drop-shadow(0 0 16px rgba(16, 185, 129, 0.75)) !important;
}

/* Cable de parentesco interactivo */
.tree-link-parental.interactive-cable {
  cursor: pointer;
  transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

.tree-link-parental.interactive-cable:hover {
  stroke: #3b82f6;
  stroke-width: 4;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.5));
}

/* Botón de acción / tijera en el cable */
.cable-action-handle {
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.cable-action-handle:hover {
  opacity: 1;
  transform: scale(1.3);
}

.cable-disconnect-circle {
  fill: #ffffff;
  stroke: #ef4444;
  stroke-width: 1.8;
  filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.25));
  transition: all 0.2s ease;
}

.cable-action-handle:hover .cable-disconnect-circle {
  fill: #fee2e2;
  stroke: #dc2626;
  stroke-width: 2.2;
}

.cable-disconnect-icon {
  font-size: 10px;
  user-select: none;
}

/* --------------------------------------------------------------------------
   MODAL DE EDICIÓN DE PERSONA
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-light);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.form-control {
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 0.88rem;
  font-family: inherit;
  transition: all 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

/* Subida de foto en modal */
.photo-upload-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.photo-preview-box {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.photo-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.photo-placeholder {
  color: var(--text-light);
  font-size: 1.8rem;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}

/* --------------------------------------------------------------------------
   TOAST NOTIFICACIONES
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 48px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: #1e293b;
  color: white;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { background: #065f46; }
.toast-warning { background: #92400e; }
.toast-error { background: #991b1b; }
.toast-info { background: #1e293b; }

/* --------------------------------------------------------------------------
   ESTILOS ASISTENTE IA & GEMINI
   -------------------------------------------------------------------------- */
.ai-quick-example-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.74rem;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-quick-example-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}

.spinner-ai {
  display: inline-block;
  animation: spin 1.2s infinite linear;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   ESTILOS PARA IMPRESIÓN Y PDF (@media print)
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: white;
  }
  .app-header,
  .side-panel,
  .app-footer,
  .floating-zoom-bar,
  .toast-container {
    display: none !important;
  }
  .main-workspace {
    width: 100vw;
    height: 100vh;
  }
  .canvas-container {
    background: white !important;
  }
}
