/* ==========================================================================
   Application header
   --------------------------------------------------------------------------
   Scoped to `.rh-bar`, the top bar in layouts/partials/header.blade.php.
   Same ink, tokens and motion as the sidebar, so the two read as one frame.

   Behaviour is untouched: .small-view-button, .side-bar-collapse,
   #btnCalculator, #view_todays_profit and the <details> menus all keep
   working as they did.
   ========================================================================== */

.rh-bar {
  --rh-ink:       #0B1220;
  --rh-surface-2: #131C2E;
  --rh-line:      rgba(255, 255, 255, .09);
  --rh-text:      #F2F5FA;
  --rh-text-2:    #AEB9CC;
  --rh-text-3:    #7C899F;
  --rh-brand:     var(--theme-700, #004EEB);
  --rh-accent:    color-mix(in srgb, var(--theme-700, #004EEB) 45%, #FFFFFF);
  --rh-hover:     rgba(255, 255, 255, .10);
  --rh-ease:      cubic-bezier(.4, 0, .2, 1);
  --rh-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Figures in a readable sans with even-width digits. This was IBM Plex Mono,
     which only the POS loaded; everywhere else it fell back to Courier New. */
  --rh-mono: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  position: relative;
  z-index: 30;
  height: 64px;
  /* The blue gradient is replaced, not layered over. */
  background:
    radial-gradient(90% 140% at 100% 0%, rgba(255, 255, 255, .06), transparent 60%),
    var(--rh-ink) !important;
  border-bottom: 1px solid var(--rh-line) !important;
  font-family: var(--rh-sans);
}

/* A slow band of light along the bottom edge, the counterpart to the sweep
   on the sidebar's selected row. */
.rh-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--rh-accent), transparent);
  background-size: 45% 100%;
  background-repeat: no-repeat;
  opacity: .55;
  animation: rh-edge 9s linear infinite;
}
@keyframes rh-edge {
  0%   { background-position: -45% 0; }
  100% { background-position: 145% 0; }
}

.rh-bar .rh-inner {
  height: 100%;
  padding: 0 16px !important;
  display: flex;
  align-items: center;
}
.rh-bar .rh-inner > div { width: 100%; align-items: center !important; gap: 12px; }

/* ==========================================================================
   Controls
   ========================================================================== */

/* Every chip in the bar: the two sidebar toggles, calculator, profit, date,
   the module buttons and both menu triggers. */
/* No display here: these elements carry Tailwind's responsive display classes
   (lg:hidden on the mobile toggle, hidden lg:inline-flex on the collapse and
   the date). Setting display would override those and show all of them at
   every width. */
.rh-bar .theme-btn-bg,
.rh-bar summary,
.rh-bar .btn-modal {
  height: 38px;
  padding: 0 11px !important;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--rh-line) !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, .06) !important;
  box-shadow: none !important;
  color: var(--rh-text) !important;
  font-size: 13px;
  font-weight: 500;
  list-style: none;
  transition: background .18s var(--rh-ease), transform .18s var(--rh-ease), border-color .18s var(--rh-ease);
}
/* A <summary> defaults to list-item, so these do need a display. */
.rh-bar summary { display: inline-flex; }
.rh-bar summary::-webkit-details-marker { display: none; }

.rh-bar .theme-btn-bg:hover,
.rh-bar summary:hover,
.rh-bar .btn-modal:hover {
  background: var(--rh-hover) !important;
  border-color: rgba(255, 255, 255, .18) !important;
  color: var(--rh-text) !important;
  transform: translateY(-1px);
}
.rh-bar .theme-btn-bg:active,
.rh-bar summary:active { transform: translateY(0); }

.rh-bar svg { transition: transform .18s var(--rh-ease); }
.rh-bar .theme-btn-bg:hover svg,
.rh-bar summary:hover svg { transform: scale(1.08); }

/* Date reads as data. */
.rh-bar .tw-font-mono {
  font-family: var(--rh-mono) !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

/* Opening the till is the one primary action up here. */
.rh-bar a[href*="/pos/create"] {
  background: var(--rh-brand) !important;
  border-color: transparent !important;
  color: #fff !important;
  font-weight: 600;
  box-shadow: 0 10px 24px -12px var(--rh-brand) !important;
}
.rh-bar a[href*="/pos/create"]:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -12px var(--rh-brand) !important;
}

