/* =========================================================
   Layout / global
   ========================================================= */
:root,
:host {
  --b-widget-padding: 0.5em !important;
  --b-widget-padding-large: 1em !important;
  --b-widget-gap: 0.5em !important;
  --b-grid-cell-font-size: 0.90em !important;
}

#main {
  display: flex;
  flex: 1 1 100%;
  flex-direction: row;
}

.apex-footer {
  display: none !important;
}

.b-grid-header {
  height: 57px;
}

.b-widget {
  font-weight: 300 !important;
  font-size: 0.95em !important;
}


/* =========================================================
   Progress overlay
   ========================================================= */

.progress-container {
  position: absolute;
  top: 0;
  height: 100%;
  pointer-events: none;
}

.progress-bar {
  height: 100%;
  background-color: orange;
}


/* =========================================================
   Dependencies
   ========================================================= */

.hidden-dependency {
  display: none !important;
}

.b-sch-dependency {
  stroke-width: 0.5 !important;
}

.b-sch-dependency.b-sch-dependency-over {
  stroke-width: 5 !important;
}


/* =========================================================
   Resource time ranges / availability
   ========================================================= */

.b-sch-resourcetimerange {
  /* background-color: rgba(255, 235, 59, 0.1) !important; */
  color: #000 !important;
}

.b-resource-unavailable {
  background: #f0f0f0
    linear-gradient(
      -45deg,
      rgba(0, 0, 0, 0) 46%,
      #ccc 49%,
      #ccc 51%,
      rgba(0, 0, 0, 0) 55%
    );
  background-size: 6px 6px !important;
}

.unavailable {
  background: repeating-linear-gradient(-45deg, #dfc9c9, #dfc9c9 1px, #eee 1px 1px);
  /* opacity: .7; */
}


/* =========================================================
   Night shift
   ========================================================= */

.nightshift {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.2705882353);
}

.b-sch-timeranges-canvas .b-sch-timerange.night-shift {
  background-color: rgba(0, 149, 255, 0.0509803922);
}


/* =========================================================
   Non-working time (resource + factory shutdown)
   ========================================================= */

.b-sch-resourcenonworkingtime {
  background-color: rgba(230, 230, 230, 0.5) !important;
}

.b-sch-resourcenonworkingtime .b-sch-event-withicon {
  justify-content: center;
}

.b-sch-resourcenonworkingtime i {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 2.5em;
  height: 2.5em;
  margin: 0.5em;

  font-size: 1.2em;
  color: #ccc;

  border: 3px solid #ccc;
  border-radius: 50%;
}

.b-sch-resourcenonworkingtime:hover {
  border-radius: 5px;
  outline: 2px solid #3183fe;
  outline-offset: -2px;
}

.b-sch-non-working-time.factoryShutdown {
  background: transparent
    repeating-linear-gradient(
      -55deg,
      rgba(221, 221, 221, 0.6),
      rgba(221, 221, 221, 0.6) 10px,
      rgba(238, 238, 238, 0.6) 5px,
      rgba(238, 238, 238, 0.6) 20px
    );
}

.b-grid-header .b-sch-non-working-time.factoryShutdown {
  opacity: 0.7;
}


/* =========================================================
   Breaks
   ========================================================= */

.break {
  background-image: linear-gradient(
    -45deg,
    rgba(0, 0, 0, 0) 46%,
    #000 22%,
    #000 51%,
    rgba(0, 0, 0, 0) 42%
  );
  background-size: 6px 6px;

  color: #888;
  align-items: center;
}

.break > div {
  justify-content: center;
}


/* =========================================================
   Skill highlighting (resource rows during drag)
   ========================================================= */

/* Resource has all required skills — green tint, full opacity */
.b-grid-row.skill-ok {
  background: rgba(46, 204, 113, 0.22) !important;
}
.b-grid-row.skill-ok .b-grid-cell {
  background: transparent !important;
}

/* Resource missing required skills — fade out */
.b-grid-row.skill-no {
  opacity: 0.35;
  filter: grayscale(60%);
}


/* =========================================================
   Invalid drop visual feedback on the dragged event
   (Bryntum 7.x doesn't add this class itself — we toggle it
    from the eventDrag listener in app.module.js)
   ========================================================= */

.b-sch-event-wrap.b-drop-invalid .b-sch-event,
.b-sch-event-wrap.b-dragging.b-drop-invalid .b-sch-event {
  background-color: #d9534f !important;
  border-color: #8b0000 !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px rgba(217, 83, 79, 0.6) !important;
}

.b-sch-event-wrap.b-drop-invalid {
  cursor: not-allowed !important;
}


/* =========================================================
   Events
   ========================================================= */

.b-sch-event {
  border-radius: 0.5em;
  box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.25);
}

