/* ==========================================================================
   1. BASE & GLOBAL STYLES
   ========================================================================== */

/* Defines global variables for consistent animation timings. */
:root {
  --animation-duration-short: 0.2s;
  --animation-duration-medium: 0.5s;
  --animation-duration-long: 2.0s;
}

/* Modern sleek custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
}

/* Subtle background tech grid for industrial digital twin look */
.bg-grid-pattern {
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
                    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
}

.light-theme .bg-grid-pattern {
  background-image: linear-gradient(to right, rgba(15, 23, 42, 0.03) 1px, transparent 1px),
                    linear-gradient(to bottom, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
}

/* Subtle glassmorphism card elevation */
.card-glass {
  background: rgba(var(--color-surface-card), 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(var(--shadow-light-color), 0.2);
}

.material-symbols-outlined {
  font-variation-settings:
  'FILL' 0,
  'wght' 400,
  'GRAD' 0,
  'opsz' 24
}

/* For accessibility: visually hidden but available to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ==========================================================================
   2. KEYFRAME ANIMATIONS
   ========================================================================== */
   
/* Swiss Precision Alerts: clean border-color indicators with razor-sharp definition */
@keyframes glow-warning {
  0%, 100% {
    border-color: rgba(var(--color-warning-border), 0.35);
  }
  50% {
    border-color: rgba(var(--color-warning-border), 0.95);
  }
}

@keyframes glow-critical {
  0%, 100% {
    border-color: rgba(var(--color-critical-border), 0.4);
  }
  50% {
    border-color: rgba(var(--color-critical-border), 1);
  }
}

@keyframes glow-success {
  0%, 100% {
    border-color: rgba(var(--color-success-border), 0.3);
  }
  50% {
    border-color: rgba(var(--color-success-border), 0.85);
  }
}

/* For slide-down effect (e.g., Health Panel) */
@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* For drilldown highlight effect */
@keyframes highlight-drilldown-animation {
  0% { 
    box-shadow: 0 0 0 2px rgb(var(--color-primary)); 
  }
  100% { 
    box-shadow: 0 0 0 0 rgba(var(--color-primary), 0); 
  }
}


/* For QrScanner animation */
@keyframes scan-line-animation {
  0% { transform: translateY(-10%); }
  100% { transform: translateY(100%); }
}

/* For Data Logger scan highlight */
@keyframes highlight-scan-animation {
  0% { 
    box-shadow: 0 0 0 2px rgb(var(--color-primary));
  }
  100% { 
    box-shadow: 0 0 0 0 rgba(var(--color-primary), 0); 
  }
}


/* ==========================================================================
   3. ANIMATION UTILITY CLASSES
   ========================================================================== */

/* Standardized alert animation classes */
.alert-glow-warning {
  animation: glow-warning 2.5s ease-in-out infinite;
  will-change: border-color, box-shadow;
}

.alert-glow-critical {
  animation: glow-critical 1.2s ease-in-out infinite;
  will-change: border-color, box-shadow;
}

.alert-glow-success {
  animation: glow-success 2.5s ease-in-out infinite;
  will-change: border-color, box-shadow;
}

.animate-slide-down {
  animation: slide-down var(--animation-duration-short) ease-out forwards;
  will-change: opacity, transform;
}

.highlight-drilldown {
  animation: highlight-drilldown-animation var(--animation-duration-long) ease-out;
  will-change: box-shadow;
}

.animate-scan-line {
  animation: scan-line-animation var(--animation-duration-long) cubic-bezier(0.65, 0, 0.35, 1) infinite;
  will-change: transform;
}

.highlight-scan {
  animation: highlight-scan-animation 1.5s ease-out;
  will-change: box-shadow;
}


/* ==========================================================================
   4. COMPONENT-SPECIFIC STYLES
   ========================================================================== */

/* Data Logger "dirty" card style */
.card-dirty {
  border-color: rgb(var(--color-primary) / 0.8) !important;
  box-shadow: 0 0 0 1px rgb(var(--color-primary) / 0.4) !important;
}


/* ==========================================================================
   5. PRINT STYLES
   ========================================================================== */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
    font-size: 10pt;
  }
  .print-hidden {
    display: none !important;
  }
  .print-block {
    display: block !important;
  }
  .print-light-theme {
    background-color: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    border: 1px solid #cccccc !important;
  }
  .print-no-border {
    border: none !important;
  }
  
  /* Data Logger Print Styles */
  .data-logger-print-section {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 2rem;
  }
  .data-logger-print-title {
    font-size: 1.5rem;
    font-weight: bold;
    border-bottom: 2px solid #000;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
  }
  .data-logger-component-title {
      font-size: 1.1rem;
      font-weight: 600;
      margin-top: 1rem;
      margin-bottom: 0.5rem;
      border-bottom: 1px solid #eee;
      padding-bottom: 0.25rem;
  }
  .data-logger-print-item {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      padding: 0.5rem 0.25rem;
      border-bottom: 1px dotted #ccc;
  }
  .data-logger-print-item .label {
      flex: 3;
      padding-right: 1rem;
      color: #000;
  }
  .data-logger-print-item .current-value {
      flex: 1;
      color: #555;
      font-style: italic;
      text-align: right;
      padding-right: 1rem;
  }
  .data-logger-print-item .input-area {
      flex: 1;
      border-bottom: 1px solid #333;
      height: 1.5rem;
      margin-right: 0.5rem;
  }
  .data-logger-print-item .unit {
      flex: 0 0 50px; /* fixed width for unit */
      color: #333;
      text-align: left;
  }
}


/* ==========================================================================
   6. ACCESSIBILITY OVERRIDES
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}