/* 
   Inventory Comparison Dashboard - Premium Stylesheet
   Design Language: Glassmorphic Dark Mode, Neon Accents, Harmonious Gradients, Micro-animations
*/

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

/* --- Design Tokens --- */
:root {
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Color Palette (HSL Tailored) */
  --bg-main: hsl(225, 25%, 6%);
  --bg-card: hsla(223, 20%, 12%, 0.6);
  --bg-card-hover: hsla(223, 20%, 18%, 0.85);
  --border-glass: hsla(220, 20%, 25%, 0.4);
  --border-glass-active: hsla(190, 80%, 50%, 0.5);
  
  /* System Accents */
  --color-primary: hsl(190, 90%, 50%);       /* Neon Cyan */
  --color-secondary: hsl(270, 90%, 65%);     /* Radiant Purple */
  --color-success: hsl(145, 80%, 45%);       /* Emerald Green */
  --color-warning: hsl(35, 90%, 55%);        /* Warm Amber */
  --color-danger: hsl(355, 85%, 55%);        /* Coral Red */
  --color-info: hsl(205, 85%, 60%);          /* Soft Blue */
  
  /* Brand specific colors */
  --brand-smartmanager: hsl(42, 95%, 50%);  /* Yellow */
  --brand-almaden: hsl(205, 90%, 55%);       /* Blue */
  --brand-tracker: hsl(20, 95%, 50%);        /* Orange */
  
  /* Typography Colors */
  --text-main: hsl(220, 30%, 94%);
  --text-muted: hsl(220, 14%, 65%);
  --text-dim: hsl(220, 10%, 45%);
  --text-on-accent: hsl(225, 30%, 8%);
  
  /* Transitions & Shadows */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-glow-cyan: 0 0 20px hsla(190, 90%, 50%, 0.15);
  --shadow-glow-purple: 0 0 20px hsla(270, 90%, 65%, 0.15);
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  
  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 20px;
}

/* --- Reset & Global --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, hsla(270, 90%, 65%, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, hsla(190, 90%, 50%, 0.05) 0%, transparent 45%);
  background-attachment: fixed;
  line-height: 1.5;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: hsla(220, 20%, 25%, 0.6);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* --- Typography --- */
h1, h2, h3, h4, h5 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

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

@keyframes pulseGlow {
  0% { box-shadow: 0 0 15px hsla(190, 90%, 50%, 0.1); }
  50% { box-shadow: 0 0 25px hsla(190, 90%, 50%, 0.25); }
  100% { box-shadow: 0 0 15px hsla(190, 90%, 50%, 0.1); }
}

@keyframes skeletonLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.animate-fade-in {
  animation: fadeIn var(--transition-normal) forwards;
}

/* --- Layout Structure --- */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* --- Header Section --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-glass);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo-icon {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-cyan);
}

.brand-logo-icon i {
  color: var(--text-on-accent);
  font-size: 1.5rem;
}

.brand-text h1 {
  font-size: 1.8rem;
  background: linear-gradient(to right, var(--color-primary), hsl(250, 100%, 80%));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.control-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  border: 1px solid var(--border-glass);
}

.sync-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-success);
}

.sync-dot.syncing {
  background-color: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
  animation: pulseGlow 1s infinite alternate;
}

/* --- Premium Buttons --- */
.btn-premium {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--color-primary), hsl(210, 90%, 45%));
  color: var(--text-on-accent);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-glow-cyan);
}

.btn-premium:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 0 25px hsla(190, 90%, 50%, 0.35);
}

.btn-premium:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
  box-shadow: none;
}

/* --- System Overview Cards --- */
.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.card-glass {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card-glass:hover {
  transform: translateY(-4px);
  border-color: hsla(220, 20%, 40%, 0.4);
  background: var(--bg-card-hover);
}

.card-system::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
}

.card-smartmanager::before { background: var(--brand-smartmanager); }
.card-almaden::before { background: var(--brand-almaden); }
.card-tracker::before { background: var(--brand-tracker); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.system-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.system-title i {
  font-size: 1.2rem;
}

.system-logo {
  height: 22px;
  width: auto;
  object-fit: contain;
}

.card-smartmanager .system-title i { color: var(--brand-smartmanager); }
.card-almaden .system-title i { color: var(--brand-almaden); }
.card-tracker .system-title i { color: var(--brand-tracker); }

.system-title h3 {
  font-size: 1.15rem;
  color: var(--text-main);
}

.system-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 50px;
  background: hsla(220, 20%, 25%, 0.5);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
}

.system-stats {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.stat-number {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(180deg, var(--text-main) 30%, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.system-detail {
  font-size: 0.8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-glass);
  padding-top: 0.75rem;
  display: flex;
  justify-content: space-between;
}

/* --- Comparisons KPI Grid --- */
.comparison-section-title {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.comparison-section-title i {
  color: var(--color-secondary);
}

.kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  cursor: pointer;
  position: relative;
  border: 1px solid var(--border-glass);
  background: var(--bg-card);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  transition: all var(--transition-normal);
}

.kpi-card:hover {
  transform: scale(1.03);
  background: var(--bg-card-hover);
  border-color: var(--border-glass-active);
  box-shadow: var(--shadow-glow-cyan);
}

.kpi-card.active {
  background: hsla(190, 90%, 50%, 0.08);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow-cyan);
}

.kpi-card.active::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--color-primary);
  font-weight: 700;
  font-size: 0.85rem;
}

.kpi-icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: hsla(220, 20%, 25%, 0.4);
  font-size: 1.1rem;
}

.logo-compare-wrapper {
  display: flex !important;
  align-items: center;
  gap: 0.35rem;
  background: hsla(220, 20%, 20%, 0.5) !important;
  border: 1px solid var(--border-glass);
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  width: fit-content !important;
  height: 36px !important;
  margin-bottom: 1rem;
}

