/* =====================================================================================
   Omnicare Tech - visual refresh
   -------------------------------------------------------------------------------------
   Layered on top of style.css and components.css so the palette and the component
   behaviour stay in one place. Everything here is driven by the tokens in :root, so
   it follows the light/dark switch automatically.

   Palette (60-30-10):
     60%  --page / --surface        light grey + white
     30%  --primary                 navy #1E3A5F
     10%  --accent (green) + --cta (orange)
   ===================================================================================== */

/* ------------------------------------------------------------------ doodle background */
/* A repeating SVG pattern drawn in CSS custom properties, so it inherits the theme colour
   instead of being a baked-in image. Three motifs (circuit node, chevron, dot grid) at very
   low opacity: visible enough to remove the flat white, quiet enough not to fight content. */
:root {
  --doodle-stroke: rgba(30, 58, 95, 0.055);
  --doodle-size: 220px;
}

:root[data-theme="dark"] {
  --doodle-stroke: rgba(147, 197, 253, 0.07);
}

body {
  background-color: var(--page);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='none' stroke='%231E3A5F' stroke-opacity='0.055' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M24 40h22a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10h14'/%3E%3Ccircle cx='24' cy='40' r='3'/%3E%3Ccircle cx='80' cy='70' r='3'/%3E%3Cpath d='M150 26l14 10-14 10'/%3E%3Cpath d='M150 52l14 10-14 10'/%3E%3Crect x='150' y='150' width='26' height='20' rx='3'/%3E%3Cpath d='M163 170v10M156 180h14'/%3E%3Ccircle cx='60' cy='170' r='10'/%3E%3Cpath d='M60 160v-14M60 180v14M50 170H36M70 170h14'/%3E%3Cpath d='M180 96c8 0 12 5 12 11s-4 11-12 11-12-5-12-11 4-11 12-11z'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(circle at 1px 1px, var(--doodle-stroke) 1px, transparent 0);
  background-size:
    var(--doodle-size) var(--doodle-size),
    22px 22px;
  background-attachment: fixed, fixed;
}

/* The dashboards keep a solid canvas so data tables stay legible over the pattern. */
.dashboard-body {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='none' stroke='%231E3A5F' stroke-opacity='0.04' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M24 40h22a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10h14'/%3E%3Cpath d='M150 26l14 10-14 10'/%3E%3Ccircle cx='60' cy='170' r='10'/%3E%3C/g%3E%3C/svg%3E");
  background-size: var(--doodle-size) var(--doodle-size);
}

@media (prefers-reduced-motion: reduce) {
  body {
    background-attachment: scroll, scroll;
  }
}

/* ------------------------------------------------------------------ headings + links */
h1,
h2,
h3 {
  letter-spacing: -0.015em;
}

a {
  color: var(--link, var(--primary));
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm, 8px);
}

/* ------------------------------------------------------------------ buttons */
.btn-primary,
.btn-secondary,
.btn-action,
.btn-inline,
.btn-whatsapp {
  --btn-lift: 0;
  transition:
    transform 180ms var(--ease),
    box-shadow 180ms var(--ease),
    background-color 180ms var(--ease),
    border-color 180ms var(--ease),
    color 180ms var(--ease);
  transform: translateY(var(--btn-lift));
  will-change: transform;
}

.btn-primary {
  border: 1px solid transparent;
}

.btn-primary:hover:not(:disabled) {
  --btn-lift: -2px;
  box-shadow: 0 10px 22px rgba(30, 58, 95, 0.28);
}

.btn-primary:active:not(:disabled) {
  --btn-lift: 0;
  box-shadow: 0 4px 10px rgba(30, 58, 95, 0.22);
}

/* The primary call to action uses the CTA orange: highest-visual-weight action on a page. */
.hero-actions .btn-primary,
.cta-button {
  background: var(--cta);
  border-color: var(--cta);
  color: #ffffff;
}

