html {
  overflow-y: scroll;

  /* Reuse Django's colors */
  --ce-blue-bg: #79aec8;
  --ce-grey-bg: #f8f8f8;
  --ce-red: #ba2121;
  --ce-border: 1px solid #eee;
  --ce-title: #666;
}

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

.tabs > .tab {
  text-transform: none;
  letter-spacing: 0;
  float: left;
  padding: 10px 15px;
  margin: 0 4px 0 0;
  cursor: pointer;
  font-weight: bold;
  font-size: 13px;
  color: var(--ce-title);
  background: var(--ce-grey-bg);
  border: var(--ce-border);
  border-bottom: none;
  user-select: none;
}

.tabs > .active {
  background: var(--ce-blue-bg);
  color: white;
}

.tabs > [data-region="_unknown_"],
.tabs > .has-error {
  border-color: var(--ce-red);
  color: var(--ce-red);
  background: var(--ce-grey-bg);
}

.tabs > .toggle {
  float: right;
  margin: 4px 0 0 0;
  padding: 6px 10px;
  border: var(--ce-border);
  font-size: 13px;
  font-weight: normal;
}

.order-machine {
  clear: both;
  padding: 0 10px 10px 10px;
  border: var(--ce-border);
  border-bottom: none;
  position: relative;

  display: flex;
  flex-flow: column nowrap;
}

.order-machine .inline-related {
  border: var(--ce-border);
  border-bottom: 0;
  margin-top: 10px;
}

.order-machine .inline-related > h3 {
  border-top: none;
  font-size: 13px;
  font-weight: normal;
  padding: 7px 7px 7px 23px;
  background-color: var(--ce-grey-bg);
  transition: 0.3s background, 0.3s color;

  cursor: move;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-machine .inline-related > h3[draggable] {
  background-repeat: no-repeat;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIGlkPSJtZGktZHJhZy12ZXJ0aWNhbCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGZpbGw9IiNhYWEiIGQ9Ik05LDNIMTFWNUg5VjNNMTMsM0gxNVY1SDEzVjNNOSw3SDExVjlIOVY3TTEzLDdIMTVWOUgxM1Y3TTksMTFIMTFWMTNIOVYxMU0xMywxMUgxNVYxM0gxM1YxMU05LDE1SDExVjE3SDlWMTVNMTMsMTVIMTVWMTdIMTNWMTVNOSwxOUgxMVYyMUg5VjE5TTEzLDE5SDE1VjIxSDEzVjE5WiIgLz48L3N2Zz4=");
  background-position: 0 2px;
}

/* Replace the broken content type counter for new contents with a "new" label */
.order-machine .last-related .inline_label {
  content: "new";
}

.order-machine .delete {
  position: absolute;
  top: 7px;
  right: 7px;
}

.order-machine .inline-related fieldset {
  /* Animate out of view REAL FAST */
  transition: max-height 0.3s cubic-bezier(0, 1.05, 0, 1), background 0.3s;
  max-height: 2000px;
  overflow: hidden;
  position: relative;
}

.order-machine .inline-related {
  transition: border 0.3s;
}

.order-machine .inline-related:hover > h3,
.order-machine .inline-related:focus-within > h3 {
  color: white;
  background-color: var(--ce-blue-bg);
}

.order-machine .inline-related:hover .delete label,
.order-machine .inline-related:focus-within .delete label {
  color: white;
}

.order-machine .inline-related.for-deletion fieldset,
.order-machine .inline-related.collapsed fieldset {
  max-height: 0;
}

.machine-message {
  margin: 1.5em 1em 1em;
  text-align: center;
}

.machine-control {
  padding: 5px 10px 5px 0;
  border: var(--ce-border);
  background: var(--ce-grey-bg);
  height: 55px;
}

.control-unit {
  float: left;
  padding: 0 15px;
  border-left: var(--ce-border);
  height: 55px;
}

.control-unit:first-child {
  border-left: none;
}

.control-unit select {
  float: left;
  position: relative;
  top: 13px;
}

.control-unit .plugin-button {
  margin: 0 0.5rem;
  font-size: 2.5rem;
  cursor: pointer;
}

.inline-controls {
  position: absolute;
  right: 100px;
  top: 2px;
}

.inline-controls select {
  border-color: #f8f8f8;
}

/* tabbed_fieldsets.js support */
#tabbed .tabs {
  border-bottom: var(--ce-border);
}

#tabbed .modules {
  margin-bottom: 30px;
}

#tabbed .module {
  border: var(--ce-border);
  border-top: none;
  margin-bottom: 0;
}

#tabbed .form-row:last-child {
  border: none;
}

.content-editor-hidden {
  /* We can't simply use display: none. Some admin widgets need to know
     * their dimensions, so we can't have that -- use an alternative way
     * to hide the modules. */
  visibility: hidden !important;
  height: 0 !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Used when dragging */
.placeholder {
  height: 34px;
  margin: 10px 0 0 0;
  border: none;
  opacity: 0.3;
  background: #79aec8;
}

.order-machine .inline-related {
  position: relative;
}

.fs-dragging {
  opacity: 0.5;
}

.fs-dragover::before {
  content: " ";
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  height: 4px;
  background: #79aec8;
}

.fs-dragover::after {
  /* Cover fieldset with an overlay so that widgets do not swallow events */
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
}

@media screen and (max-width: 767px) {
  /* CSS fix for Django's responsive admin interface (shows fields below the
   * 767px breakpoint despite them being .hidden */
  html .aligned .form-row.hidden {
    display: none;
  }

  html .aligned .form-row > div {
    width: calc(100vw - 90px);
  }

  html .order-machine .form-row {
    padding: 10px;
  }
}
