/* WEBVL CMS theme
   A layer on top of Bootstrap 4 that gives the CMS its own look.
   Loaded after all other stylesheets in templates/head.php, remove that link to go back to the plain Bootstrap look.

   There are two themes, chosen by the user in the user menu (cookie webvl_theme, set on <html data-theme="...">):
   - modern (default): the colours below
   - classic: the same shapes with the colours of the original Bootstrap look, see the end of this file */

:root {
  --ink: #0f172a;
  --nav: #0f172a;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-soft: #eef2f6;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --accent: #0369a1;
  --accent-hover: #075985;
  --accent-soft: #e0f2fe;
  --danger: #dc2626;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 0 0 1px var(--line);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, .25), 0 0 0 1px rgba(15, 23, 42, .06);
  --ring: 0 0 0 3px rgba(3, 105, 161, .18);
}

/* ---------- base ---------- */

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: .9375rem;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

h1, h2, h3, h4, h5 {
  color: var(--ink);
  letter-spacing: -.015em;
}

h1 {
  font-size: 1.65rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

h1.mt-5 {
  margin-top: 2rem !important;
}

h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: .9rem;
}

code {
  color: #9d174d;
  background: #fdf2f8;
  padding: .1em .35em;
  border-radius: 4px;
}

.text-muted {
  color: var(--muted) !important;
}

/* ---------- top menu ---------- */

.navbar.bg-dark {
  background-color: var(--nav) !important;
  padding-top: .45rem;
  padding-bottom: .45rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 4px 16px -8px rgba(15, 23, 42, .5);
}

.navbar-dark .navbar-brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .02em;
  margin-right: 1.5rem;
}

.navbar-dark .navbar-nav .nav-link {
  color: #cbd5e1;
  font-weight: 500;
  font-size: .9rem;
  padding: .4rem .7rem;
  border-radius: var(--radius);
  transition: background-color .15s, color .15s;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .show > .nav-link {
  color: #fff;
  background-color: rgba(255, 255, 255, .09);
}

.navbar-dark .navbar-nav .active > .nav-link {
  color: #fff;
  background-color: rgba(255, 255, 255, .14);
}

.navbar #active_site {
  background-color: rgba(255, 255, 255, .08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--radius);
  padding: .3rem .5rem;
  font-size: .85rem;
  max-width: 220px;
}

.navbar #active_site option {
  color: var(--text);
}

.dropdown-menu {
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: .4rem;
  font-size: .9rem;
}

.dropdown-item {
  border-radius: 6px;
  padding: .4rem .7rem;
  color: var(--text);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--surface-alt);
  color: var(--ink);
}

.dropdown-item.active,
.dropdown-item:active {
  background-color: var(--accent-soft);
  color: var(--accent);
}

.dropdown-header {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: .5rem .7rem .25rem;
}

#login-dp {
  padding: .4rem;
}

#login-dp .nav-link {
  border-radius: 6px;
}

#login-dp .nav-link:hover {
  background-color: var(--surface-alt);
}

/* ---------- buttons ---------- */

.btn {
  border-radius: var(--radius);
  font-weight: 500;
  font-size: .9rem;
  padding: .45rem .9rem;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}

.btn:focus,
.btn.focus {
  box-shadow: var(--ring) !important;
}

