:root {
  --radius: 0.625rem;
  /* Light theme: Warm wheat palette */
  --background: #faf5ec;
  --foreground: #3c2e1e;
  --card: #fffdfb;
  --card-foreground: #3c2e1e;
  --popover: #fffdfb;
  --popover-foreground: #3c2e1e;
  --primary: #7b5e2a;
  --primary-foreground: #faf5ec;
  --secondary: #f0e6d2;
  --secondary-foreground: #4d3b24;
  --muted: #f4ead6;
  --muted-foreground: #8b775c;
  --accent: #c9a96e;
  --accent-foreground: #3c2e1e;
  --destructive: #a33a22;
  --destructive-foreground: #faf5ec;
  --border: #e5d5ba;
  --input: #efe4d0;
  --ring: #c9a96e;
  --wheat: #e3d2b5;
  --wheat-dark: #664e22;
  --tray: #f5e3c4;
  --tray-foreground: #5b451f;
}

.dark {
  /* Dark theme: Warm dark palette */
  --background: #1f1912;
  --foreground: #f5efe6;
  --card: #2b2219;
  --card-foreground: #f5efe6;
  --popover: #2b2219;
  --popover-foreground: #f5efe6;
  --primary: #c9a96e;
  --primary-foreground: #1f1912;
  --secondary: #3d3023;
  --secondary-foreground: #f5efe6;
  --muted: #3d3023;
  --muted-foreground: #b3a086;
  --accent: #a6874e;
  --accent-foreground: #faf5ec;
  --destructive: #c94e36;
  --destructive-foreground: #faf5ec;
  --border: rgba(229, 213, 186, 0.15);
  --input: rgba(239, 228, 208, 0.18);
  --ring: #a6874e;
  --wheat: #5c4a33;
  --wheat-dark: #e3d2b5;
  --tray: #4d3d2a;
  --tray-foreground: #f5efe6;
}

/* Base styling */
* {
  border-color: var(--border);
}

body {
  background-color: var(--background);
  color: var(--foreground);
  background-image:
    radial-gradient(at 0% 0%,
      color-mix(in srgb, var(--accent) 12%, transparent),
      transparent 50%),
    radial-gradient(at 100% 0%,
      color-mix(in srgb, var(--primary) 8%, transparent),
      transparent 45%);
  background-attachment: fixed;
  font-family:
    "Outfit",
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* Print optimizations */
@media print {
  body {
    background: white !important;
    color: black !important;
    background-image: none !important;
    font-size: 11pt !important;
  }

  .print\:hidden {
    display: none !important;
  }

  .print\:block {
    display: block !important;
  }

  /* Expand all container bounds for printing */
  .max-w-7xl,
  main,
  div {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }

  /* Force table layouts to show completely on paper */
  .overflow-x-auto {
    overflow-x: visible !important;
    max-width: 100% !important;
  }

  table {
    page-break-inside: avoid;
    width: 100% !important;
    border-collapse: collapse !important;
  }

  tr {
    page-break-inside: avoid;
  }

  input,
  select,
  textarea {
    border: none !important;
    border-bottom: 1px solid #aaa !important;
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-radius: 0 !important;
    text-align: left !important;
  }

  input[type="checkbox"] {
    border: 1px solid black !important;
  }

  /* Custom page break helpers */
  .page-break {
    page-break-before: always;
  }
}

/* Process Details Sub-tab styling */
.process-subtab {
  color: var(--muted-foreground);
  background-color: transparent;
}

.process-subtab:hover {
  color: var(--foreground);
  background-color: color-mix(in srgb, var(--primary) 10%, transparent);
}

.process-subtab.active {
  color: var(--primary-foreground);
  background-color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Sidebar Minimize Styles (Desktop Only) */
@media (min-width: 768px) {

  #sidebar-container,
  main {
    transition:
      width 0.2s cubic-bezier(0.4, 0, 0.2, 1),
      margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1),
      padding 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }

  #sidebar-toggle-chevron {
    transition: transform 0.2s ease;
  }

  html.sidebar-minimized #sidebar-container {
    width: 4.5rem !important;
    /* 72px */
  }

  html.sidebar-minimized main {
    margin-left: 4.5rem !important;
  }

  html.sidebar-minimized #sidebar-toggle-chevron {
    transform: rotate(180deg);
  }

  /* Hide textual elements inside minimized sidebar */
  html.sidebar-minimized #sidebar-container .sidebar-logo-info,
  html.sidebar-minimized #sidebar-container nav a span,
  html.sidebar-minimized #sidebar-container nav button span,
  html.sidebar-minimized #sidebar-container nav button i[data-lucide="chevron-down"],
  html.sidebar-minimized #sidebar-container nav div p,
  html.sidebar-minimized #sidebar-container .p-4.border-t.border-border button span:last-child {
    display: none !important;
  }

  /* Center the items when minimized */
  html.sidebar-minimized #sidebar-container nav a,
  html.sidebar-minimized #sidebar-container nav button {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
  }

  html.sidebar-minimized #sidebar-container nav #nav-process-submenu {
    margin-left: 0 !important;
    padding-left: 0 !important;
    border-left: none !important;
  }

  html.sidebar-minimized #sidebar-container nav #nav-process-submenu a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
  }

  html.sidebar-minimized #sidebar-container .sidebar-header {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }
}

/* Hide native spinner arrows globally for numeric input fields */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  appearance: textfield;
  /* Firefox support */
  -moz-appearance: textfield;
  /* Legacy Firefox support */
}

/* Global Sticky Layout CSS */
.sidebar-header,
.global-page-header {
  height: 3.5rem;
  /* Default mobile height */
  flex-shrink: 0;
}

@media (min-width: 768px) {

  .sidebar-header,
  .global-page-header {
    height: 5rem !important;
    /* Exactly 80px */
  }
}

.global-page-content {
  flex: 1;
  overflow-y: auto;
  width: 100%;
}

/* ============================================================
   BATCH ID COMPONENTS
   ============================================================ */

/* The generated Batch ID display — monospace, prominent */
.batch-id-display {
  font-family: "Courier New", "Courier", "Lucida Console", monospace;
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--primary);
  line-height: 1.2;
}

/* Preview badge */
.batch-id-preview {
  font-family: "Courier New", "Courier", "Lucida Console", monospace;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
}

/* Read-only batch info card shown after selection */
.batch-info-card {
  border-left: 3px solid var(--primary);
  background-color: color-mix(in srgb, var(--primary) 6%, transparent);
}

/* Field validation error highlight */
.batch-field-error {
  border-color: var(--destructive) !important;
  box-shadow: 0 0 0 1px var(--destructive);
}

/* Result card success accent */
.batch-result-card {
  border-left: 3px solid var(--primary);
  background-color: color-mix(in srgb, var(--primary) 5%, var(--card));
}

/* Reusable compact card style for Lab Report Dashboard */
.dashboard-card {
  @apply aspect-square bg-card border border-border rounded-2xl shadow-sm hover:shadow-md hover:bg-secondary/40 hover:scale-[1.02] active:scale-[0.98] transition-all duration-200 cursor-pointer flex flex-col items-center justify-center p-4 text-center focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2 outline-none group;
}

.dashboard-card .icon-wrapper {
  @apply w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mb-4 group-hover:bg-primary/20 transition-colors;
}

.dashboard-card .icon-wrapper i {
  @apply w-6 h-6 text-primary;
}

.dashboard-card h3 {
  @apply font-bold text-md text-foreground;
}

.dashboard-card p {
  @apply text-sm text-muted-foreground mt-2 font-medium;
}
