:root {
  --primary: #004E89;
  --primary-hover: #1A659E;
  --bg-main: #FDFDF8;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --accent: #FF6B35;
  --tint: #F7C59F;

  --red: #ef4444;
  --green: #22c55e;
  --blue: var(--primary);
  --yellow: #f59e0b;

  /* Vivid versions of the same hues, for the events themselves: the navy of the chrome
     turns to mud once it is washed out enough to read black text on. */
  --event-blue: #2563eb;
  --event-red: #dc2626;
  --event-yellow: #f59e0b;
  --white: #ffffff;
  --lightlightgrey: #f1f5f9;
  --lightgrey: #e2e8f0;
  --black: #0f172a;

  --background-color: var(--bg-main);
  background-color: var(--background-color);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;

  --half_hour_px: 40px;

  --full-day-px: calc(24 * 2 * var(--half_hour_px));
  --row-height: 28px;
  --row-margin: 2px;
  --min-schedule-width: 200px;
  --gap-size: 10px;
  --room_resource_names-height: 20px;

  --schedule_event_border_radius: 8px;

  /* display 4 resource names */
  --schedules_to_display-height: calc(4 * var(--row-height) + 5 * var(--row-margin));
  --left_column_header-height: 50px;
}

.loader {
  width: 48px;
  height: 48px;
  border: 5px solid var(--lightgrey);
  border-bottom-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;

  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

@keyframes rotation {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}


/* Bigger event size for mobile */
@media (max-width: 768px) {
  :root {
    --half_hour_px: 50px;
  }
}

* {
  margin: 0;
  padding: 0;
  outline: none;
  box-sizing: border-box;
  font-size: 1rem;
}

body,
html {
  overflow: hidden;
}

#mobile-resource-select {
  width: 100%;
}

#snackbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  height:fit-content;
  min-width: 300px;
  max-width: 80vw;
  width: fit-content;
  background-color: var(--black);
  color: var(--white);
  border-radius: 8px;
  padding: 12px 20px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: fadein 0.3s forwards;
}

@keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.top_middle {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translate(-50%, 0);
  overflow: auto;
}

.bottom_right {
  position: absolute;
  max-height: 100px;
  right: 20px;
  bottom: 20px;
}

.bg_red {
  background-color: rgba(239, 68, 68, 0.2) !important;
  color: #7f1d1d !important;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.bg_yellow {
  background-color: rgba(245, 158, 11, 0.2) !important;
  color: #92400e !important;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.bg_green {
  background-color: rgba(34, 197, 94, 0.2) !important;
  color: #14532d !important;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.font_weight_500 {
  font-weight: 500;
}

#selection_panel {
  display: grid;
  grid-auto-flow: row;
  min-width: 450px;
  max-height: 85%;
  background-color: var(--bg-card);
  color: var(--text-main);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  position: absolute;
  z-index: 50;
  overflow: auto;
}

#selection_panel .grid_header {
  height: 50px;
  white-space: nowrap;
}

#selection_panel .bigger-font {
  font-size: 17px;
}

.horizontal_flex {
  display: flex;
  flex: 1;
  flex-direction: row;
  gap: 5px;

  align-items: center;
  text-align: center;
}

.flex_space_between {
  justify-content: space-between;
}

.flex_center {
  justify-content: center;
}

.flex_align_left {
  align-content: flex-start;
}

.main {
  display: flex;
  flex-direction: row;
  top: 72px;
  gap: var(--gap-size);
  position: absolute;
  padding: 0px;
  height: calc(100% - 16px - 72px);
  width: calc(100vw - 16px);
  margin: 5px;
}

.main_no_header {
  display: flex;
  flex-direction: column;
  top: 5px;
  gap: var(--gap-size);
  position: absolute;
  padding: 0px;
  height: calc(100% - 16px - 5px);
  width: calc(100vw - 16px);
  margin: 5px;
}

.flex_auto {
  flex: auto;
}

.schedules_to_display {
  height: var(--schedules_to_display-height);
  overflow-y: auto;
}

.row {
  height: var(--row-height);
  line-height: var(--row-height);
  margin: var(--row-margin);
  white-space: nowrap;
}

.inner_expandable {
  text-align: left;
  margin-left: 25px;
  line-height: var(--row-height);
}

#canvas {
  display: grid;
  grid-auto-flow: column;
  gap: var(--gap-size);
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
}

#canvas_with_room_resource_names {
  display: grid;
  grid-template-rows: min-content auto;

  gap: var(--gap-size);
  overflow-x: auto;
  height: 100%;
}

.room_resource_names {
  display: grid;
  grid-auto-flow: column;
  height: var(--room_resource_names-height);
  gap: var(--gap-size);
  user-select: none;
}

.resource_name {
  flex: auto;
  text-align: center;
  font-size: 18px;
  min-width: var(--min-schedule-width);
}

.schedule {
  flex: auto;
  position: relative;
  height: var(--full-day-px);
  min-height: var(--full-day-px);
  max-height: var(--full-day-px);
  background: var(--background);
  border-radius: 10px;
  min-width: var(--min-schedule-width);
}

