/* ==========================================================================
   Distributor ERP Alkes - Medical Enterprise Clean White & Green Theme
   (Includes Strict Single Line "SEBARIS" Table Formatting - Zero Text Wrapping)
   ========================================================================== */

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

:root {
  /* Clean Medical White & Emerald Green Color Palette */
  --bg-dark: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --bg-elevated: #ffffff;
  
  --border-color: #e2e8f0;
  --border-subtle: #f8fafc;
  --border-focus: #10b981;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  
  /* Primary Theme Color: Fresh Emerald Green */
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: #ecfdf5;
  
  --emerald: #059669;
  --emerald-light: #d1fae5;
  
  --teal: #0d9488;
  --teal-light: #ccfbf1;

  --amber: #d97706;
  --amber-light: #fef3c7;
  
  --rose: #e11d48;
  --rose-light: #ffe4e6;
  
  --purple: #7c3aed;
  --purple-light: #f3e8ff;

  --cyan: #0284c7;
  --cyan-light: #e0f2fe;

  /* Shadows for Clean Light Theme */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 4px 14px rgba(16, 185, 129, 0.25);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --font-sans: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* App Container Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
  width: 280px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  z-index: 40;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.brand-text span {
  font-size: 10.5px;
  color: var(--emerald);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 10px 6px;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  border: 1px solid transparent;
  width: 100%;
}

.nav-item:hover {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--primary-light);
  color: var(--emerald);
  border-color: rgba(16, 185, 129, 0.3);
  font-weight: 700;
}

.nav-item i {
  font-size: 18px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  display: inline-block;
}

.nav-item .nav-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.nav-info-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
}

.nav-info-btn:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

.badge-rose {
  background-color: var(--rose-light);
  color: var(--rose);
  border: 1px solid rgba(225, 29, 72, 0.2);
}

.badge-amber {
  background-color: var(--amber-light);
  color: var(--amber);
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.badge-emerald {
  background-color: var(--emerald-light);
  color: var(--emerald);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.badge-cyan {
  background-color: var(--cyan-light);
  color: var(--cyan);
  border: 1px solid rgba(2, 132, 199, 0.2);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

.apj-status-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.apj-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 13px;
  flex-shrink: 0;
}

.apj-info h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.apj-info p {
  font-size: 10.5px;
  color: var(--emerald);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.apj-info p::before {
  content: '';
  width: 6px;
  height: 6px;
  background-color: var(--emerald);
  border-radius: 50%;
  display: inline-block;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* FIXED HEADBAR */
.navbar {
  height: 64px;
  min-height: 64px;
  max-height: 64px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 30;
  box-shadow: var(--shadow-sm);
  flex-wrap: nowrap;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.page-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-title-group h2 {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-title-group p {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.role-selector-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-card);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.role-selector-wrap label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.role-select {
  background: transparent;
  border: none;
  color: var(--emerald);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  outline: none;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-emerald {
  background: linear-gradient(135deg, #059669, #047857);
  color: white;
}

.btn-rose {
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: white;
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: var(--bg-card);
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Page Content Window */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Grid & Metrics Layout */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.metric-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.metric-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.metric-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.metric-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.icon-blue { background-color: var(--emerald-light); color: var(--emerald); }
.icon-rose { background-color: var(--rose-light); color: var(--rose); }
.icon-amber { background-color: var(--amber-light); color: var(--amber); }
.icon-emerald { background-color: var(--emerald-light); color: var(--emerald); }
.icon-purple { background-color: var(--purple-light); color: var(--purple); }

.metric-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  white-space: nowrap;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* Panel Container */
.panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: nowrap;
  gap: 12px;
}

.panel-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.panel-title i {
  color: var(--emerald);
  flex-shrink: 0;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Section Info Callout Banner */
.section-info-banner {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 12.5px;
  color: #166534;
}

.section-info-banner i {
  font-size: 18px;
  color: #15803d;
  margin-top: 1px;
  flex-shrink: 0;
}

.section-info-banner strong {
  color: #14532d;
}

/* Monitoring Dropdown Filter Bar */
.filter-bar-wrap {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-group-list {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-select-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.filter-select-item label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-select {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.filter-select:focus {
  border-color: var(--emerald);
}

/* Form Controls & Inputs */
.form-control {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 9px 14px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.search-input-wrap {
  position: relative;
  min-width: 280px;
}

.search-input-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 15px;
}

.search-input-wrap input {
  padding-left: 38px;
  width: 100%;
}

/* Data Cards List System */
.cards-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.data-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.data-card:hover {
  border-color: var(--emerald);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-main-info {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.card-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background-color: var(--primary-light);
  color: var(--emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
}

.card-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.card-right-action {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  white-space: nowrap;
  border-left: 1px solid var(--border-color);
  padding-left: 16px;
}

.card-price-tag {
  text-align: right;
  white-space: nowrap;
}

.price-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--emerald);
  white-space: nowrap;
}

.price-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Status Chips / Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-pill.fefo-critical {
  background-color: var(--rose-light);
  color: var(--rose);
  border: 1px solid rgba(225, 29, 72, 0.3);
}

.status-pill.fefo-warning {
  background-color: var(--amber-light);
  color: var(--amber);
  border: 1px solid rgba(217, 119, 6, 0.3);
}

.status-pill.fefo-safe {
  background-color: var(--emerald-light);
  color: var(--emerald);
  border: 1px solid rgba(5, 150, 105, 0.3);
}

.status-pill.active {
  background-color: var(--emerald-light);
  color: var(--emerald);
}

.status-pill.pending {
  background-color: var(--amber-light);
  color: var(--amber);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

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

.modal-header h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  color: var(--text-main);
  background-color: var(--bg-card);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-card);
}

/* E-Signature Canvas Area */
.signature-pad-wrap {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  background-color: #f8fafc;
  position: relative;
  margin-top: 10px;
}

canvas#signatureCanvas {
  width: 100%;
  height: 180px;
  cursor: crosshair;
  display: block;
}

/* Kemenkes Report Document Preview Style (Strict Single Line "SEBARIS" Layout) */
.kemenkes-doc-preview {
  background-color: white;
  color: #1e293b;
  padding: 24px 28px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  width: 100%;
  overflow-x: auto;
}

.kemenkes-header-table {
  width: 100%;
  border-bottom: 2px solid var(--emerald);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.kemenkes-meta-strip {
  font-size: 12.5px;
  color: var(--text-main);
  margin-bottom: 16px;
  background-color: #f8fafc;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--emerald);
  white-space: nowrap;
}

.kemenkes-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12px;
}

.kemenkes-table th, .kemenkes-table td {
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap; /* STRICT SINGLE LINE - NO WRAPPING DOWN */
}

.kemenkes-table th {
  background-color: #f8fafc;
  font-weight: 700;
  color: var(--text-main);
  font-size: 12px;
  white-space: nowrap;
}

.kemenkes-table .mono-box {
  white-space: nowrap; /* STRICT SINGLE LINE - NO WRAPPING DOWN */
  font-size: 11.5px;
}

.kemenkes-signature-block {
  margin-top: 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 12px;
  width: 100%;
  white-space: nowrap;
}

.kemenkes-signature-block .sig-left {
  text-align: left;
}

.kemenkes-signature-block .sig-right {
  text-align: right;
}

/* Code / Traceability Box */
.mono-box {
  font-family: var(--font-mono);
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  color: #0369a1;
  font-weight: 600;
  white-space: nowrap;
}

/* Flex Grid Utilities */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-2 { display: flex; gap: 8px; align-items: center; }
.flex-gap-3 { display: flex; gap: 12px; align-items: center; }
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