.btn-primary,
.btn-primary:not(:disabled):not(.disabled):active {
  background-color: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* secondary buttons are quiet: white with a border instead of a grey block */
.btn-secondary,
.btn-dark,
.btn-light,
.btn-default {
  background-color: var(--surface);
  border-color: #d0d5dd;
  color: var(--text);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-dark:hover,
.btn-dark:focus,
.btn-light:hover,
.btn-light:focus,
.btn-default:hover,
.btn-default:focus,
.btn-secondary:not(:disabled):not(.disabled):active,
.btn-dark:not(:disabled):not(.disabled):active {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--ink);
}

.btn-secondary.active,
.btn-secondary:not(:disabled):not(.disabled).active {
  background-color: var(--accent-soft);
  border-color: #bae6fd;
  color: var(--accent);
}

html:not([data-theme="classic"]) .btn-secondary i[style],
html:not([data-theme="classic"]) .btn-dark i[style] {
  color: inherit !important;
}

/* full width buttons in the filter also have the form-control class, keep the button colours */
.btn-primary.form-control,
.btn-primary.form-control:focus {
  color: #fff;
  background-color: var(--accent);
}

.btn-secondary.form-control:focus {
  background-color: #f1f5f9;
}

.btn.float-right {
  margin-bottom: .35rem;
}

.btn-danger {
  background-color: var(--danger);
  border-color: var(--danger);
}

.btn-outline-secondary {
  border-color: #d0d5dd;
  color: var(--muted);
}

/* ---------- forms ---------- */

label {
  font-weight: 500;
  font-size: .875rem;
  color: #334155;
  margin-bottom: .3rem;
}

.form-control,
.custom-select {
  border-radius: var(--radius);
  border-color: #d0d5dd;
  color: var(--text);
  font-size: .9375rem;
}

.form-control:focus,
.custom-select:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control:disabled,
.form-control[readonly] {
  background-color: var(--surface-alt);
}

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

.input-group-text {
  background-color: var(--surface-alt);
  border-color: #d0d5dd;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
}

.input-group > .input-group-prepend > .input-group-text {
  border-radius: var(--radius) 0 0 var(--radius);
}

.form-text {
  font-size: .8rem;
}

/* ---------- tables ---------- */

.table {
  background-color: var(--surface);
  color: var(--text);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.table thead th {
  background-color: var(--surface-alt);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  padding: .65rem .9rem;
  vertical-align: middle;
}

.table td,
.table tbody th,
.table tfoot th {
  border-top: 1px solid var(--line-soft);
  padding: .65rem .9rem;
  vertical-align: middle;
}

.table tbody th {
  font-weight: 600;
  color: var(--ink);
}

.table > tbody:first-child > tr:first-child > th,
.table > tbody:first-child > tr:first-child > td,
.table > tr:first-child > th,
.table > tr:first-child > td {
  border-top: 0;
}

/* rounded corners, a table does not clip its cells */
.table thead:first-child tr:first-child th:first-child,
.table > tbody:first-child > tr:first-child > *:first-child {
  border-top-left-radius: var(--radius-lg);
}

.table thead:first-child tr:first-child th:last-child,
.table > tbody:first-child > tr:first-child > *:last-child {
  border-top-right-radius: var(--radius-lg);
}

.table > tbody:last-child > tr:last-child > *:first-child,
.table > tfoot:last-child > tr:last-child > *:first-child {
  border-bottom-left-radius: var(--radius-lg);
}

.table > tbody:last-child > tr:last-child > *:last-child,
.table > tfoot:last-child > tr:last-child > *:last-child {
  border-bottom-right-radius: var(--radius-lg);
}

#webvlTable tbody tr:hover,
.settings-sortable tr[data-id]:hover,
.tables-sortable tr[data-id]:hover {
  background-color: var(--surface-alt);
}

/* group rows in the settings lists (tabs, menu items) */
.table .table-secondary,
.table .table-secondary > th,
.table .table-secondary > td {
  background-color: #eef2f7;
  color: var(--ink);
  border-color: var(--line);
}

.table .table-light,
.table .table-light > th,
.table .table-light > td {
  background-color: var(--surface-alt);
  border-color: var(--line);
}

.table .table-secondary > th,
.table .table-light > th {
  font-size: .8rem;
  letter-spacing: .02em;
}

/* action icons: one quiet colour, the meaning shows on hover */
html:not([data-theme="classic"]) .table td a > i[class*="fa-"],
html:not([data-theme="classic"]) .table th a > i[class*="fa-"],
html:not([data-theme="classic"]) .table td a > span[class*="fa-"] {
  color: #64748b !important;
  padding: .15rem .2rem;
  transition: color .15s;
}

html:not([data-theme="classic"]) .table td a:hover > i[class*="fa-"],
html:not([data-theme="classic"]) .table th a:hover > i[class*="fa-"] {
  color: var(--accent) !important;
}

html:not([data-theme="classic"]) .table td a:hover > i.fa-trash-alt {
  color: var(--danger) !important;
}

html:not([data-theme="classic"]) .table td a > i.fa-check-square {
  color: var(--accent) !important;
}

.sort-handle {
  color: var(--muted);
}

.ui-sortable-helper {
  background-color: var(--surface);
  box-shadow: var(--shadow-lg);
}

/* overview table with DataTables (its stylesheet is loaded later, so these need the id) */
#webvlTable.dataTable thead th,
#webvlTable.dataTable thead td {
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--line);
}

