/* Pathology Lab Management Software - Custom Production Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary-color: #0ea5e9;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --body-bg: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
}

body {
  font-family: var(--font-main);
  background-color: var(--body-bg);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6, .brand-font {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}

/* Layout Structure */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.app-sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--body-bg);
}

.app-content {
  flex: 1;
  padding: 1.75rem;
}

/* Sidebar Styling */
.sidebar-brand {
  padding: 1.25rem 1.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.sidebar-brand i {
  color: #38bdf8;
  font-size: 1.4rem;
}

.sidebar-nav {
  padding: 1rem 0;
  flex: 1;
  overflow-y: auto;
}

.nav-section-title {
  padding: 0.75rem 1.5rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}

.sidebar-nav .nav-link {
  padding: 0.65rem 1.5rem;
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.sidebar-nav .nav-link i {
  font-size: 1.1rem;
  width: 1.25rem;
  text-align: center;
  transition: transform 0.2s ease;
}

.sidebar-nav .nav-link:hover {
  color: var(--sidebar-text-active);
  background-color: var(--sidebar-hover);
  border-left-color: var(--secondary-color);
}

.sidebar-nav .nav-link:hover i {
  transform: translateX(2px);
}

.sidebar-nav .nav-link.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.25) 0%, rgba(37, 99, 235, 0.05) 100%);
  border-left-color: var(--primary-color);
  font-weight: 600;
}

.sidebar-nav .nav-link.active i {
  color: #60a5fa;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Navbar */
.app-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 999;
}

/* Cards & UI Elements */
.card-custom {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-custom-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

.card-header-custom {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header-custom h5 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Stat KPI Cards */
.stat-card {
  padding: 1.25rem;
  border-radius: 0.75rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon.primary { background: #eff6ff; color: #2563eb; }
.stat-icon.success { background: #ecfdf5; color: #10b981; }
.stat-icon.warning { background: #fffbeb; color: #f59e0b; }
.stat-icon.danger { background: #fff1f2; color: #f43f5e; }
.stat-icon.info { background: #f0fdfa; color: #06b6d4; }
.stat-icon.purple { background: #f5f3ff; color: #8b5cf6; }

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  font-family: var(--font-heading);
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Buttons */
.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  font-weight: 500;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
}

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

.btn-whatsapp {
  background-color: #25d366;
  border-color: #25d366;
  color: #ffffff;
  font-weight: 600;
}

.btn-whatsapp:hover {
  background-color: #20ba5a;
  border-color: #20ba5a;
  color: #ffffff;
}

/* Tables */
.table-custom {
  margin-bottom: 0;
}

.table-custom th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.table-custom td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
}

.table-custom tr:hover td {
  background-color: #f8fafc;
}

/* Badges */
.badge-status {
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-paid { background-color: #dcfce7; color: #15803d; }
.badge-partial { background-color: #fef9c3; color: #854d0e; }
.badge-unpaid { background-color: #fee2e2; color: #991b1b; }
.badge-approved { background-color: #e0e7ff; color: #3730a3; }
.badge-completed { background-color: #dcfce7; color: #166534; }
.badge-in-progress { background-color: #fef3c7; color: #92400e; }
.badge-pending { background-color: #f1f5f9; color: #475569; }

/* Flag Badges for Results */
.flag-normal { color: #16a34a; font-weight: 600; }
.flag-low { color: #d97706; font-weight: 700; background: #fef3c7; padding: 2px 6px; border-radius: 4px; }
.flag-high { color: #dc2626; font-weight: 700; background: #fee2e2; padding: 2px 6px; border-radius: 4px; }
.flag-critical { color: #ffffff; font-weight: 800; background: #b91c1c; padding: 2px 6px; border-radius: 4px; }

/* Unified Billing & Report Page Specific */
.test-selection-card {
  border-left: 4px solid var(--primary-color);
}

.patient-lookup-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
}

.parameter-row:nth-child(even) {
  background-color: #f8fafc;
}

.parameter-row:hover {
  background-color: #f1f5f9;
}

/* Technician Probable Result Chips & Range UI */
.probable-chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.probable-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}

.probable-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.probable-chip.chip-normal {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.probable-chip.chip-normal:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

.probable-chip.chip-primary {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.probable-chip.chip-primary:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.probable-chip.chip-warning {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.probable-chip.chip-warning:hover {
  background: #fef3c7;
  border-color: #fcd34d;
}

.probable-chip.chip-danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.probable-chip.chip-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.probable-chip.active-chip {
  background: #1e293b;
  color: #ffffff;
  border-color: #0f172a;
}

.ref-range-badge {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.ref-range-applicable {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  font-weight: 700;
}

.ref-range-alt {
  background: #f8fafc;
  color: #64748b;
  border: 1px dashed #cbd5e1;
  font-size: 10.5px;
}

.visual-range-bar {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, #38bdf8 0%, #38bdf8 20%, #10b981 20%, #10b981 80%, #f43f5e 80%, #f43f5e 100%);
  margin-top: 4px;
  position: relative;
}

.param-input:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25) !important;
  border-color: #2563eb !important;
}

/* Print Styles */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }

  .app-sidebar,
  .app-navbar,
  .no-print,
  .btn,
  .card-header-custom .btn {
    display: none !important;
  }

  .app-wrapper {
    display: block !important;
  }

  .app-main, .app-content {
    padding: 0 !important;
    margin: 0 !important;
  }

  .print-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .print-page {
    page-break-after: always;
  }

  .print-border {
    border: 1px solid #333333 !important;
  }

  .table-print th, .table-print td {
    padding: 6px 8px !important;
    font-size: 10pt !important;
    border-bottom: 1px solid #cbd5e1 !important;
  }
}
