@use '@/theme/viewerDefs' as *;
@import '../Operator.module.scss';

.event {
  opacity: 1;
  border-top: 1px solid $white-1;
  padding-right: 0.5rem;
  color: $white-90;
  background-color: $viewer-card-bg-color;

  display: grid;
  align-items: center;
  column-gap: 0.5rem;
  row-gap: 0.5rem;
  grid-template-rows: auto auto auto;
  grid-template-columns: 1.25rem 1fr auto;
  grid-template-areas:
    'binder main      schedule'
    'binder secondary running'
    'binder fields    fields';

  &.subscribed {
    background-color: $gray-1250;
  }

  &.running {
    border-top: 1px solid $gray-1300;
    background-color: var(--operator-running-bg-override, $active-green);
  }

  &.past {
    border-top: 1px solid transparent;
    opacity: 0.2;
  }
}

.binder {
  grid-area: binder;
  color: $section-white;
  height: 100%;
  display: grid;
  place-content: center;
  position: relative;
  background-color: $gray-1050; // to override inline

  .cue {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    width: 6em;

    rotate: -90deg;
    letter-spacing: 0.5px;
  }
}

.mainField {
  grid-area: main;
  font-size: 1.5rem;
  color: $ui-white;

  @include ellipsis-text;
}

.secondaryField {
  grid-area: secondary;
  font-size: 1.25rem;
  line-height: 1em;
  // allow multi-line text but trim before
  white-space: pre-line;
}

.plannedStart, .timeUntil {
  line-height: 1em;
  background-color: $gray-1000;
  padding: 0.25rem 0.5rem;
  border-radius: 1px;
}

.plannedStart {
  font-size: 1.5rem;
  margin-right: 0.5rem;
}

.timeUntil {
  font-size: calc(1rem - 2px);
  line-height: 1em;
  grid-area: schedule;
  justify-self: end;
}

.runningTime {
  font-size: 1.25rem;
  line-height: 1em;
  grid-area: running;
  justify-self: end;
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.fields {
  grid-area: fields;
  font-size: var(--operator-customfield-font-size-override, 1.25rem);
  font-weight: 400;
  color: $ui-black;
  margin: 0.25rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  row-gap: 0.25em;
  line-height: 1.25em;

  .field {
    font-weight: 600;
    padding-inline: 0.25rem;
  }

  .noColour {
    outline: 0.15rem solid $ui-white;
    outline-offset: -0.15rem;
    padding-right: 0.3rem;
    color: $ui-white;
  }

  .value {
    display: inline-flex;
    padding-inline: 0.25rem;
    background-color: $gray-1250;
    color: $ui-white;
    // allow multi-line text but trim before
    white-space: pre-line;
  }
}

.fields::after {
  content: '\200b';
}