.hero-actions .btn-primary:hover:not(:disabled),
.cta-button:hover:not(:disabled) {
  background: var(--cta-dark);
  border-color: var(--cta-dark);
  box-shadow: 0 10px 22px rgba(249, 115, 22, 0.32);
}

.btn-secondary:hover:not(:disabled) {
  --btn-lift: -1px;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-action:hover:not(:disabled),
.btn-inline:hover:not(:disabled) {
  background: var(--surface-alt);
  color: var(--primary);
}

.btn-whatsapp:hover {
  --btn-lift: -2px;
  box-shadow: 0 10px 22px rgba(37, 211, 102, 0.32);
}

button:disabled,
.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Busy state: a spinner is injected by setButtonBusy() in ui-kit.js. */
button.is-busy {
  position: relative;
  color: transparent !important;
}
button.is-busy::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: #fff;
  animation: omn-spin 700ms linear infinite;
}

@keyframes omn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------------ cards */
.card,
.service-card,
.info-card,
.summary-card,
.chart-card,
.table-card,
.form-card {
  transition:
    transform 220ms var(--ease),
    box-shadow 220ms var(--ease),
    border-color 220ms var(--ease);
}

.service-card:hover,
.info-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--primary) 22%, var(--border));
}

/* Accent bar on the service cards, revealed on hover. */
.service-card {
  position: relative;
  overflow: hidden;
}
.service-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cta));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 260ms var(--ease);
}
.service-card:hover::after {
  transform: scaleX(1);
}

/* ------------------------------------------------------------------ tables */
.data-table tbody tr {
  transition: background-color 140ms var(--ease);
}
.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}
.data-table td.num {
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ loading states */
/* Skeletons replace "Loading ..." text so a slow query does not read as a broken page. */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-alt);
  border-radius: var(--radius-sm, 8px);
  color: transparent !important;
  min-height: 1em;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--surface) 70%, transparent),
    transparent
  );
  animation: omn-shimmer 1.3s infinite;
}
.skeleton-row td {
  padding: 0.75rem 1rem;
}
.skeleton-row td > span {
  display: block;
  height: 0.85rem;
}

@keyframes omn-shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* Top progress bar for page-level work (mounted by ui-kit.js). */
.omn-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 9999;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--cta));
  transform-origin: left;
  transform: scaleX(0);
  opacity: 0;
  transition:
    transform 400ms var(--ease),
    opacity 220ms linear;
  pointer-events: none;
}
.omn-progress.is-active {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after {
    animation: none;
  }
  .service-card:hover,
  .info-card:hover,
  .btn-primary:hover {
    transform: none;
  }
  button.is-busy::after {
    animation-duration: 1.4s;
  }
}

/* ------------------------------------------------------------------ print */
/* Used by the analytics "Print / Save as PDF" action: no chrome, no colour backgrounds. */
.print-only {
  display: none;
}
.no-print {
  display: flex;
}

@media print {
  .print-only {
    display: block !important;
  }
  .no-print {
    display: none !important;
  }
  body {
    background: #fff !important;
    background-image: none !important;
  }
  .navbar,
  .sidebar,
  .topbar,
  .site-footer,
  .btn-primary,
  .btn-secondary,
  .btn-action,
  .btn-inline,
  .theme-toggle,
  .bell-link,
  .till-status-filter,
  .staff-auth-footer,
  #staff-bell,
  .admin-notifications-panel {
    display: none !important;
  }
  .dashboard-layout {
    display: block !important;
  }
  .dashboard-main {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .tab-content {
    display: none !important;
  }
  .tab-content.active,
  .tab-content:has(.print-target) {
    display: block !important;
    break-inside: avoid;
  }
  .card,
  .summary-card,
  .chart-card,
  .info-card {
    box-shadow: none !important;
    border: 1px solid #d0d5dd !important;
    break-inside: avoid;
  }
  h1,
  h2,
  h3 {
    color: #000 !important;
  }
  a[href]::after {
    content: "";
  }
  @page {
    margin: 14mm;
  }
}