#webvlTable.dataTable.no-footer {
  border-bottom: 0;
}

#webvlTable .sort-asc a.active,
#webvlTable .sort-desc a.active {
  color: var(--accent);
}

#webvlTable .sort-asc a,
#webvlTable .sort-desc a {
  color: #cbd5e1;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  font-size: .85rem;
  color: var(--muted);
}

/* ---------- cards, filter, tiles ---------- */

.card {
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card-header {
  background-color: var(--surface);
  border-bottom: 1px solid var(--line-soft);
}

.card > .card-header:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

#filter {
  margin-bottom: 1rem;
}

html:not([data-theme="classic"]) #headingFilter {
  background-color: var(--surface) !important;
  border-radius: var(--radius-lg) !important;
}

html:not([data-theme="classic"]) #headingFilter .btn-link {
  color: var(--text) !important;
}

#headingFilter .btn-link {
  font-weight: 600;
  text-decoration: none;
  padding: .7rem 1rem;
}

#headingFilter .btn-link:focus {
  box-shadow: none !important;
}

html:not([data-theme="classic"]) #headingFilter i {
  color: var(--muted) !important;
}

#headingFilter i {
  margin-right: .25rem;
}

.tile {
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
}

.tile h2 {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: .5rem;
}

.tile a {
  color: var(--ink);
}

.tile a:hover {
  color: var(--accent);
  text-decoration: none;
}

.tile ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
}

.tile li {
  padding: .15rem 0;
}

.tile li a {
  color: var(--muted);
}

/* ---------- messages ---------- */

.alert {
  border: 0;
  border-radius: var(--radius);
  font-size: .9rem;
}

/* the empty container for notifications should not take space */
#alerts.alert {
  padding: 0;
  margin-bottom: 0;
}

.alert-success {
  background-color: #ecfdf5;
  color: #065f46;
  box-shadow: inset 3px 0 0 #10b981;
}

.alert-danger,
.alert-failed {
  background-color: #fef2f2;
  color: #991b1b;
  box-shadow: inset 3px 0 0 var(--danger);
}

.alert-warning {
  background-color: #fffbeb;
  color: #92400e;
  box-shadow: inset 3px 0 0 #f59e0b;
}

.alert-secondary {
  background-color: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.alert-info {
  background-color: var(--accent-soft);
  color: var(--accent-hover);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* ---------- dialogs ---------- */

.modal-content {
  border: 0;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
  padding: 1rem 1.25rem;
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  border-top: 1px solid var(--line-soft);
  padding: .85rem 1.25rem;
}

.modal-backdrop.show {
  opacity: .45;
  background-color: var(--ink);
}

/* ---------- tabs on the record form ---------- */

.nav-tabs {
  border-bottom: 1px solid var(--line);
}

.nav-tabs .nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  font-weight: 500;
  padding: .6rem 1rem;
}

.nav-tabs .nav-link:hover {
  color: var(--ink);
  border-bottom-color: #cbd5e1;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
  color: var(--accent);
  background-color: transparent;
  border-bottom-color: var(--accent);
}

/* ---------- login ---------- */

body > .container.login-page {
  max-width: 420px;
  margin-top: 14vh;
  padding: 2rem 2rem 1.25rem;
  background-color: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.login-page h1.mt-5 {
  margin-top: 0 !important;
}

.login-page .btn-primary {
  width: 100%;
  padding: .6rem;
}

.login-page p {
  margin-top: 1rem;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
}

/* ---------- calendar ---------- */

#webvl-calendar {
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1rem;
  --fc-border-color: var(--line);
  --fc-today-bg-color: #f0f9ff;
  --fc-event-bg-color: var(--accent);
  --fc-event-border-color: var(--accent);
  --fc-button-bg-color: var(--surface);
  --fc-button-border-color: #d0d5dd;
  --fc-button-text-color: var(--text);
  --fc-button-hover-bg-color: #f1f5f9;
  --fc-button-hover-border-color: #cbd5e1;
  --fc-button-active-bg-color: var(--accent-soft);
  --fc-button-active-border-color: #bae6fd;
  --fc-list-event-hover-bg-color: var(--surface-alt);
  --fc-neutral-bg-color: var(--surface-alt);
}

#webvl-calendar .fc-button {
  border-radius: var(--radius);
  font-weight: 500;
  font-size: .875rem;
  text-transform: capitalize;
  box-shadow: none !important;
}

