/* Repairhub theme tokens */
:root {
  /* These are *defaults* that match your current dark look */
  --rh-surface: var(--bs-body-bg);
  --rh-card-surface: var(--bs-body-bg);
  --rh-card-border: rgba(15, 23, 42, 0.4);
  --rh-card-shadow: 0 0.25rem 0.75rem rgba(15, 23, 42, 0.16);

  --rh-status-queued: #0d6efd;
  --rh-status-in-progress: #20c997;
  --rh-status-awaiting: #ffc107;
  --rh-status-pending-collection: #0dcaf0;
  --rh-status-completed: #198754;
  --rh-status-cancelled: #dc3545;

  --mp-rail-w: 2.5rem;
  --mp-drawer-w: 18rem;

  
}

/* Utopia theme (later you can tweak these to match the old site) */
html[data-rh-theme="utopia"] {
  --rh-surface: #05060b;
  --rh-card-surface: #101321;
  --rh-card-border: #1e2340;
  --rh-card-shadow: 0 0.3rem 0.8rem rgba(6, 11, 30, 0.9);

  --rh-status-queued: #13c6ff;
  --rh-status-in-progress: #33e2a4;
  --rh-status-awaiting: #ffc857;
  --rh-status-pending-collection: #6de0ff;
  --rh-status-completed: #3ad98f;
  --rh-status-cancelled: #ff4f7a;
}

/* Win95 theme – rough placeholders to start with */
html[data-rh-theme="win95"] {
  --rh-surface: #008080;
  --rh-card-surface: #c0c0c0;
  --rh-card-border: #808080;
  --rh-card-shadow: 2px 2px 0 #000000;

  --rh-status-queued: #000080;
  --rh-status-in-progress: #008000;
  --rh-status-awaiting: #ffff00;
  --rh-status-pending-collection: #0000ff;
  --rh-status-completed: #008000;
  --rh-status-cancelled: #ff0000;
}


/* Ticket cards */
/* Ticket cards */
.ticket-card {
  border-radius: 0.75rem;
  background-color: var(--rh-card-surface);
  border: 1px solid var(--rh-card-border);
  transition: box-shadow 0.18s ease-out, border-color 0.18s ease-out;
}

.ticket-card:hover {
  box-shadow: var(--rh-card-shadow);
}

/* Slightly different background hinting at state */
.ticket-card-unassigned {
  background-color: rgba(13, 110, 253, 0.02); /* you can later swap this to a token if you like */
}

.ticket-card-other {
  background-color: rgba(108, 117, 125, 0.02);
}

.status-badge {
  font-size: 0.75rem;
}

/* Status colours via variables */
.status-draft,
.status-intake {
  background-color: #6c757d !important;
}

.status-queued {
  background-color: var(--rh-status-queued) !important;
}

.status-in_progress {
  background-color: var(--rh-status-in-progress) !important;
}

.status-awaiting_customer,
.status-awaiting_parts {
  background-color: var(--rh-status-awaiting) !important;
  color: #000 !important;
}

.status-pending_collection {
  background-color: var(--rh-status-pending-collection) !important;
}

.status-completed {
  background-color: var(--rh-status-completed) !important;
}

.status-cancelled {
  background-color: var(--rh-status-cancelled) !important;
}


/* Horizontal strip of unassigned tickets */
.unassigned-strip-wrapper {
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.unassigned-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
}

.unassigned-strip .ticket-card {
  min-width: 260px;
  max-width: 320px;
  flex: 0 0 auto;
}

/* Optional: slimmer scrollbar */
.unassigned-strip-wrapper::-webkit-scrollbar {
  height: 8px;
}
.unassigned-strip-wrapper::-webkit-scrollbar-thumb {
  border-radius: 999px;
}

/* Work ticket create / edit layout */
.ticket-layout-main {
  align-items: stretch;
}

/* Form cards – slightly tighter and more deliberate */
.ticket-form-card {
  border-radius: 0.75rem;
  background-color: var(--rh-card-surface);
  border: 1px solid var(--rh-card-border);
  box-shadow: var(--rh-card-shadow);
}

.ticket-form-card .card-header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.ticket-form-card .card-header .h6 {
  font-weight: 600;
}

.ticket-form-card .form-label {
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.ticket-form-card .form-text {
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
}

/* Make text areas feel more intentional */
.ticket-form-card textarea.form-control {
  min-height: 6rem;
  resize: vertical;
}

.ticket-form-card .form-floating > label {
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
}

.ticket-form-card .form-floating > .form-control,
.ticket-form-card .form-floating > textarea {
  padding-top: 1.4rem;
  padding-bottom: 0.6rem;
  font-size: 0.9rem;
}

/* Login page */
.login-fade {
  transition: opacity 200ms ease;
}

.login-fade.is-fading {
  opacity: 0;
}

.login-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  display: none;
  transition: opacity 200ms ease;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 0.5rem;
  pointer-events: none;
}