/* Account trigger: the avatar sits in its own ring. */
.rh-bar .rh-user > svg:last-of-type {
  width: 26px !important;
  height: 26px !important;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  color: var(--rh-text);
}
.rh-bar .rh-user:hover > svg:last-of-type { background: var(--rh-accent); color: #fff; }

/* ==========================================================================
   Menus
   ========================================================================== */

.rh-bar .rh-menu > ul {
  padding: 6px !important;
  border: 1px solid var(--rh-line) !important;
  border-radius: 12px !important;
  background: var(--rh-surface-2) !important;
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, .75) !important;
}
.rh-bar .rh-menu[open] > ul { animation: rh-menu-in .18s var(--rh-ease) both; }
@keyframes rh-menu-in {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.rh-bar .rh-menu ul a {
  border-radius: 8px;
  color: var(--rh-text-2) !important;
  font-size: 13px;
  transition: background .16s var(--rh-ease), color .16s var(--rh-ease), transform .16s var(--rh-ease);
}
.rh-bar .rh-menu ul a:hover {
  background: var(--rh-hover) !important;
  color: var(--rh-text) !important;
  transform: translateX(2px);
}
.rh-bar .rh-menu ul a svg { width: 18px; height: 18px; }

/* "Signed in as" block above the account links. */
.rh-bar .rh-menu ul p { color: var(--rh-text-3) !important; font-size: 11.5px; }
.rh-bar .rh-menu ul p.tw-font-medium { color: var(--rh-text) !important; font-size: 13px; }
.rh-bar .rh-menu ul hr,
.rh-bar .rh-menu ul .tw-border-t { border-color: var(--rh-line) !important; }

/* Notification counts and similar badges from modules. */
.rh-bar .badge,
.rh-bar .label {
  border-radius: 999px;
  background: var(--rh-accent) !important;
  color: #fff !important;
  font-family: var(--rh-mono);
  font-size: 10.5px;
  font-weight: 600;
}

@media (max-width: 767px) {
  .rh-bar { height: auto; }
  .rh-bar .rh-inner { padding: 8px 12px !important; }
  .rh-bar .theme-btn-bg,
  .rh-bar summary { height: 34px; padding: 0 9px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .rh-bar,
  .rh-bar * { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Plan chip and switch-user link
   --------------------------------------------------------------------------
   The active package used to render as a bare floated icon that landed in
   the middle of the bar. It now sits with the other controls and names the
   package, with the full breakdown still on hover.
   ========================================================================== */

.rh-bar .rh-plan {
  height: 38px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--rh-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  color: var(--rh-text-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .18s var(--rh-ease), color .18s var(--rh-ease), transform .18s var(--rh-ease), border-color .18s var(--rh-ease);
}
.rh-bar .rh-plan:hover {
  background: var(--rh-hover);
  border-color: rgba(255, 255, 255, .18);
  color: var(--rh-text);
  transform: translateY(-1px);
}
.rh-bar .rh-plan svg { width: 17px; height: 17px; flex: none; color: var(--rh-accent); }
.rh-bar .rh-plan-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1280px) {
  .rh-bar .rh-plan-name { display: none; }
  .rh-bar .rh-plan { padding: 0 9px; }
}

/* Returning to your own account after signing in as someone else. */
.rh-bar .rh-switch-user {
  height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid color-mix(in srgb, #F27A6E 45%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, #F27A6E 18%, transparent);
  color: #FFD9D4 !important;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background .18s var(--rh-ease), transform .18s var(--rh-ease);
}
.rh-bar .rh-switch-user:hover {
  background: color-mix(in srgb, #F27A6E 30%, transparent);
  color: #fff !important;
  transform: translateY(-1px);
}

/* The package breakdown, and any other popover raised from this bar. */
.popover.rh-popover,
.rh-bar + .popover,
body > .popover {
  border: 1px solid #E4EAF2;
  border-radius: 12px;
  box-shadow: 0 20px 44px -18px rgba(16, 24, 40, .35);
  font-family: var(--rh-sans, "IBM Plex Sans", system-ui, sans-serif);
  font-size: 12.5px;
}
body > .popover .popover-title {
  border-bottom: 1px solid #E9EEF5;
  border-radius: 12px 12px 0 0;
  background: #F5F7FB;
  color: #101828;
  font-size: 12.5px;
  font-weight: 600;
}
body > .popover .table > tbody > tr > td {
  padding: 6px 8px;
  border-top: 1px solid #E9EEF5;
  color: #5A6779;
}
body > .popover .table > tbody > tr:first-child > td {
  border-top: 0;
  color: #101828;
  font-weight: 600;
}

/* Menu rows are not chips: the chip rule above matches .btn-modal, which the
   quick-add menu also uses for "Add to do". */
.rh-bar .rh-menu ul .btn-modal,
.rh-bar .rh-menu ul a {
  height: auto !important;
  padding: 8px 10px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  font-weight: 500 !important;
}
.rh-bar .rh-menu ul .btn-modal:hover,
.rh-bar .rh-menu ul a:hover {
  background: var(--rh-hover) !important;
  transform: translateX(2px);
}

/* Clock in and out are real actions, but opening the till is the primary one,
   so these take the accent as a tint rather than a fill. */
.rh-bar .clock_in_btn,
.rh-bar .clock_out_btn {
  background: color-mix(in srgb, var(--rh-accent) 22%, transparent) !important;
  border-color: color-mix(in srgb, var(--rh-accent) 45%, transparent) !important;
  color: #fff !important;
}
.rh-bar .clock_in_btn:hover,
.rh-bar .clock_out_btn:hover {
  background: color-mix(in srgb, var(--rh-accent) 34%, transparent) !important;
}