#webvl-calendar .fc-button-group > .fc-button:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

#webvl-calendar .fc-button-group > .fc-button:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

#webvl-calendar .fc-button-primary:not(:disabled).fc-button-active,
#webvl-calendar .fc-button-primary:not(:disabled):active {
  color: var(--accent);
}

#webvl-calendar .fc-toolbar-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
}

#webvl-calendar .fc-col-header-cell-cushion {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: .5rem;
}

#webvl-calendar .fc-daygrid-day-number,
#webvl-calendar .fc-list-day-text,
#webvl-calendar .fc-list-day-side-text {
  color: var(--text);
}

#webvl-calendar .fc-event {
  border-radius: 5px;
}

/* ---------- other ---------- */

.footer {
  background-color: transparent;
  border-top: 1px solid var(--line);
  font-size: .8rem;
}

.CodeMirror {
  border-radius: var(--radius) !important;
  border-color: #d0d5dd !important;
}

.lang {
  border-color: var(--line);
  color: var(--muted);
  font-weight: 600;
}

.multiselect.dropdown-toggle {
  text-align: left;
}

.daterangepicker {
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-family: inherit;
}

.daterangepicker td.active,
.daterangepicker td.active:hover,
.daterangepicker .ranges li.active {
  background-color: var(--accent);
}

@media (max-width: 600px) {
  #webvlTable.table tr {
    border-bottom: 1px solid var(--line);
  }

  body > .container.login-page {
    margin-top: 2rem;
  }
}

/* ---------- classic theme: the colours of the original look ---------- */

html[data-theme="classic"] {
  --ink: #212529;
  --nav: #343a40;
  --text: #212529;
  --muted: #6c757d;
  --line: #dee2e6;
  --line-soft: #e9ecef;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f8f9fa;
  --accent: #007bff;
  --accent-hover: #0069d9;
  --accent-soft: #e7f1ff;
  --danger: #dc3545;
  --ring: 0 0 0 3px rgba(0, 123, 255, .25);
}

/* grey secondary buttons and a dark paging button, as before */
html[data-theme="classic"] .btn-secondary,
html[data-theme="classic"] .btn-secondary.form-control:focus {
  background-color: #6c757d;
  border-color: #6c757d;
  color: #fff;
}

html[data-theme="classic"] .btn-secondary:hover,
html[data-theme="classic"] .btn-secondary:focus,
html[data-theme="classic"] .btn-secondary:not(:disabled):not(.disabled):active {
  background-color: #5a6268;
  border-color: #545b62;
  color: #fff;
}

html[data-theme="classic"] .btn-secondary.active,
html[data-theme="classic"] .btn-secondary:not(:disabled):not(.disabled).active {
  background-color: #343a40;
  border-color: #343a40;
  color: #fff;
}

html[data-theme="classic"] .btn-dark {
  background-color: #343a40;
  border-color: #343a40;
  color: #fff;
}

html[data-theme="classic"] .btn-dark:hover,
html[data-theme="classic"] .btn-dark:focus {
  background-color: #23272b;
  border-color: #1d2124;
  color: #fff;
}

html[data-theme="classic"] label {
  color: #212529;
}

html[data-theme="classic"] .table .table-secondary,
html[data-theme="classic"] .table .table-secondary > th,
html[data-theme="classic"] .table .table-secondary > td {
  background-color: #e9ecef;
}

html[data-theme="classic"] #headingFilter {
  border-radius: var(--radius-lg) !important;
}

html[data-theme="classic"] #webvl-calendar {
  --fc-today-bg-color: #fff9e6;
  --fc-button-active-border-color: #b8d4ff;
}

html[data-theme="classic"] .alert-secondary {
  background-color: #e2e3e5;
  color: #383d41;
  box-shadow: none;
}

/* the theme switch in the user menu */
.theme-switch .theme-current {
  font-weight: 600;
}
