html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* ==========================================================================
   TimeSheetEasy theming
   Default theme is "red-black" (red / black / white). Additional themes are
   selected by the user and applied via a data-theme attribute on <html>.
   ========================================================================== */

:root,
[data-theme="red-black"] {
  --tse-primary: #c8102e;
  --tse-primary-dark: #8f0c20;
  --tse-primary-contrast: #ffffff;
  --tse-bg: #f7f7f8;
  --tse-surface: #ffffff;
  --tse-text: #161616;
  --tse-text-muted: #5a5a5a;
  --tse-border: #dcdcdc;
  --tse-border-strong: #adadad;
  --tse-header-bg: #161616;
  --tse-header-text: #ffffff;
}

[data-theme="midnight-blue"] {
  --tse-primary: #1d4ed8;
  --tse-primary-dark: #1e3a8a;
  --tse-primary-contrast: #ffffff;
  --tse-bg: #f5f7fb;
  --tse-surface: #ffffff;
  --tse-text: #111827;
  --tse-text-muted: #6b7280;
  --tse-border: #dbe2ea;
  --tse-border-strong: #94a3b8;
  --tse-header-bg: #111827;
  --tse-header-text: #ffffff;
}

[data-theme="forest-green"] {
  --tse-primary: #15803d;
  --tse-primary-dark: #14532d;
  --tse-primary-contrast: #ffffff;
  --tse-bg: #f5f8f6;
  --tse-surface: #ffffff;
  --tse-text: #14201a;
  --tse-text-muted: #5c6b63;
  --tse-border: #d7e3db;
  --tse-border-strong: #86a892;
  --tse-header-bg: #14201a;
  --tse-header-text: #ffffff;
}

[data-theme="royal-violet"] {
  --tse-primary: #7c3aed;
  --tse-primary-dark: #5b21b6;
  --tse-primary-contrast: #ffffff;
  --tse-bg: #f7f6fb;
  --tse-surface: #ffffff;
  --tse-text: #1e1b2e;
  --tse-text-muted: #635e77;
  --tse-border: #e1def0;
  --tse-border-strong: #a996d1;
  --tse-header-bg: #1e1b2e;
  --tse-header-text: #ffffff;
}

[data-theme="slate-dark"] {
  --tse-primary: #e11d48;
  --tse-primary-dark: #9f1239;
  --tse-primary-contrast: #ffffff;
  --tse-bg: #0f172a;
  --tse-surface: #1e293b;
  --tse-text: #e2e8f0;
  --tse-text-muted: #94a3b8;
  --tse-border: #334155;
  --tse-border-strong: #64748b;
  --tse-header-bg: #020617;
  --tse-header-text: #e2e8f0;
}

body {
  background-color: var(--tse-bg);
  color: var(--tse-text);
}

a {
  color: var(--tse-primary);
}

a:hover {
  color: var(--tse-primary-dark);
}

.tse-navbar {
  background-color: var(--tse-header-bg) !important;
  border-bottom: 3px solid var(--tse-primary);
}

.tse-navbar .navbar-brand,
.tse-navbar .nav-link {
  color: var(--tse-header-text) !important;
}

.tse-navbar .nav-link:hover {
  color: var(--tse-primary) !important;
}

.tse-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.tse-brand img {
  height: 32px;
  width: 32px;
}

.btn-primary {
  background-color: var(--tse-primary);
  border-color: var(--tse-primary);
  color: var(--tse-primary-contrast);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--tse-primary-dark);
  border-color: var(--tse-primary-dark);
  color: var(--tse-primary-contrast);
}

.btn-secondary {
  background-color: transparent;
  border-color: var(--tse-border);
  color: var(--tse-text);
}

