/* style.css - Estilos Avanzados de Mockups, Inventarios y Portales (Fase 3) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --color-primary-dark: #0F4C81;
  --color-primary-bright: #1976D2;
  --color-accent-blue: #E3F2FD;
  --color-ink-blue: #1b3a82;
  --color-ink-black: #1a1a1a;
  --color-ink-red: #c62828;
  --color-ink-green: #2e7d32;
  
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
}

body {
  font-family: var(--font-body);
  scroll-behavior: smooth;
  background-color: #f8fafc;
  color: #1e293b;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
}

/* ==========================================
   INTERFACES GLASSMORPHISM & PRESETS
   ========================================== */
.glass-panel {
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.glass-nav {
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(241, 245, 249, 0.8);
}

.main-nav {
  display: none;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #4b5563;
}

.main-nav a {
  color: inherit;
  text-decoration: none;
  transition: color 160ms ease;
}

.main-nav a:hover {
  color: var(--color-primary-dark);
}

.header-design-btn {
  display: none;
  align-items: center;
  border: 0;
  cursor: pointer;
}

#catalog-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
}

@media (min-width: 768px) {
  .main-nav {
    display: flex !important;
  }
}

@media (min-width: 640px) {
  .header-design-btn {
    display: inline-flex !important;
  }
}

/* ==========================================
   MOCKUP MODES (Visuales de Diseño)
   ========================================== */

/* 1. Modo Vectorial Crispado */
.mockup-vectorial {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
}

/* 2. Modo Tinta Estampada sobre Papel Rugoso */
.mockup-stamped {
  background-color: #fcfbf9;
  /* Simular textura de papel algodón */
  background-image: 
    radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 0),
    radial-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 0);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.02);
}

