/* ============================================
   OriginCEL-WK1 Demo — Biomedical Style System
   ============================================ */

:root {
  --primary: #0055B8;
  --primary-light: #E3F0FF;
  --primary-dark: #003D87;
  --secondary: #00897B;
  --secondary-light: #E0F2F1;
  --accent: #00B0F0;
  --accent-light: #E1F5FE;
  --success: #2E7D32;
  --success-light: #E8F5E9;
  --warning: #F57F17;
  --warning-light: #FFF8E1;
  --danger: #C62828;
  --danger-light: #FFEBEE;
  --text-primary: #1A2332;
  --text-secondary: #546E7A;
  --text-muted: #90A4AE;
  --bg-main: #F0F4F8;
  --bg-card: #FFFFFF;
  --bg-sidebar: #0A1929;
  --bg-sidebar-hover: #112240;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --sidebar-width: 240px;
  --header-height: 64px;
  --font: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: var(--font);
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Sidebar Navigation ---- */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.sidebar-logo .logo-img {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.sidebar-logo .logo-sub {
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  display: block;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  color: rgba(255,255,255,0.35);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 12px 4px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.nav-link:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}

.nav-link.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

.nav-link svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
  font-size: 11px;
}

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.page-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.page-header .breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-time {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  background: var(--bg-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.device-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.device-badge.online {
  background: var(--success-light);
  color: var(--success);
}

.device-badge.online::before {
  content: '';
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.page-body {
  padding: 24px 32px;
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-main);
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---- Stat Cards ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: box-shadow 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.teal { background: var(--secondary-light); color: var(--secondary); }

.stat-icon svg { width: 22px; height: 22px; }

.stat-info { flex: 1; }

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  font-family: var(--font-mono);
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Grid Layouts ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  background: var(--bg-main);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(0,85,184,0.03); }

/* ---- Status Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.badge.running { background: var(--success-light); color: var(--success); }
.badge.idle { background: var(--bg-main); color: var(--text-muted); }
.badge.warning { background: var(--warning-light); color: var(--warning); }
.badge.error { background: var(--danger-light); color: var(--danger); }
.badge.completed { background: var(--primary-light); color: var(--primary); }

.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.running::before { animation: pulse 2s infinite; }

/* ---- Progress Bars ---- */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.progress-fill.blue { background: var(--primary); }
.progress-fill.green { background: var(--success); }
.progress-fill.orange { background: var(--warning); }
.progress-fill.red { background: var(--danger); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* ---- Alerts ---- */
.alert-list { list-style: none; }

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background 0.2s;
}

.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: rgba(0,85,184,0.02); }

.alert-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.alert-dot.info { background: var(--primary); }
.alert-dot.warn { background: var(--warning); }
.alert-dot.error { background: var(--danger); }
.alert-dot.success { background: var(--success); }

.alert-text { flex: 1; color: var(--text-primary); }
.alert-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; font-family: var(--font-mono); }

/* ---- Gauge / Meter ---- */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.gauge {
  width: 100px; height: 100px;
  position: relative;
}

.gauge svg { width: 100%; height: 100%; }

.gauge-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}

.gauge-value {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  text-align: center;
}

/* ---- Timeline / Gantt ---- */
.gantt-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.gantt-label {
  font-size: 13px;
  font-weight: 500;
  padding-right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gantt-track {
  height: 36px;
  position: relative;
  background: var(--bg-main);
  border-radius: 4px;
}

.gantt-bar {
  position: absolute;
  height: 28px;
  top: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s;
}

.gantt-bar:hover { opacity: 0.85; }
.gantt-bar.phase-1 { background: var(--primary); }
.gantt-bar.phase-2 { background: var(--secondary); }
.gantt-bar.phase-3 { background: var(--accent); }
.gantt-bar.phase-4 { background: #7E57C2; }
.gantt-bar.phase-5 { background: var(--warning); }

/* ---- Inventory Cards ---- */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.inventory-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: box-shadow 0.2s;
}

.inventory-card:hover { box-shadow: var(--shadow-md); }

.inventory-card .inv-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.inventory-card .inv-category {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.inventory-card .inv-stock {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
}

.inventory-card .inv-qty {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
}

/* ---- Tabs ---- */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab-item {
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-weight: 500;
}

.tab-item:hover { color: var(--primary); }

.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ---- Misc ---- */
.text-mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }

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

.fade-in { animation: fadeIn 0.4s ease-out; }

/* ---- Responsive ---- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-body { padding: 16px; }
}

/* ---- Landing Page (index.html) ---- */
.landing {
  min-height: 100vh;
  background: linear-gradient(135deg, #0A1929 0%, #0D2137 40%, #0A1929 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: white;
}

.landing-hero {
  text-align: center;
  margin-bottom: 60px;
}

.landing-hero h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.landing-hero p {
  font-size: 16px;
  color: rgba(255,255,255,0.6);
  max-width: 600px;
}

.landing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  max-width: 1100px;
  width: 100%;
}

.landing-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-decoration: none;
  color: white;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.landing-card:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,176,240,0.15);
}

.landing-card .lc-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-card .lc-icon svg { width: 24px; height: 24px; color: white; }

.landing-card h3 {
  font-size: 16px;
  font-weight: 600;
}

.landing-card p {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
}

.landing-footer {
  margin-top: 60px;
  color: rgba(255,255,255,0.3);
  font-size: 12px;
}

/* ---- Simulated Microscope View ---- */
.microscope-view {
  width: 100%;
  aspect-ratio: 4/3;
  background: #0A0A0A;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.microscope-view canvas {
  width: 100%;
  height: 100%;
}

.microscope-overlay {
  position: absolute;
  top: 12px; left: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.microscope-overlay span {
  font-size: 10px;
  font-family: var(--font-mono);
  color: rgba(0,255,128,0.8);
  text-shadow: 0 0 4px rgba(0,255,128,0.3);
}

.microscope-overlay-right {
  position: absolute;
  top: 12px; right: 12px;
  text-align: right;
}

.microscope-overlay-right span {
  font-size: 10px;
  font-family: var(--font-mono);
  color: rgba(0,176,240,0.8);
  text-shadow: 0 0 4px rgba(0,176,240,0.3);
  display: block;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