.event_schedule_container {
  position: absolute;
  top: var(--begin_percent);
  height: var(--height);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-around;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.1);
}

.event_schedule_container>.event_schedule>.show_on_hover {
  visibility: hidden;
}

.event_schedule_container:hover>.event_schedule>.show_on_hover {
  visibility: visible;
}

.event_schedule {
  max-height: 100%;
  overflow: hidden;
  overflow-wrap: break-word;
  text-align: center;
  text-overflow: ellipsis;
  font-size: var(--font-size);
}

.event_schedule>label>svg {
  margin-left: 10px;
  margin-right: 10px;
}

.parent_height {
  height: 100%;
}

/* Events are the one thing on the screen worth looking at, so they carry their colour at
   full strength on the edge that marks them out, and a light wash of it behind the text. */
.valid_event {
  background-color: color-mix(in srgb, var(--event-blue) 13%, white);
  color: color-mix(in srgb, var(--event-blue) 85%, black);
  border-left: 3px solid var(--event-blue);
  font-weight: 500;
}

.invalid_event {
  background-color: color-mix(in srgb, var(--event-red) 13%, white);
  color: color-mix(in srgb, var(--event-red) 80%, black);
  border-left: 3px solid var(--event-red);
  font-weight: 500;
}

.warning_event {
  background-color: color-mix(in srgb, var(--event-yellow) 20%, white);
  color: color-mix(in srgb, var(--event-yellow) 45%, black);
  border-left: 3px solid var(--event-yellow);
  font-weight: 500;
}

.uneditable_event {
  background-color: var(--lightgrey);
  color: #334155;
  border-left: 3px solid #94a3b8;
  font-weight: 500;
}

.filtered_event>label {
  opacity: 30%;
}

.filtered_event.selected {
  background-color: color-mix(in srgb, var(--primary) 25%, transparent);
}

.header {
  position: absolute;
  display: flex;
  flex-direction: row;
  height: 60px;
  width: 100%;
  left: 0;
  top: 0;
  padding: 8px 16px;
  gap: 8px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  z-index: 40;
}

/* The n last elements are on the right */
.header>button:nth-last-child(7) {
  margin-left: auto
}

.header>button {
  height: 43px;
  min-width: 43px;
}

#mobile-logout-button {
  height: 35px;
  width: 35px;
  border-radius: 15px;
}

.header>input {
  height: 43px;
  width: fit-content;
}

.current_calendar {
  position: absolute;
  height: 60px;
  width: calc(100vw - 12px);
  left: 0;
  top: 0;
  text-align: center;
  line-height: 60px;
  font-size: 28px;
  z-index: 50;
  pointer-events: none;
  font-weight: bold;
}

.current_calendar:focus {
  outline: none;
}

#time_bar {
  margin-top: calc(var(--room_resource_names-height) + var(--gap-size));
  display: grid;
  grid-auto-flow: row;
  width: min-content;
  min-width: min-content;
  height: 100%;
  font-size: 12px;
  overflow: hidden;
}

#time_bar>.offset {
  /* offset to display the number in the middle of the line */
  height: calc(2 * var(--half_hour_px) - 8px);
}

#time_bar>div {
  height: calc(2 * var(--half_hour_px));
}

.width_min_content {
  width: min-content;
}

#drag {
  position: fixed;
  z-index: 3;
  text-align: center;
  vertical-align: middle;
  border: 1px solid black;
  border-radius: var(--schedule_event_border_radius);
}

/* #drag and #selection_panel are positioned from Rust, via their style attribute. */
.hidden {
  visibility: hidden;
}

.drag_ghost {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
}

.left_column {
  width: 300px;
  height: calc(100% - var(--left_column_header-height) - var(--schedules_to_display-height));
}

.left_column_header {
  height: var(--left_column_header-height);
  min-height: var(--left_column_header-height);
}

.name_selector_container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.dropdown_content {
  position: absolute;
  background-color: var(--white);
  border: 1px solid var(--lightgrey);
  border-radius: 8px;
  border-top: none;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dropdown_item {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.dropdown_item:hover {
  background-color: var(--lightgrey);
}

.dropdown_item input[type="checkbox"] {
  margin: 0 8px 0 0;
  accent-color: var(--blue);
  width: auto;
  min-height: unset;
}

.dropdown_item_icon {
  margin-right: 8px;
  display: flex;
  align-items: center;
}

.left_column_contents {
  height: calc(100% - var(--left_column_header-height));
  width: 100%;
  overflow-y: auto;
}

.scroll_y {
  overflow-y: auto;
}

.relative {
  position: relative;
}

.name {
  font-size: 20px;
}

.selection_link:hover {
  cursor: pointer;
  text-decoration: underline;
}

select {
  background-color: transparent;
  border: none;
  padding: 0 1em 0 0;
  font-family: inherit;
  font-size: inherit;
  cursor: inherit;
  line-height: inherit;
  height: 24px;
  border-radius: 5px;
  font-size: 1rem;
  vertical-align: middle;
  text-align: center;
  border: 1px solid silver;
}

.flex_align_middle {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  width: calc(100% - 5px);
  height: 28px;
}

.single_button_right>button:nth-last-child(1) {
  margin-left: auto;
}

.two_buttons_right>button:nth-last-child(2) {
  margin-left: auto;
}

.hover_button button {
  opacity: 0%;
}

.hover_button:hover button {
  opacity: 100%;
}

.standard_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  line-height: 1;
  height: 36px;
  margin-top: auto;
  margin-bottom: auto;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 0 16px;
  font-size: 0.875rem;
  transition: background-color 0.2s;
}

#snackbar>button {
  height: 30px;
  width: 30px;
  margin-left: 15px;
  background-color: var(--white);
  color: var(--black);
  padding: 0;
}