.mockup-stamped svg {
  filter: url(#grunge-filter);
  opacity: 0.96;
  transform: rotate(-1.5deg);
}

/* 3. Vista de Producto Físico */
.mockup-physical {
  background-color: #f1f5f9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Casing del Sello Físico */
.physical-stamp-case {
  width: 120px;
  height: 130px;
  background: linear-gradient(to bottom, #334155 0%, #0f172a 100%);
  border-radius: 8px 8px 12px 12px;
  position: relative;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25), inset 0 2px 4px rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 14px;
}

.physical-stamp-case::before {
  content: '';
  position: absolute;
  top: 10px;
  width: 100px;
  height: 35px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Etiqueta transparente superior que simula el sello */
.physical-stamp-label {
  width: 96px;
  height: 40px;
  background: #ffffff;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px;
  position: absolute;
  top: 60px;
}

.physical-stamp-label svg {
  width: 100% !important;
  height: 100% !important;
  filter: none !important;
}

.physical-stamp-cap {
  width: 126px;
  height: 18px;
  background: #020617;
  border-radius: 0 0 6px 6px;
  position: absolute;
  bottom: -4px;
}

/* ==========================================
   SCENE 3D AVANZADO
   ========================================== */
.scene-3d {
  perspective: 1000px;
  width: 100%;
  height: 250px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.stamp-3d-model {
  width: 130px;
  height: 150px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(20deg) rotateY(-20deg);
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.scene-3d:hover .stamp-3d-model {
  transform: rotateX(15deg) rotateY(160deg);
}

/* Caras del modelo 3D del sello */
.stamp-face {
  position: absolute;
  border-radius: 6px;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1), 0 2px 4px rgba(0,0,0,0.3);
}

.stamp-front {
  width: 110px;
  height: 110px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  transform: translateZ(25px);
  border: 1px solid rgba(255,255,255,0.1);
}

/* Etiqueta simulada pegada en la cara frontal del modelo 3D */
.stamp-front::after {
  content: '';
  position: absolute;
  top: 35px;
  left: 10px;
  width: 90px;
  height: 40px;
  background: white;
  border-radius: 2px;
  box-shadow: inset 0 0 2px rgba(0,0,0,0.2);
  background-image: radial-gradient(circle, #3b82f6 1px, transparent 1px);
  background-size: 10px 10px;
  opacity: 0.7;
}

.stamp-back {
  width: 110px;
  height: 110px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  transform: rotateY(180deg) translateZ(25px);
  border: 1px solid rgba(255,255,255,0.1);
}

.stamp-right {
  width: 50px;
  height: 110px;
  background: #111827;
  transform: rotateY(90deg) translateZ(85px);
}

.stamp-left {
  width: 50px;
  height: 110px;
  background: #111827;
  transform: rotateY(-90deg) translateZ(25px);
}

.stamp-top {
  width: 110px;
  height: 50px;
  background: #475569;
  transform: rotateX(90deg) translateZ(25px);
  border-radius: 8px 8px 0 0;
}

.stamp-bottom {
  width: 110px;
  height: 50px;
  background: #020617;
  transform: rotateX(-90deg) translateZ(85px);
  border-bottom: 6px solid var(--color-primary-bright);
}

.stamp-handle {
  width: 34px;
  height: 30px;
  background: radial-gradient(circle, #64748b 30%, #0f172a 90%);
  border-radius: 50% 50% 10% 10%;
  position: absolute;
  top: -24px;
  left: 38px;
  transform: rotateX(0deg) translateZ(10px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

/* ==========================================
   TABLA DE INVENTARIO Y ALERTAS STOCK
   ========================================== */
.stock-warning-low {
  background-color: #fef2f2;
  color: #991b1b;
  animation: pulse-red-bg 2.5s infinite;
}

.badge-warning-low {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

@keyframes pulse-red-bg {
  0% { background-color: #fef2f2; }
  50% { background-color: #fee2e2; }
  100% { background-color: #fef2f2; }
}

/* ==========================================
   ANIMACIONES CLAVE
   ========================================== */
.fade-in-section {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-in-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.product-card {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -15px rgba(15, 76, 129, 0.15);
}

@keyframes stamp-press {
  0% { transform: translateY(-50px) scale(1.05) rotate(-3deg); opacity: 0; }
  45% { transform: translateY(-40px) scale(1.05) rotate(-3deg); opacity: 1; }
  60% { transform: translateY(0) scale(0.96) rotate(0deg); }
  65% { transform: translateY(-6px) scale(0.98); }
  72% { transform: translateY(0) scale(1); }
  100% { transform: translateY(0) rotate(0deg); }
}

.animate-stamp-handle {
  animation: stamp-press 2.2s cubic-bezier(0.25, 1, 0.5, 1) infinite;
  transform-origin: bottom center;
}

@keyframes ink-bleed {
  0% { opacity: 0; transform: scale(0.88); filter: blur(3px); }
  58% { opacity: 0; transform: scale(0.9); filter: blur(2.5px); }
  60% { opacity: 0.8; transform: scale(0.98); filter: blur(0.5px); }
  64% { opacity: 1; transform: scale(1.01); filter: blur(0px); }
  100% { opacity: 1; transform: scale(1); }
}

.animate-ink-mark {
  animation: ink-bleed 2.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  transform-origin: center;
}

/* ==========================================
   PERSONALIZACIÓN DE SCROLLBARS Y OTROS
   ========================================== */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(15, 76, 129, 0.2);
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 76, 129, 0.4);
}

.pulse-green {
  animation: pulse-green-keyframes 2s infinite;
}

@keyframes pulse-green-keyframes {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Gráfico de barras simples para Chart fallback */
.chart-bar {
  transition: height 1s ease-out;
}

/* Layering for Custom Mockup with SVG Text Overlay */
.mockup-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mockup-bg-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none; /* User interacts with overlay SVG */
}

.mockup-overlay-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

.draggable-text {
  cursor: move;
  -webkit-user-select: none;
  user-select: none;
}
.draggable-text:hover {
  filter: drop-shadow(0 0 2px rgba(15, 76, 129, 0.6));
}

/* Hide default stamp template borders when overlaid on top of a mockup */
.mockup-wrapper .stamp-border {
  display: none !important;
}

/* Prevent SVG content (dragged text/logos) from clipping */
.mockup-overlay-svg svg,
#seal-preview-box svg,
#seal-preview-box-stamped svg,
#seal-preview-box-physical svg,
#approval-svg-container svg {
  overflow: visible !important;
}

/* Draggable text cursor */
.draggable-text {
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.draggable-text:active {
  cursor: grabbing;
}

/* Selected text/logo element glow highlight */
.draggable-text.selected-text-element {
  filter: drop-shadow(0 0 3px #1976D2) !important;
}
.draggable-text.selected-text-element text,
.draggable-text.selected-text-element path,
.draggable-text.selected-text-element image {
  stroke: rgba(25, 118, 210, 0.3);
  stroke-width: 0.5px;
  paint-order: stroke fill;
}
