/* ==========================================================================
   SOMA PRECISION SYSTEM - HOJA DE ESTILOS MODULAR
   Normativa D.S. 024-2016-EM / Ley 29783 / R.M. 050-2013-TR
   ========================================================================== */

:root {
  /* Brand Structure */
  --soma-primary: #0f172a;
  --soma-primary-hover: #1e293b;
  --soma-primary-container: #131b2e;
  --soma-on-primary: #ffffff;

  /* Safety & Compliance (Verde Minero) */
  --soma-secondary: #006c4a;
  --soma-secondary-hover: #005137;
  --soma-secondary-container: #82f5c1;
  --soma-on-secondary-container: #00714e;

  /* Warning / Peligro Medio (Ámbar Industrial) */
  --soma-tertiary: #d97706;
  --soma-tertiary-container: #ffdcc3;
  --soma-on-tertiary-container: #c76c00;

  /* Critical / Peligro Alto (Rojo Fatalidad) */
  --soma-error: #ba1a1a;
  --soma-error-hover: #93000a;
  --soma-error-container: #ffdad6;
  --soma-on-error: #ffffff;

  /* Surfaces & Canvas */
  --soma-surface: #f8f9ff;
  --soma-surface-lowest: #ffffff;
  --soma-surface-low: #eff4ff;
  --soma-surface-high: #dce9ff;
  --soma-on-surface: #0b1c30;
  --soma-on-surface-variant: #45464d;
  --soma-outline: #76777d;
  --soma-outline-variant: #e2e8f0;

  /* Typography */
  --font-family-base: 'Inter', system-ui, -apple-system, sans-serif;
  --font-family-tabular: 'Inter', monospace;
}

/* Base resets & typography */
body {
  font-family: var(--font-family-base);
  background-color: var(--soma-surface);
  color: var(--soma-on-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Card Elevations */
.soma-card {
  background: var(--soma-surface-lowest);
  border: 1px solid var(--soma-outline-variant);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.05);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.soma-card:hover {
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  border-color: #cbd5e1;
}

.soma-card-interactive {
  cursor: pointer;
}
.soma-card-interactive:active {
  transform: scale(0.995);
}

/* Pill badges */
.badge-safety {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-warning {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-critical {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-info {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* Pulse indicator for live sync / offline */
@keyframes soma-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.15); }
}

.animate-soma-pulse {
  animation: soma-pulse 2s infinite ease-in-out;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fadeIn {
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Toast container */
#soma-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.soma-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  font-size: 0.875rem;
  font-weight: 500;
  animation: fadeIn 0.2s ease-out;
}

.soma-toast.success { border-left: 4px solid #10b981; }
.soma-toast.error { border-left: 4px solid #ef4444; }
.soma-toast.warning { border-left: 4px solid #f59e0b; }
.soma-toast.info { border-left: 4px solid #3b82f6; }

/* Print Stylesheet for Official SST Records (Formato R.M. 050-2013-TR) */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  aside, header, #soma-toast-container, .no-print, button {
    display: none !important;
  }
  .pl-64 {
    padding-left: 0 !important;
  }
  main {
    padding-top: 0 !important;
  }
  .print-only {
    display: block !important;
  }
}
