/* Override default light admin theme */
html[data-theme='light'], :root {
  --secondary: #343a40;
  --accent: #fff;
  --header-color: #fff;
  --selected-row: lightgrey;
  --link-hover-color: #1A3642;
  --link-fg: #2F5E74;
}

@media (prefers-color-scheme: light) {
  html[data-theme='auto'], :root {
    --secondary: #343a40;
    --accent: #fff;
    --header-color: #fff;
    --selected-row: lightgrey;
    --link-hover-color: #1A3642;
    --link-fg: #2F5E74;
  }
}

/* Override default dark admin theme */
html[data-theme='dark'], :root {
  --secondary: #343a40;
  --accent: #fff;
  --header-color: #fff;
  --selected-row: #2F5E74;
  --link-hover-color: #79aec8;
  --link-fg: #79aec8;
}

@media (prefers-color-scheme: dark) {
  html[data-theme='auto'], :root {
    --secondary: #343a40;
    --accent: #fff;
    --header-color: #fff;
    --selected-row: #2F5E74;
    --link-hover-color: #79aec8;
    --link-fg: #79aec8;
  }
}

/* Fieldsets in inlines */
.nested_sections .fieldset-heading {
  font-size: 0.7rem;
  padding: 3px;
  background-color: var(--link-fg);
  opacity: 0.5;
}

/* Custom variables */
:root {
  --warning: #efb80b;
}

/* Alignment */
.align-center {
  text-align: center;
}

.align-end {
  text-align: end;
}

/* Hidden form rows */
div.form-row.hidden {
  display: none;
}

/* Disabled add/change links */
a.disabled {
  pointer-events: none;
  opacity: 0.3 !important;
}

/* Disabled selects/inputs */
select[disabled], input[disabled] {
  background-color: var(--darkened-bg);
}

/* Fieldsets/inlines description */
div.description {
  color: var(--body-quiet-color);
  padding: 5px 0px;
}

/* Autocomplete inputs */
.ui-autocomplete {
  max-height: 250px;
  overflow-y: auto;
  overflow-x: hidden;
}

.ui-autocomplete-loading {
  background: url(../img/loader.gif) right 6px center no-repeat;
  background-size: 16px;
}

/* Text content inputs in Work/SungText admin pages */
.field-text_content .flex-container {
  display: block;
}

.add_text_content_row_button img {
  padding-right: 5px;
}

.field-text_content input {
  width: 60px;
}

.field-text_content .help {
  margin-left: 0 !important;
  padding-left: 0 !important;
  padding-top: 12px !important;
}

/* Ajax error */
.ajax_error {
  color: var(--error-fg);
  font-style: italic;
}

/* Override the "add" image used by the Django "add-row" class by using the class
"custom_edit_row", to display an "edit" image instead */
.custom_edit_row a {
  background: url(../../admin/img/icon-changelink.svg) 0 1px no-repeat !important;
}

/* Custom admin pages (profile and bookcopy table of contents */
#custom_admin_page .aligned {
  display: block;
}

#custom_admin_page .module {
  width: 100%;
  background-color: var(--darkened-bg);
}

#custom_admin_page .module {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

@media (min-width: 768px) {
  #custom_admin_page .aligned {
    display: flex;
  }

  #custom_admin_page .module.on_left {
    margin-right: 15px !important;
  }

  #custom_admin_page .module.on_right {
    margin-left: 15px !important;
  }
}

#custom_admin_page .module h2 {
  text-transform: uppercase;
}

#custom_admin_page .module ul {
  padding: 5px 15px;
  margin-left: 0;
}

#custom_admin_page .module li {
  list-style-type: none;
}

#custom_admin_page .module p {
  padding: 5px 15px;
  color: var(--body-quiet-color);
}

#custom_admin_page .module h3 {
  text-transform: uppercase;
  font-weight: normal;
  background-color: var(--selected-row);
}

/* Profile page */
.button.admin_btn_dark, .button.admin_btn_cancel, .button.admin_btn_warning, .button.admin_btn_danger {
  padding: 1px 3px 1px 3px;
}