.kpi-mini-logo {
  height: 22px;
  width: auto;
  object-fit: contain;
}

.kpi-mini-logo.disabled {
  opacity: 0.45;
  filter: grayscale(1) brightness(1.2);
}

.kpi-separator {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* HSL themed KPI card states */
.kpi-smart-not-almaden .kpi-icon-wrapper { color: var(--color-primary); background: hsla(190, 90%, 50%, 0.1); }
.kpi-smart-not-tracker .kpi-icon-wrapper { color: var(--brand-smartmanager); background: hsla(195, 90%, 45%, 0.1); }
.kpi-tracker-not-almaden .kpi-icon-wrapper, .kpi-tracker-and-almaden .kpi-icon-wrapper { color: var(--color-success); background: hsla(145, 80%, 45%, 0.1); }
.kpi-almaden-not-tracker .kpi-icon-wrapper { color: var(--brand-almaden); background: hsla(275, 85%, 60%, 0.1); }
.kpi-perfect-match .kpi-icon-wrapper { color: var(--color-success); background: hsla(145, 80%, 45%, 0.15); box-shadow: 0 0 15px hsla(145, 80%, 45%, 0.15); }
.kpi-orphans .kpi-icon-wrapper { color: var(--color-danger); background: hsla(355, 85%, 55%, 0.1); }
.kpi-other-intersect .kpi-icon-wrapper { color: var(--color-warning); background: hsla(35, 90%, 55%, 0.1); }

.kpi-val {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  line-height: 1.1;
}

.kpi-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.3;
}

.kpi-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* --- Visual Insights Grid --- */
.insights-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

@media (max-width: 900px) {
  .insights-grid {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  height: 280px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Matrix View (Venn / Table grid style) */
.comparison-matrix {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.matrix-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: hsla(220, 20%, 20%, 0.3);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-glass);
}

.matrix-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.matrix-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.pill-sm { background: hsla(195, 90%, 45%, 0.15); color: var(--brand-smartmanager); border: 1px solid hsla(195, 90%, 45%, 0.3); }
.pill-al { background: hsla(275, 85%, 60%, 0.15); color: var(--brand-almaden); border: 1px solid hsla(275, 85%, 60%, 0.3); }
.pill-tr { background: hsla(160, 80%, 40%, 0.15); color: var(--brand-tracker); border: 1px solid hsla(160, 80%, 40%, 0.3); }

.matrix-value-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.matrix-bar-track {
  width: 100px;
  height: 6px;
  background: hsla(220, 20%, 25%, 0.5);
  border-radius: 3px;
  overflow: hidden;
}

.matrix-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
  border-radius: 3px;
  width: 0%;
  transition: width 1s ease-out;
}

.matrix-value {
  font-size: 1rem;
  font-weight: 700;
  width: 30px;
  text-align: right;
}

/* --- Comparison Details Table Section --- */
.details-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 400px;
  min-width: 250px;
}

.search-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border-radius: var(--border-radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px hsla(190, 90%, 50%, 0.15);
}

.filter-description {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.filter-highlight {
  color: var(--color-primary);
  font-weight: 700;
  border-bottom: 2px solid hsla(190, 90%, 50%, 0.3);
  padding-bottom: 1px;
}

/* Table Style */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-card);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
  background: var(--bg-card);
}

.custom-table th {
  background: hsla(220, 20%, 15%, 0.9);
  color: var(--text-muted);
  font-weight: 600;
  padding: 1rem 1.25rem;
  border-bottom: 2px solid var(--border-glass);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.custom-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-main);
  transition: var(--transition-fast);
}

.custom-table tr:last-child td {
  border-bottom: none;
}

.custom-table tr:hover td {
  background: hsla(220, 20%, 22%, 0.4);
}

.serial-cell {
  font-family: 'Consolas', 'Courier New', Courier, monospace;
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.95rem;
}

.company-cell {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* System Checklist Badges */
.system-check-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.check-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.75rem;
  position: relative;
  cursor: default;
}

.check-badge.checked {
  background: hsla(145, 80%, 45%, 0.15);
  color: var(--color-success);
  border: 1px solid hsla(145, 80%, 45%, 0.35);
}

.check-badge.unchecked {
  background: hsla(355, 85%, 55%, 0.05);
  color: var(--text-dim);
  border: 1px solid var(--border-glass);
  opacity: 0.4;
}

.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: hsl(220, 30%, 15%);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
  border: 1px solid var(--border-glass);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* --- Status/Empty/Loading Screens --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  gap: 1rem;
  text-align: center;
}

.empty-state i {
  font-size: 3rem;
  color: var(--text-dim);
}

.empty-state h3 {
  font-size: 1.25rem;
  color: var(--text-main);
}

.empty-state p {
  font-size: 0.85rem;
  max-width: 320px;
}

/* Skeleton Loading styles */
.skeleton-box {
  background: linear-gradient(90deg, 
    hsla(220, 20%, 15%, 0.5) 25%, 
    hsla(220, 20%, 25%, 0.7) 37%, 
    hsla(220, 20%, 15%, 0.5) 63%
  );
  background-size: 400% 100%;
  animation: skeletonLoading 1.4s ease infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 1rem;
  width: 100%;
  margin-bottom: 0.5rem;
}

.skeleton-circle {
  height: 24px;
  width: 24px;
  border-radius: 50%;
}

/* Footer style */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-glass);
  padding-top: 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition-fast);
}

.footer-links a:hover {
  color: var(--color-primary);
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .control-area {
    width: 100%;
    justify-content: space-between;
  }
  
  .table-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-wrapper {
    max-width: 100%;
  }
}