.login-spinner.is-active {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.login-overlay {
  position: relative;
}

/* ===== Stripe-style form layout for work tickets ===== */

.rh-form-block {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rh-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.rh-form-row > .rh-form-col {
  flex: 1 1 0;
  min-width: 0;
}

.rh-form-col .form-floating {
  width: 100%;
}

/* Floating groups – make them feel like Stripe/Linear, but theme-aware */
.rh-floating-group .form-floating {
  position: relative;
}

.rh-floating-group .form-floating > .form-control,
.rh-floating-group .form-floating > .form-select,
.rh-floating-group .form-floating > textarea {
  background-color: var(--rh-surface);
  border-radius: 0.75rem;
  border-color: rgba(148, 163, 184, 0.55);
  padding-top: 1.25rem;
  padding-bottom: 0.55rem;
  font-size: 0.9rem;
}

.rh-floating-group .form-floating > label {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
}

/* When a floating control is focused, strengthen the border a little */
.rh-floating-group .form-floating > .form-control:focus,
.rh-floating-group .form-floating > .form-select:focus,
.rh-floating-group .form-floating > textarea:focus {
  border-color: var(--rh-status-queued);
  box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.35);
}

/* Give textareas a bit more headroom so the floating label doesn't
   overlap the first line of text */
.rh-floating-group .form-floating > textarea.form-control {
  padding-top: 1.8rem;  /* was 1.25rem via the generic rule */
}

/* Make sure the floating label sits a touch higher */
.rh-floating-group .form-floating > textarea.form-control ~ label {
  padding-top: 0.2rem;
}


/* Make fault description textarea feel more like a "big story" box */
.rh-floating-group textarea.form-control {
  min-height: 7rem;
  resize: vertical;
}

/* Action row buttons row at the bottom (already used) */
.ticket-form-actions {
  margin-bottom: 0.75rem;
}

/* Small circular "i" info icon used for inline help popovers */
.rh-info-icon {
  color: var(--bs-secondary-color);
}

.rh-info-icon:hover,
.rh-info-icon:focus {
  color: var(--bs-body-color);
  text-decoration: none;
}

/* Position info icon beside a floating label (e.g. SKU) */
.rh-floating-group .form-floating .rh-info-icon-floating {
  position: absolute;
  top: 0.25rem;      /* tweak if it looks a bit high/low */
  right: 0.75rem;
  font-size: 0.85rem;
}

.rh-floating-group .form-floating .rh-info-icon-floating .bi {
  pointer-events: none; /* click goes to the button, not the icon glyph */
}

/* Make fault description textarea feel more like a "big story" box */
.rh-floating-group textarea.form-control {
  min-height: 7rem;
  resize: vertical;
}

/* ---- Contract viewer modal hardening ---- */
/* Protect fixed positioning from any global transforms */
body.modal-open {
  transform: none !important;
}

/* Ensure fullscreen modal fills viewport cleanly */
#contractViewerModal .modal-dialog {
  margin: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
}

#contractViewerModal .modal-content {
  height: 100vh !important;
  border-radius: 0 !important;
}

/* Make iframe truly fill available space */
#contractViewerModal .modal-body {
  height: calc(100vh - 64px); /* header height; adjust if your header wraps */
  overflow: hidden;
}

#contractViewerModal iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===== Manager panel drawer (rail + slide-out drawer) ===== */

/* Your variables already exist earlier in the file:
   --mp-rail-w: 2.5rem;
   --mp-drawer-w: 18rem;
*/

/* Make sure hidden always wins */
#mpDrawer[hidden] { display: none !important; }
#mpDrawerBackdrop[hidden] { display: none !important; }

/* Ensure the top frame is the positioning context for absolute children */
#mpFrameTop { position: relative; }

/* Option A: Backdrop starts to the RIGHT of the rail */
#mpDrawerBackdrop {
  left: var(--mp-rail-w);
  width: calc(100% - var(--mp-rail-w));
}

/* Drawer panel
   IMPORTANT FIX:
   - Drawer sits at left = rail width
   - Closed transform must subtract BOTH drawer width and rail width
     otherwise you always leave a visible 2.5rem strip.
*/
#mpDrawer {
  position: absolute;
  top: 0;
  left: var(--mp-rail-w);
  height: 100%;
  width: var(--mp-drawer-w);

  transform: translateX(calc(-100% - var(--mp-rail-w)));
  opacity: 0;

  transition: transform 160ms ease, opacity 160ms ease;
  pointer-events: none;
}

#mpDrawer.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.mp-drawer-backdrop{
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;

  /* CLOSED: only rail is present */
  left: var(--mp-rail-w);

  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, left .15s ease;
  background: rgba(0,0,0,.35);
  z-index: 1050;
}

/* OPEN: rail + drawer are present */
body:has(#collapseSidebar.show) .mp-drawer-backdrop{
  left: calc(var(--mp-rail-w) + var(--mp-drawer-w));
  opacity: 1;
  pointer-events: auto;
}

body:has(#collapseSidebar.show) .mp-drawer-backdrop{
  opacity: 1;
  pointer-events: auto;
}

body:has(#collapseSidebar.show) #mpMain{
  filter: blur(4px);
  transform: translateZ(0); /* helps some GPUs render blur smoother */
}