.btn-secondary:hover {
  background-color: var(--tse-border);
  color: var(--tse-text);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.data-table {
  background-color: var(--tse-surface);
}

.data-table thead th {
  border-bottom: 3px solid var(--tse-primary);
  color: var(--tse-text);
}

.row-actions a {
  margin-right: 0.75rem;
}

.row-actions .row-action-btn {
  background: none;
  border: none;
  padding: 0;
  margin-right: 0.75rem;
  color: var(--tse-primary);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

.row-actions .row-action-btn:hover {
  color: var(--tse-primary-dark);
}

.row-actions .row-action-btn:disabled {
  color: var(--tse-text-muted);
  text-decoration: none;
  cursor: default;
}

/* Bootstrap's .table hardcodes a near-black text/border color that doesn't
   follow our theme variables, so row data is unreadable against the dark
   surface in this theme even though the header row (.data-table thead th)
   already uses --tse-text. */
[data-theme="slate-dark"] .table {
  --bs-table-color: var(--tse-text);
  --bs-table-bg: transparent;
  --bs-table-striped-color: var(--tse-text);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.05);
  --bs-table-active-color: var(--tse-text);
  --bs-table-active-bg: rgba(255, 255, 255, 0.1);
  --bs-table-hover-color: var(--tse-text);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.075);
  color: var(--tse-text);
  border-color: var(--tse-border-strong);
}

.detail-list {
  background-color: var(--tse-surface);
  border: 1px solid var(--tse-border);
  border-radius: 0.5rem;
  padding: 1rem 1.5rem;
}

.detail-list dt {
  color: var(--tse-text-muted);
  font-weight: 600;
}

.detail-list dd {
  margin-bottom: 0.75rem;
}

.auth-card {
  max-width: 420px;
  margin: 2rem auto;
  background-color: var(--tse-surface);
  border: 1px solid var(--tse-border);
  border-radius: 0.5rem;
  padding: 2rem;
}

.form-hint {
  color: var(--tse-text-muted);
  font-size: 0.9rem;
}

.theme-swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.searchable-select {
  position: relative;
}

.searchable-select-menu {
  position: absolute;
  z-index: 1050;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  max-height: 220px;
  overflow-y: auto;
  background-color: var(--tse-surface);
  border: 1px solid var(--tse-border);
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.searchable-select-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.375rem 0.75rem;
  background: none;
  border: none;
  color: var(--tse-text);
  cursor: pointer;
}

.searchable-select-item:hover,
.searchable-select-item:focus {
  background-color: var(--tse-bg);
  color: var(--tse-primary);
  outline: none;
}

.searchable-select-empty {
  padding: 0.375rem 0.75rem;
  color: var(--tse-text-muted);
}

.month-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.month-nav-title {
  grid-column: 2;
  margin: 0;
  text-align: center;
}

.month-nav-prev {
  grid-column: 1;
  justify-self: start;
}

.month-nav-next {
  grid-column: 3;
  justify-self: end;
}

.month-view-table {
  background-color: var(--tse-surface);
  table-layout: fixed;
  border-color: var(--tse-border-strong);
}

.month-view-table th,
.month-view-table td {
  border-color: var(--tse-border-strong);
}

.month-view-table th {
  text-align: center;
  border-bottom: 3px solid var(--tse-primary);
}

.month-view-cell {
  height: 4.5rem;
  text-align: center;
  vertical-align: middle;
}

.month-view-table td.month-view-cell-today {
  background-color: color-mix(in srgb, var(--tse-surface) 90%, black);
}

.month-view-btn {
  background-color: color-mix(in srgb, var(--tse-primary) 18%, white);
  border-color: color-mix(in srgb, var(--tse-primary) 35%, white);
  color: var(--tse-primary-dark);
}

.month-view-btn:hover,
.month-view-btn:focus {
  background-color: color-mix(in srgb, var(--tse-primary) 30%, white);
  border-color: var(--tse-primary);
  color: var(--tse-primary-dark);
}

.month-view-day {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  padding: 0;
}

.month-view-day-has-data {
  font-size: 1.15em;
  font-weight: 700;
}

.month-view-hours {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--tse-text-muted);
}

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
}

.toast-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  color: #ffffff;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.25);
  animation: tse-toast-in 0.2s ease-out;
}

.toast-success {
  background-color: #198754;
}

.toast-error {
  background-color: #dc3545;
}

.toast-message {
  flex: 1;
  word-break: break-word;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

@keyframes tse-toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