.b-sch-event-content {
  display: flex;
  flex: 1;
  flex-direction: row;

  /* merged from duplicates */
  overflow: hidden !important;
  margin-left: 0.2em !important;

  /* last one wins previously (15px), so keep it */
  font-size: 15px;
}

.b-sch-event-content i {
  order: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.b-sch-event-content .b-event-text-wrap {
  flex: 1;
}

.b-sch-event-content .b-event-text-wrap > div {
  font-size: 1.1em;
  font-weight: 500;
}

.b-sch-event-content .b-event-text-wrap span {
  font-size: 0.8em;
  font-weight: normal;
}


/* =========================================================
   Save button — vivid red when there are unsaved changes.
   Bryntum's b-raised rendition uses --b-primary-45 (a desaturated
   shade) which looks pale; override to use full --b-color-red so
   the dirty state is unmistakable.
   Triggered by Bryntum API: btn.color = 'b-red' → adds inline
   style="--b-primary: var(--b-color-red);" — we match on that.
   ========================================================= */

.b-button.b-raised[style*="b-color-red"] {
  --b-button-background          : var(--b-color-red) !important;
  --b-button-hover-background    : color-mix(in srgb, var(--b-color-red), #000 12%) !important;
  --b-button-pressed-background  : color-mix(in srgb, var(--b-color-red), #000 20%) !important;
  --b-button-color               : #fff !important;
  color                          : #fff !important;
}


/* =========================================================
   "Actions" toolbar dropdown menu — compact layout
   ========================================================= */

.b-menu.apex-actions-menu {
  min-width : 16em;
  padding   : 0.25em !important;
}

.b-menu.apex-actions-menu .b-menu-content {
  gap : 0.15em !important;
}

/* Every direct item gets the same width and a smaller vertical footprint */
.b-menu.apex-actions-menu .b-menuitem,
.b-menu.apex-actions-menu .b-button {
  width      : 100%;
  min-height : 2em;
  padding    : 0.35em 0.7em !important;
  margin     : 0 !important;
  text-align : start;
  justify-content : flex-start !important;
}

/* Combo (time-zone) — match the buttons exactly: same height, same padding,
   leading icon aligned with button icons. */
.b-menu.apex-actions-menu .b-combobox,
.b-menu.apex-actions-menu .apex-actions-tz {
  width  : 100%;
  margin : 0 !important;
}

.b-menu.apex-actions-menu .b-combobox .b-field-inner {
  min-height : 2em;
  padding    : 0 0.7em !important;
  border     : none !important;
}

/* Leading globe icon mimics the button icon position */
.b-menu.apex-actions-menu .b-combobox .b-icon-align-start {
  margin-inline-end : 0.6em;
  width             : 1.2em;
  text-align        : center;
  color             : var(--b-button-color);
}

/* Hide the redundant down-arrow trigger background — keep just the icon */
.b-menu.apex-actions-menu .b-combobox .b-field-trigger {
  padding : 0;
}

/* Align icons consistently (fa-fw makes each icon the same width) */
.b-menu.apex-actions-menu .b-button .b-icon {
  margin-inline-end : 0.6em;
  width  : 1.2em;
  text-align : center;
}


/* =========================================================
   Bundled events (same bundleid + name across resources)
   Visual cue that these tasks are linked and move together.
   ========================================================= */

.b-sch-event.b-bundled {
  border-style: dashed !important;
  border-width: 2px !important;
  border-color: rgba(0, 0, 0, 0.55) !important;
}

.b-sch-event.b-bundled::before {
  content: '\f0c1';                         /* fa-link unicode */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.7em;
  opacity: 0.65;
  pointer-events: none;
}


/* =========================================================
   Unplanned / unassigned (drag proxy)
   ========================================================= */

.b-unplannedgrid .b-grid-cell i {
  margin-inline-end: 0.5em;
}

.b-unplannedgrid .fa-clock {
  margin-inline-end: 0 !important;
}

/* Default state of UnplannedGrid drag proxy = VALID drop → vivid green */
.b-unassigned-class.b-drag-proxy .b-sch-event {
  grid-row: 1;
  background: #4caf50 !important;
  border-color: #2e7d32 !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.55), 0 1px 2px rgba(0,0,0,0.25) !important;
}

/* Invalid drop → red (toggled by Drag.onDrag based on isDropValid) */
.b-unassigned-class.b-drag-proxy.b-drag-invalid .b-sch-event {
  background: #d9534f !important;
  border-color: #8b0000 !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px rgba(217, 83, 79, 0.6), 0 1px 2px rgba(0,0,0,0.25) !important;
}

.b-unassigned-class.b-drag-proxy.b-drag-invalid {
  cursor: not-allowed !important;
}
