/* RELOADER ERP Demo — mock application UI */

.erp-demo-page,
body.store-body.page-erp-demo {
  --erp-sidebar: #0c3d6e;
  --erp-sidebar-dark: #082849;
  --erp-accent: #1565c0;
  --erp-accent-light: #42a5f5;
}

.erp-demo-hero {
  padding-top: 2rem;
}

.erp-demo-brand-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.erp-demo-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.erp-demo-badge {
  margin-bottom: 0;
}

.erp-demo-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--navy);
  line-height: 1.25;
}

.erp-demo-lead {
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 0 1.25rem;
}

.erp-demo-hero-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2.5rem;
  align-items: start;
}

.erp-hero-visual {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.erp-screenshot-frame {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  background: #fff;
}

.erp-screenshot-main {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.erp-screenshot-caption {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(90deg, var(--navy), var(--brand-primary));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}

.erp-screenshot-logo {
  height: 22px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.erp-module-list {
  list-style: none;
  margin: 0;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.erp-module-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.erp-module-list li:last-child {
  border-bottom: none;
}

.erp-module-list i {
  color: var(--brand-primary);
  font-size: 1.1rem;
}

.erp-demo-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 1.25rem;
  background: rgba(21, 101, 192, 0.08);
  border: 1px solid rgba(21, 101, 192, 0.15);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.erp-demo-note i {
  color: var(--brand-primary);
  font-size: 1.1rem;
}

.erp-app-frame {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
  background: #0a1628;
}

.erp-app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 620px;
  font-size: 0.875rem;
}

/* Sidebar */
.erp-sidebar {
  background: linear-gradient(180deg, #0c3d6e 0%, #082849 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.erp-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.erp-sidebar-brand > i {
  font-size: 1.5rem;
  color: var(--brand-primary-light);
}

.erp-sidebar-logo {
  height: 36px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.erp-sidebar-brand strong {
  display: block;
  font-size: 0.9rem;
}

.erp-sidebar-brand small {
  opacity: 0.65;
  font-size: 0.72rem;
}

.erp-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.erp-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.erp-nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.erp-nav-item.active {
  background: rgba(66, 165, 245, 0.2);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand-primary-light);
}

.erp-nav-item i {
  font-size: 1rem;
  opacity: 0.9;
}

.erp-sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main area */
.erp-main {
  background: #f4f7fb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.erp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.erp-module-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
}

.erp-topbar-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.erp-topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.erp-user {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.erp-user i {
  margin-right: 4px;
  color: var(--brand-primary);
}

.erp-topbar-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  opacity: 0.9;
}

.erp-module {
  padding: 16px 20px 24px;
  overflow: auto;
  flex: 1;
}

.erp-module[hidden] {
  display: none !important;
}

/* KPI cards */
.erp-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.erp-kpi-row--3 {
  grid-template-columns: repeat(3, 1fr);
}

.erp-kpi {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(12, 61, 110, 0.04);
}

.erp-kpi small {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.erp-kpi strong {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

.erp-kpi strong small {
  display: inline;
  font-size: 0.75rem;
  font-weight: 500;
}

.erp-kpi-alert {
  color: #dc2626 !important;
}

.erp-kpi-trend {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
}

.erp-kpi-trend.up { color: #059669; }
.erp-kpi-trend.down { color: #dc2626; }
.erp-kpi-trend.warn { color: #d97706; }

/* Panels */
.erp-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.erp-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.erp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-weight: 600;
  color: var(--navy);
  font-size: 0.88rem;
}

.erp-panel-meta {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.erp-link {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--brand-primary);
  cursor: pointer;
}

/* Chart */
.erp-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  height: 140px;
  padding-top: 8px;
}

.erp-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.erp-chart-bar {
  width: 100%;
  max-width: 36px;
  height: var(--h, 50%);
  background: linear-gradient(180deg, var(--brand-primary-light), var(--brand-primary));
  border-radius: 4px 4px 0 0;
  animation: erpBarPulse 3s ease-in-out infinite;
  transition: height 0.6s ease;
}

.erp-chart-col:nth-child(odd) .erp-chart-bar {
  animation-delay: 0.3s;
}

.erp-chart-col small {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.7rem;
}

@keyframes erpBarPulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

/* OEE */
.erp-oee-bars {
  margin-bottom: 12px;
}

.erp-oee-row {
  display: grid;
  grid-template-columns: 90px 1fr 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.8rem;
}

.erp-oee-row span:first-child {
  color: var(--text-secondary);
}

.erp-oee-row strong {
  text-align: right;
  color: var(--navy);
}

.erp-progress {
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}

.erp-progress div {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-primary-light));
  border-radius: 99px;
  transition: width 0.8s ease;
}

.erp-progress--sm {
  height: 6px;
  margin-bottom: 4px;
}

.erp-gauge-wrap {
  text-align: center;
  padding-top: 4px;
}

.erp-gauge {
  position: relative;
  width: 120px;
  margin: 0 auto;
}

.erp-gauge svg {
  width: 100%;
  display: block;
}

.erp-gauge-bg {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 10;
  stroke-linecap: round;
}

.erp-gauge-fill {
  fill: none;
  stroke: url(#erpGaugeGrad);
  stroke: var(--brand-primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 157;
  stroke-dashoffset: 28;
  transition: stroke-dashoffset 1s ease;
}

.erp-gauge-val {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
}

.erp-gauge-label {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Table */
.erp-table-wrap {
  overflow-x: auto;
}

.erp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.erp-table th,
.erp-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.erp-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.erp-table code {
  font-size: 0.78rem;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--brand-primary-dark);
}

.erp-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
}

.erp-badge--success { background: #dcfce7; color: #166534; }
.erp-badge--warning { background: #fef3c7; color: #92400e; }
.erp-badge--danger { background: #fee2e2; color: #991b1b; }
.erp-badge--muted { background: #f1f5f9; color: #64748b; }

.erp-btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--brand-primary);
  cursor: pointer;
  transition: background var(--transition);
}

.erp-btn-sm:hover {
  background: var(--bg-elevated);
}

/* Lists */
.erp-machine-list,
.erp-bom-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.erp-machine-list li,
.erp-bom-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.erp-machine-list li:last-child,
.erp-bom-list li:last-child {
  border-bottom: none;
}

.erp-machine-list li.run i { color: #22c55e; font-size: 0.5rem; }
.erp-machine-list li.idle i { color: #94a3b8; font-size: 0.5rem; }

.erp-machine-list li span {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Report cards */
.erp-report-card {
  text-align: center;
  padding: 24px 20px;
}

.erp-report-card > i {
  font-size: 2rem;
  color: var(--brand-primary);
  margin-bottom: 12px;
  display: block;
}

.erp-report-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--navy);
}

.erp-report-card p {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.cta-tech-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Screenshot gallery */
.erp-gallery-section {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.erp-gallery-section code {
  font-size: 0.85em;
  background: rgba(21, 101, 192, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--brand-primary-dark);
}

.erp-gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.erp-gallery-tab {
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.erp-gallery-tab:hover {
  border-color: var(--brand-primary-light);
  color: var(--brand-primary);
}

.erp-gallery-tab.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.erp-gallery-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  align-items: start;
}

.erp-gallery-preview {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  background: #fff;
}

.erp-gallery-preview > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: opacity 0.35s ease;
}

.erp-gallery-preview > img.is-fading {
  opacity: 0.4;
}

.erp-gallery-brand {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.erp-gallery-brand img {
  height: 28px;
  width: auto;
  display: block;
}

.erp-gallery-info h3 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  color: var(--navy);
}

.erp-gallery-info p {
  color: var(--text-secondary);
  margin: 0 0 1.25rem;
}

.erp-gallery-features {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.erp-gallery-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.erp-gallery-features i {
  color: var(--brand-primary);
}

.erp-gallery-thumbs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.erp-gallery-thumb {
  padding: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: 100px;
  cursor: pointer;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.erp-gallery-thumb:hover {
  border-color: var(--brand-primary-light);
}

.erp-gallery-thumb.active {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-glow);
}

.erp-gallery-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

/* Responsive */
@media (max-width: 992px) {
  .erp-demo-hero-grid {
    grid-template-columns: 1fr;
  }

  .erp-gallery-layout {
    grid-template-columns: 1fr;
  }

  .erp-app {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .erp-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .erp-sidebar-brand {
    flex: 1;
    min-width: 200px;
  }

  .erp-nav {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    padding: 8px;
  }

  .erp-nav-item {
    flex: 1 1 auto;
    min-width: 120px;
    justify-content: center;
    font-size: 0.78rem;
    padding: 8px;
  }

  .erp-nav-item.active {
    box-shadow: inset 0 -3px 0 var(--brand-primary-light);
  }

  .erp-sidebar-foot {
    width: 100%;
  }

  .erp-kpi-row,
  .erp-kpi-row--3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .erp-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .erp-kpi-row,
  .erp-kpi-row--3 {
    grid-template-columns: 1fr;
  }

  .erp-nav-item span:not(.bi) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .erp-chart-bar {
    animation: none;
  }
}