.button.admin_btn_cancel, .button.admin_btn_warning, .button.admin_btn_danger {
  background-color: transparent;
}

.button.admin_btn_cancel {
  color: var(--close-button-bg);
  border: 1px solid var(--close-button-bg);
}

.button.admin_btn_warning {
  color: var(--warning);
  border: 1px solid var(--warning);
}

.button.admin_btn_danger {
  color: var(--error-fg);
  border: 1px solid var(--error-fg);
}

.button.admin_btn_cancel:hover, .button.admin_btn_warning:hover, .button.admin_btn_danger:hover {
  color: #fff;
}

.button.admin_btn_cancel:hover {
  background-color: var(--close-button-bg);
}

.button.admin_btn_warning:hover {
  background-color: var(--warning);
}

.button.admin_btn_danger:hover {
  background-color: var(--error-fg);
}

/* Bookcopy edit contents page */
#sortable {
  padding: 0;
  margin: 10px;
}

#sortable li {
  margin: 3px;
  padding: 10px;
  border-radius: 5px;
  color: var(--body-fg);
  background-color: var(--darkened-bg);
}

#sortable li:hover {
  cursor: grab;
}

#sortable li input {
  background-color: var(--darkened-bg);
}

li {
  list-style-type: none !important;
}

.ui-state-highlight {
  height: 100px;
  background-color: transparent !important;
  border-color: var(--link-fg) !important;
  border-style: dashed !important;
}

#drop_note {
  font-size: 0.875rem;
  font-weight: 700;
  display: block;
  padding: 10px 12px;
  margin: 0 0 10px 0;
  color: var(--link-fg);
  border: 1px solid var(--link-fg);
  border-radius: 4px;
  background-color: transparent;
  background-position: 5px 12px;
  overflow-wrap: break-word;
}

.custom_errornote {
  background-color: transparent;
  color: var(--error-fg) !important;
}

.module .custom_errornote {
  margin: 15px;
}

div.validation_errors {
  margin-top: 10px;
}

div.validation_errors > * {
  font-weight: bold;
  color: var(--error-fg);
}

.button.duplicate_item {
  color: var(--button-fg) !important;
}

.button.remove_item {
  color: var(--error-fg) !important;
}

.button.remove_item:hover {
  color: #fff !important;
}

#add_empty_item_top, #add_empty_item_bottom {
  text-align: right;
}

/* Bookcopy edit images page */
#drop_images {
  border: 2px dashed var(--link-fg);
  border-radius: 5px;
  width: auto;
  padding: 20px;
  margin-bottom: 30px;
}

#drop_images.focused {
  border-color: var(--link-hover-color);
  background-color: var(--selected-row);
}

#import_inputs p {
  display: None;
}

#import_inputs label {
  padding: 5px 0 5px 15px;
}

/* Changelist right column */
#changelist-right-column {
  display: flex;
  flex-direction: column;
  flex: 0 0 240px;
  margin-left: 0px;
}

#changelist-right-column.large {
  flex: 0 0 350px;
}

@media (min-width: 768px) {
  #changelist-right-column {
    margin-left: 30px;
  }
}

@media (min-width: 768px) and (max-width: 992px) {
  #changelist-right-column {
    flex-basis: 200px !important;
  }
}

#changelist-filter {
  margin-left: 0 !important;
}

#changelist-tree {
  order: 2;
  background: var(--darkened-bg);
  margin-top: 30px;
}

#changelist-tree h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 5px 15px;
  margin-bottom: 12px;
  background: var(--secondary);
  color: var(--header-link-color);
}

#changelist-tree ul {
  padding: 0 15px 0 15px;
}

#changelist-tree > ul:last-child {
  padding : 0 0 15px 15px;
  margin: 5px 0;
}

#changelist-tree li {
  list-style-type: none;
}

#changelist-tree a, #changelist-tree p {
  color: var(--body-quiet-color);
}

#changelist-tree a:focus, #changelist-tree a:hover {
  color: var(--link-hover-color);
}
