/* static/unstuck_ops/css/theme.css */

/* --------------------------------------------------------------------------
   Unstuck Ops theme (CSS variables + color-mix)
   Load this AFTER Bootstrap.
   -------------------------------------------------------------------------- */

:root{
  /* Core palette */
  --unstuck-primary: #5b2ca3;
  --unstuck-ink: #1a1a1a;
  --unstuck-muted: #6b7280;
  --unstuck-border: #e9e9ef;
  --unstuck-bg: #ffffff;
  --unstuck-bg-alt: #fbfbfd;

  /* Derived tints/shades (approx of SCSS lighten/darken) */
  /* “Light” ≈ mix 15% white into base -> slightly lighter */
  --unstuck-primary-light: color-mix(in srgb, var(--unstuck-primary) 85%, white);
  /* “Dark” ≈ mix 10% black into base -> slightly darker */
  --unstuck-primary-dark:  color-mix(in srgb, var(--unstuck-primary) 90%, black);
}

/* Global base */
html, body{
  height:100%;
  background-color: var(--unstuck-bg);
  color: var(--unstuck-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu,
               "Helvetica Neue", Arial, system-ui, sans-serif;
  line-height:1.5;
}

/* Page container */
main.u-page{
  max-width:2560px;
  margin:24px auto 48px auto;
  padding:0 24px;
}

/* Navbar + dropdowns */
.navbar.sticky-top{
  /* above contextual subnav (which sits at ~1025) */
  z-index:1035;
  background-color: var(--unstuck-primary-dark);
}
.navbar-brand span{ color:#fff; }

.navbar .nav-link,
.navbar .btn-outline-light{
  color: rgba(255,255,255,.85);
}
.navbar .nav-link:hover,
.navbar .nav-link.active,
.navbar .btn-outline-light:hover{
  color:#fff;
}

.navbar .dropdown-menu{
  z-index:1036;             /* ensure above siblings */
  border:0;
  box-shadow:0 .25rem .75rem rgba(0,0,0,.1);
}

/* Contextual subnav (sticky under navbar) */
.context-subnav-wrapper{
  position:sticky;
  top:56px;                 /* mobile navbar height */
  z-index:1025;
  background-color: var(--unstuck-bg-alt);
  border-bottom:1px solid var(--unstuck-border);
}
@media (min-width: 992px){
  .context-subnav-wrapper{ top:64px; } /* lg navbar is taller */
}
.context-subnav{
  white-space:nowrap;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
.context-subnav .nav-link{
  color: var(--unstuck-muted);
  padding:10px 12px;
  font-size:.92rem;
  white-space:nowrap;
}
.context-subnav .nav-link:hover{
  color: var(--unstuck-primary);
  /* approx lighten(..., 45%) -> mix 45% white */
  background-color: color-mix(in srgb, var(--unstuck-primary) 55%, white);
  border-radius:8px;
}
.context-subnav .nav-link.active{
  font-weight:600;
  border-bottom:2px solid var(--unstuck-primary);
  color: var(--unstuck-primary);
}
.context-subnav::-webkit-scrollbar{ display:none; }

/* Mobile bottom tab bar (pairs with includes/_mobile_tabbar.html) */
/* Note: structural layout rules remain in nav.css; this only unifies theme */
.mobile-tabbar{
  background-color: var(--unstuck-primary-dark);
  color: rgba(255,255,255,.85);
  border-top:1px solid rgba(255,255,255,.15);
}
.mobile-tabbar .tab-item.active,
.mobile-tabbar .tab-item:hover{
  color: var(--unstuck-primary-light);
}


/* --------------------------------------------------------------------------
   Calendar month view
   -------------------------------------------------------------------------- */

.calendar-month-table .calendar-day-cell {
  min-height: 5rem;
  vertical-align: top;
}

.calendar-day-outside {
  background-color: #f8f9fa;
  color: #adb5bd;
}

.calendar-day-today {
  box-shadow: inset 0 0 0 2px rgba(13, 110, 253, 0.35);
}

/* Room dots */
.calendar-dot {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.25rem;
  border: 2px solid var(--room-color, #6c757d);
  transition:
    transform 0.12s ease-out,
    box-shadow 0.12s ease-out,
    border-color 0.12s ease-out,
    background-color 0.12s ease-out;
}

/* Filled = reserved on that day */
.calendar-dot-filled {
  background-color: var(--room-color, #6c757d);
}

/* Outline = no reservation, just availability marker */
.calendar-dot-outline {
  background-color: transparent;
}

/* Hover / focus states: subtle grow + halo */
.calendar-dot-btn:hover .calendar-dot,
.calendar-dot-btn:focus-visible .calendar-dot {
  transform: scale(1.2);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.12);
}

/* Make outline dots a bit easier to see on hover/focus */
.calendar-dot-btn:hover .calendar-dot-outline,
.calendar-dot-btn:focus-visible .calendar-dot-outline {
  background-color: color-mix(in srgb, var(--room-color, #6c757d) 12%, transparent);
}

/* Keyboard focus ring on the button itself (accessibility) */
.calendar-dot-btn:focus-visible {
  outline: 2px solid var(--room-color, #6c757d);
  outline-offset: 2px;
}


/* Room color pill (dashboard legend) */
.room-color-pill {
  width: 1rem;
  height: 1rem;
  padding: 0;
  display: inline-block;
  border-radius: 50rem;
  background-color: var(--room-color, #6c757d);
}


/* --------------------------------------------------------------------------
   Weekly room grid (DevExpress-style week view)
   -------------------------------------------------------------------------- */

/* Scrollable container for the whole grid */
.weekly-grid-table-wrapper {
  max-height: 36rem;
  overflow-y: auto;
}

/* Keep columns reasonably even */
.weekly-grid-table {
  table-layout: fixed;
}

/* Headers */
.weekly-time-header {
  white-space: nowrap;
}

.weekly-day-header {
  text-align: center;
}

/* Time column (left side) */
.weekly-time-column {
  position: relative;
  width: 4.5rem;
  padding: 0.25rem 0.25rem 0.25rem 0;
  border-right: 1px solid var(--unstuck-border);
}

.weekly-time-scale {
  position: relative;
  height: 32rem;
}

.weekly-time-tick {
  position: absolute;
  left: 0;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--unstuck-muted);
}

/* Day columns */
.weekly-day-column {
  padding: 0;
  border-left: 1px solid var(--unstuck-border); /* vertical separators between days */
}

.weekly-day-inner {
  position: relative;
  height: 32rem;
  background-image: linear-gradient(
    to bottom,
    rgba(0,0,0,0.02) 0,
    rgba(0,0,0,0.02) 1px,
    transparent 1px,
    transparent 15px
  );
  background-size: 100% 16px; /* subtle horizontal grid for time slots */
}

/* Appointment blocks */
.weekly-appt {
  position: absolute;
  border-radius: 0.45rem;
  padding: 0.15rem 0.25rem;
  font-size: 0.7rem;
  line-height: 1.2;
  color: #fff;
  background-color: var(--room-color, #6c757d);
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;

  /* Ensure consistent top-aligned text layout */
  display: flex;
  flex-direction: column;
  justify-content: flex-start !important;
  align-items: flex-start;
}

/* Reserved (normal) appointments */
.weekly-appt-reserved {
  /* uses same base styles; kept as hook if you ever want a variant */
}

/* Inner text */
.weekly-appt-title {
  font-weight: 500;
  margin-bottom: 0;
}

.weekly-appt-time {
  opacity: 0.9;
}

/* Hover / focus states */
.weekly-appt:hover,
.weekly-appt:focus-visible {
  text-decoration: none;
  filter: brightness(1.05);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.08);
}

/* Button reset for non-session reservations using <button> */
button.weekly-appt {
  border: 0;
  padding: 0;            /* keep it tight like the <a> version */
}

/* Make sure the room color custom property is honored */
.weekly-appt {
  background-color: var(--room-color, #6c757d);
}

.weekly-appt-consult{
  /* uses --room-color; set to theme primary via inline --room-color */
  background-color: var(--room-color, var(--unstuck-primary));
}

.weekly-appt-consult-pending{
  border: 1px dashed rgba(255,255,255,0.75);
}

.weekly-appt-consult-confirmed{
  border: 1px solid rgba(255,255,255,0.65);
}

.weekly-appt-consult-canceled,
.weekly-appt-consult-muted{
  opacity: 0.55;
  filter: saturate(0.85);
}

/* --------------------------------------------------------------------------
   Workflow builder page overrides
   -------------------------------------------------------------------------- */

/* Make the workflow builder use the full window width */
body.workflow-builder-page main.u-page {
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* --------------------------------------------------------------------------
   Workflow builder: compact stage navigation
   -------------------------------------------------------------------------- */

.workflow-stage-nav {
  border-radius: 0.75rem;
  background: #f9fafb;
  padding: 0.4rem 0.6rem;
  border: 1px dashed rgba(148, 163, 184, 0.5);
}

.workflow-stage-nav-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.workflow-stage-nav-scroll::-webkit-scrollbar {
  height: 4px;
}

.workflow-stage-nav-scroll::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.6);
  border-radius: 999px;
}

.workflow-stage-nav-pill {
  display: inline-flex;
  align-items: center;
  max-width: 12rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background-color: #ffffff;
  font-size: 0.75rem;
  white-space: nowrap;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    transform 0.08s ease;
}

.workflow-stage-nav-pill:hover {
  border-color: var(--unstuck-primary);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  transform: translateY(-0.5px);
}

.workflow-stage-nav-pill-active {
  border-color: var(--unstuck-primary);
  background-color: rgba(91, 44, 163, 0.06);
  box-shadow: 0 0.35rem 0.8rem rgba(91, 44, 163, 0.16);
}


/* --------------------------------------------------------------------------
   Workflow builder: lanes + draggable stage cards
   -------------------------------------------------------------------------- */

/* Optional column wrapper if used */
.workflow-lane-column {
  min-width: 260px;
}

/* If you use a .workflow-lanes wrapper, keep children stretched */
.workflow-lanes {
  align-items: stretch;
}

/* Each lane should flex to fill the center column.
   Parent is a flex row (Bootstrap d-flex / gap-3) in the template. */
.workflow-lane {
  display: flex;
  flex-direction: column;
  flex: 1 1 260px; /* grow to fill, base width ~260px */
  min-width: 0;    /* allow shrinking without overflow */

  border-radius: 0.75rem;
  background: #f9fafb;
  padding: 0.75rem;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  min-height: 8rem;
}

/* Basic lane header/body hooks (used or safe to ignore) */
.workflow-lane-header {
  padding: 0.35rem 0.25rem 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.workflow-lane-body {
  padding: 0.4rem 0.25rem 0.25rem;
  border-radius: 0.5rem;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 3rem;
}

/* Highlight when this lane is an active drop target */
.workflow-lane-body.workflow-lane-drop-active {
  outline: 2px dashed var(--unstuck-primary);
  outline-offset: 2px;
  background: #f5f3ff;
}

.workflow-lane-empty {
  padding: 0.35rem 0.25rem;
}

/* When JS adds drag-over state directly to lane */
.workflow-lane.drag-over {
  border-style: solid;
  border-color: rgba(91, 33, 182, 0.35);
  background: #f5f3ff;
}


/* Stage cards */

.workflow-stage-card {
  position: relative;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 0.75rem 0.75rem 0.6rem 1.3rem;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.04);
  cursor: grab;
  transition:
    box-shadow 0.12s ease,
    border-color 0.12s ease,
    transform 0.08s ease,
    background-color 0.12s ease;
}

.workflow-stage-card:hover {
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
  border-color: rgba(148, 163, 184, 0.9);
  transform: translateY(-1px);
}

/* Selected/“active” card */
.workflow-stage-card-active,
.workflow-stage-card-selected {
  border-color: var(--unstuck-primary);
  border-width: 2px;
  box-shadow: 0 0.45rem 1.25rem rgba(91, 44, 163, 0.22);
  background: linear-gradient(
    135deg,
    rgba(91, 44, 163, 0.05),
    #ffffff 45%,
    #ffffff
  );
}

/* Muted / terminal style */
.workflow-stage-card-muted {
  border-left: 3px solid var(--unstuck-muted);
  background: linear-gradient(to bottom, #f9fafb, #ffffff);
}

/* Drag feedback */
.workflow-stage-card.workflow-stage-card-dragging,
.workflow-stage-card.is-dragging {
  opacity: 0.9;
  box-shadow: 0 0.6rem 1.4rem rgba(15, 23, 42, 0.22);
  cursor: grabbing;
}

/* Drag handle (used in HTML as .workflow-stage-handle) */
.workflow-stage-handle,
.workflow-stage-drag-handle {
  position: absolute;
  left: 0.4rem;
  top: 0.45rem;
  font-size: 0.9rem;
  color: var(--unstuck-muted);
  cursor: grab;
}

/* Card body + typography */
.workflow-stage-body {
  font-size: 0.8rem;
}

.workflow-stage-title {
  font-weight: 600;
  font-size: 0.85rem;
}

.workflow-stage-meta {
  font-size: 0.72rem;
  color: var(--unstuck-muted);
  margin-bottom: 0.25rem;
}

.workflow-stage-description {
  line-height: 1.25;
}

/* Chips / tags */
.workflow-stage-tags .badge {
  font-weight: 500;
  margin-right: 0.15rem;
}

.workflow-stage-chip {
  font-weight: 500;
}

/* Connectors row on cards */
.workflow-stage-connectors {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.4rem;
}

.workflow-stage-connectors .connector {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.9);
  background-color: #fff;
}

.workflow-stage-connectors .connector-in {
  background-color: rgba(25, 135, 84, 0.12);
  border-color: rgba(25, 135, 84, 0.8);
}

.workflow-stage-connectors .connector-out {
  background-color: rgba(13, 110, 253, 0.12);
  border-color: rgba(13, 110, 253, 0.8);
}

.workflow-stage-connectors .connector-branch {
  background: repeating-linear-gradient(
    135deg,
    rgba(234, 179, 8, 0.06),
    rgba(234, 179, 8, 0.06) 2px,
    rgba(234, 179, 8, 0.26) 2px,
    rgba(234, 179, 8, 0.26) 4px
  );
  border-color: rgba(234, 179, 8, 0.8);
}

/* Tiny dot icons if/when you use them */
.workflow-stage-action-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  font-size: 0.7rem;
}

/* Ensure stretched-link works on cards */
.workflow-stage-card .stretched-link {
  position: static;
}