.transparent_hover_highlight {
  font-weight: 400;
  line-height: 1.0;
  color: var(--black);
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  background-color: transparent;
  border: 1px solid transparent;
  padding: .375rem .375rem;
  font-size: 1rem;
  border-radius: 50%;
}

.transparent_hover_highlight:hover {
  background-color: var(--lightgrey);
}

.notif_number {
  height: 20px;
  width: 20px;
  background-color: var(--red);
  border-radius: 14px;
  color: white;
  text-align: center;
  position: absolute;
  top: 6px;
  right: 5px;
  padding: 1px;
  border-style: solid;
  border-width: 0px;
  font-size: 16px;
}

.notif_number:empty {
  display: none;
}

.event_filter_number {
  height: 20px;
  width: 20px;
  background-color: var(--blue);
  border-radius: 14px;
  color: white;
  text-align: center;
  float: right;
  margin-left: -2px;
  margin-top: -15px;
  margin-right: -18px;
  padding: 1px;
  border-style: solid;
  border-width: 0px;
  font-size: 16px;
}

.event_filter_number:empty {
  display: none;
}

.dropdown {
  float: right;
  overflow: hidden;
}

#dropdown_content {
  display: block;
  position: absolute;
  top: 50px;
  right: 8px;
  background-color: var(--white);
  min-width: 300px;
  width: max-content;
  max-width: 600px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 2;
  max-height: 50vh;
  overflow-y: auto;
}

.left_text {
  text-align: left;
}

#dropdown_content .checkbox-input {
  width: 24px;
  height: 48px;
  margin-left: 14px;
}

#dropdown_content .display_only {
  white-space: nowrap;
  float: none;
  color: var(--black);
  padding: 14px 12px;
  text-decoration: none;
  display: flex;
  text-align: justify;
}

label {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.no_select {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#dropdown_content label {
  /* white-space for line breaks */
  white-space: pre-wrap;
  float: none;
  color: var(--black);
  padding: 14px 12px;
  text-decoration: none;
  display: block;
  text-align: justify;
  flex: auto;
}

#dropdown_content label:hover {
  background-color: var(--lightgrey);
}

.share_dropdown {
  padding: 14px 12px;
  white-space: pre-wrap;
}

.share_dropdown a {
  color: var(--blue);
  text-decoration: underline;
}

.share_dropdown a:hover {
  filter: brightness(120%);
}

.monospace {
  font-family: monospace;
}

.small_text {
  font-size: 0.8rem;
}

button:disabled {
  opacity: 0.5;
}

.selected {
  background-color: color-mix(in srgb, var(--primary) 14%, white);
  box-shadow: 0 0 0 1px var(--primary);
  border-radius: 6px;
}

.rounded {
  border-radius: 5px;
}

.standard_button:hover:enabled {
  filter: brightness(120%);
}

.add-resources {
  height: 40%;
  overflow: hidden;
}

.resources-to-add {
  height: 100%;
  overflow: auto;
}

input {
  min-height: 24px;
  width: 100%;
  border: none;
  font-size: 16px;
  transition: all 0.5s ease;
  border-radius: 8px;
}

.input_border {
  border: 1px solid silver;
  border-radius: 8px;
  padding: 6px 8px;
  margin: 10px 2px;
  box-sizing: border-box;
}

.input_border:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.checkbox {
  height: 20px;
  width: 20px;
  accent-color: var(--blue);
}

hr {
  background-color: var(--lightgrey);
  margin: 10px;
  height: 2px;
  border: none;
}

.center {
  left: 50%;
  transform: translateX(-50%);
}

.vertical_flex {
  display: flex;
  flex-direction: column;
}

.flex_huge_gap {
  gap: 30px;
}

.fit_content {
  width: fit-content;
  height: fit-content;
}

.gap {
  gap: var(--gap-size);
}

.margin_bottom {
  margin-bottom: var(--gap-size);
}

input[type="checkbox"] {
  accent-color: var(--blue);
}

input[type="radio"] {
  height: 15px;
  width: 15px;
  accent-color: var(--blue);
}

legend {
  font-size: 18px;
}

fieldset {
  border: 1px solid grey;
  border-radius: 8px;
  margin: 5px;
  padding: 5px;
}

fieldset>div {
  margin: 10px;
}

.warning_text {
  color: var(--red, red);
}
