/* ============================================================
   ESTILOS DEL ÁREA DE TRABAJO Y LIENZO (CANVAS WORKSPACE)
   ============================================================ */

.canvas-workspace {
  flex: 1;
  background-color: var(--bg-app);
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 60%),
    radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Barra de herramientas superior del lienzo */
.canvas-toolbar {
  height: 48px;
  background: rgba(18, 21, 30, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 10;
}

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

.dimension-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-input);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

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

/* Área centrada del viewport donde flota el canvas */
.canvas-viewport {
  flex: 1;
  position: relative;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  perspective: 1000px;
}

/* Contenedor del lienzo con escalado */
.canvas-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center center;
}

.canvas-frame-card {
  position: relative;
  border-radius: var(--radius-lg);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 40px rgba(99, 102, 241, 0.15);
  overflow: hidden;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-normal);
}

/* El elemento canvas de renderizado */
#og-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  image-rendering: auto;
}

/* Guías de zona segura para redes sociales */
.safe-area-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: none;
  border: 2px dashed rgba(239, 68, 68, 0.7);
  margin: 5%; /* 5% margen seguro de recorte en feeds móviles */
  border-radius: var(--radius-sm);
  z-index: 5;
}

.safe-area-overlay::after {
  content: "Zona segura (100% visible en feeds móviles y X/LinkedIn)";
  position: absolute;
  bottom: 8px;
  right: 12px;
  background: rgba(239, 68, 68, 0.85);
  color: #ffffff;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

.safe-area-overlay.active {
  display: block;
}

/* Barra flotante de acciones rápidas sobre el lienzo */
.floating-canvas-actions {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 21, 30, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 0.35rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 15;
}

.floating-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.floating-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

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

.floating-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
}

/* Notificación tipo Toast en la esquina inferior */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.8125rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 360px;
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.5);
  background: #0f241d;
  color: #a7f3d0;
}

.toast-info {
  border-color: rgba(99, 102, 241, 0.5);
  background: #151a2d;
  color: #c7d2fe;
}

.toast-warning {
  border-color: rgba(245, 158, 11, 0.5);
  background: #271d0e;
  color: #fde68a;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 768px) {
  .canvas-workspace {
    min-height: 380px;
  }

  .canvas-viewport {
    padding: 1rem;
  }

  .floating-canvas-actions {
    bottom: 0.75rem;
  }
}
