/*
 * Bliblib — warm cream & teal scholarly colour scheme.
 *
 * Cream backgrounds, deep burgundy text, teal accents, coral highlights.
 * No strong borders — elements are discernable through contrast.
 * Sans-serif throughout; rounded corners (0.75em).
 */

:root {
  /* Palette */
  --bl-bg:              #dfd6c6;
  --bl-bg-light:        #f0ebe2;
  --bl-bg-white:        #ffffff;
  --bl-bg-dark:         #c2abab;
  --bl-text:            #4e2828;
  --bl-text-light:      #562c2c;
  --bl-primary:         #127475;
  --bl-primary-light:   #59b4b4;
  --bl-primary-subtle:  #82baa8;
  --bl-secondary:       #2e000e;
  --bl-danger:          #b4300f;  
  --bl-success:         #0e9594;
  --bl-muted:           #8a7262;

  /* Sizing */
  --bl-radius:          0.5em;
  --bl-shadow:          none;
}

/* ── Global ─────────────────────────────────────────────── */

body {
  font-family: sans-serif;
  background-color: var(--bl-bg);
  color: var(--bl-text);
}

a {
  color: var(--bl-secondary);
  text-decoration: none;
}
a:hover {
  color: var(--bl-primary);
}

/* ── Navbar ─────────────────────────────────────────────── */

.navbar {
  background-color: var(--bl-bg-light);
  box-shadow: var(--bl-shadow);
  border: none;
}
.navbar-brand {
  color: var(--bl-text) !important;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}
.nav-link {
  color: var(--bl-text-light) !important;
}
.nav-link:hover {
  color: var(--bl-primary) !important;
}

/* ── Cards ──────────────────────────────────────────────── */

.card, .bl-card {
  background-color: var(--bl-bg-light);
  border: none;
  border-radius: var(--bl-radius);
  box-shadow: var(--bl-shadow);
  transition: box-shadow 0.2s ease;
}
.card:hover, .bl-card:hover {
  box-shadow: var(--bl-shadow);
}



/* ── Toolbars ───────────────────────────────────────────── */

.toolbar {
  /* gradient background */  
  background-color: var(--bl-bg-dark);
  position: sticky;
  padding: 0.5em 1em;
}

/* ── Buttons ────────────────────────────────────────────── */

.btn-primary, .btn-bl {
  background-color: var(--bl-primary);
  border: none;
  color: #fff;
}
.btn-primary:hover, .btn-bl:hover {
  background-color: var(--bl-secondary);
  color: #fff;
}

.btn-outline-primary, .btn-bl-outline {
  border: none;
  color: var(--bl-primary);
  background-color: var(--bl-bg-white);
}
.btn-outline-primary:hover, .btn-bl-outline:hover {
  background-color: var(--bl-primary);
  color: #fff;
}

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

.btn-success {
  background-color: var(--bl-success);
  border: none;
}

.btn:disabled {
  background-color: var(--bl-muted);
  border: none;
  color: #fff;
}

/* ── Forms ──────────────────────────────────────────────── */

.form-control, .form-select {
  background-color: var(--bl-bg-light);
  border: none;
  border-radius: var(--bl-radius);
  color: var(--bl-text);
}
.form-control:focus, .form-select:focus {
  border: none;
  outline: none;
}

.input-light {
  background-color: var(--bl-bg-white);
  border: none;
  border-radius: var(--bl-radius);
  color: var(--bl-text);
}

/* ── Badges ─────────────────────────────────────────────── */


.badge.bg-accent {
  background-color: var(--bl-primary) !important;
  color: #fff;
}

.badge.bg-tag {
  background-color: var(--bl-bg-white);
  color: var(--bl-text-light);
}

/* ── Status indicators ──────────────────────────────────── */

.status-pending    { color: var(--bl-muted);   }
.status-processing { color: var(--bl-primary); }
.status-completed  { color: var(--bl-success); }
.status-failed     { color: var(--bl-danger);  }

.spin {
  animation: bl-spin 1s linear infinite;
}
@keyframes bl-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Reference list ─────────────────────────────────────── */

.ref-item {
  padding: 1em 1.25em;
  margin-bottom: 0.75em;
  background-color: var(--bl-bg-light);
  border-radius: var(--bl-radius);
  box-shadow: var(--bl-shadow);
  transition: box-shadow 0.2s ease;
}
.ref-item:hover {
  box-shadow: var(--bl-shadow);
}

/* ── Copy button feedback ───────────────────────────────── */

.copy-btn.copied {
  background-color: var(--bl-success) !important;
  color: #fff !important;
}

/* ── Pagination ─────────────────────────────────────────── */

.page-link {
  color: var(--bl-secondary);
  border: none;
  border-radius: var(--bl-radius);
  background: transparent;
}
.page-link:hover {
  background-color: var(--bl-primary-subtle);
  color: var(--bl-text);
}
.page-item.active .page-link {
  background-color: var(--bl-primary);
  color: #fff;
}

/* ── Alert overrides ────────────────────────────────────── */

.alert {
  border: none;
  border-radius: var(--bl-radius);
}

/* ── Utility ────────────────────────────────────────────── */

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

.bl-section-title {
  color: var(--bl-text);
}

/* ── Drop zone ──────────────────────────────────────────── */

.drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  border: 3px dashed var(--bl-primary-subtle);
  border-radius: var(--bl-radius);
  background-color: var(--bl-bg-light);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
  text-align: center;
  position: relative;
}
.drop-zone:hover {
  border-color: var(--bl-primary);
  background-color: var(--bl-bg);
  box-shadow: var(--bl-shadow);
}
.drop-zone--over {
  border-color: var(--bl-primary);
  background-color: var(--bl-primary-subtle);
  box-shadow: var(--bl-shadow);
}
.drop-zone__prompt {
  color: var(--bl-text-light);
  padding: 2rem;
}
.drop-zone__icon {
  color: var(--bl-primary);
}
.drop-zone__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.file-row {
  background-color: var(--bl-bg-light);
  border-radius: var(--bl-radius);
  border: none;
  box-shadow: var(--bl-shadow);
}

/* ── Login hero ─────────────────────────────────────────── */

.login-hero {
  position: relative;
  width: 100%;
  max-height: 450px;
  overflow: hidden;
  border-radius: var(--bl-radius);
  box-shadow: var(--bl-shadow);
}
.login-hero__img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  max-height: 450px;
}
.login-hero__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    to bottom,
    rgba(78, 40, 40, 0.25) 0%,
    rgba(78, 40, 40, 0.65) 100%
  );
}
.login-hero__title {
  color: var(--bl-bg-light);
  font-size: 6rem;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  margin: 0;
  letter-spacing: 0.02em;
}
.login-hero__subtitle {
  color: var(--bl-bg-light);
  font-weight: 800;
  font-size: 2rem;
  margin-top: 0.25em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

@media (max-width: 768px) {
  .login-hero {
    max-height: 220px;
  }
  .login-hero__img {
    max-height: 220px;
  }
  .login-hero__title {
    font-size: 3rem;
  }
  .login-hero__subtitle {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .login-hero {
    max-height: 160px;
    border-radius: 0;
  }
  .login-hero__img {
    max-height: 160px;
  }
  .login-hero__title {
    font-size: 2rem;
  }
  .login-hero__subtitle {
    font-size: 0.85rem;
  }
}

/* ── Layout helpers ─────────────────────────────────────── */

.bl-inline-group {
  max-width: 300px;
}

.bl-card-narrow {
  max-width: 600px;
}

.bl-card-dark {
  background-color: var(--bl-bg-white);
}

.bl-separator {
  border-bottom: 1px solid var(--bl-primary-subtle);
}


/* ── Tables ─────────────────────────────────────────────── */

.table-wrapper {
  border-radius: var(--bl-radius);
  overflow: hidden;
}

.table {
  background-color: var(--bl-bg-light);
  border: none;
  margin-bottom: 0;
}
.table th,
.table td,
.table thead,
.table tbody,
.table tr {
  border: none !important;
  background-color: inherit;
  color: inherit;
}

/* ── Tag widget ─────────────────────────────────────────── */

.tag-widget {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em;
  background-color: none;
  border-radius: var(--bl-radius);
  padding: 0.375rem 0.55rem;
  min-height: 2.4em;
  cursor: text;
  position: relative;
}

.tag-widget__badges {
  display: contents;
}

.tag-widget__input {
  border: none;
  border-radius: 0.2em;
  background: #fff;
  outline: none;
  color: var(--bl-text);
  font-size: inherit;
  flex: 1 1 6em;
  min-width: 6em;
  padding: .35em;
}
.tag-widget__input::placeholder {
  color: var(--bl-muted);
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  border-radius: 1em;
  font-weight: normal;
  padding: 0.25em 0.65em;
  font-size: 0.85em;
  line-height: 1.4;
  white-space: nowrap;
}

.tag-badge__remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1em;
  line-height: 1;
  padding: 0;
  color: inherit;
  opacity: 0.6;
}
.tag-badge__remove:hover {
  opacity: 1;
}

/* ── Tag autocomplete dropdown ──────────────────────────── */

.tag-widget__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  background-color: var(--bl-bg-light);
  border-radius: 0 0 var(--bl-radius) var(--bl-radius);
  box-shadow: var(--bl-shadow);
  max-height: 200px;
  overflow-y: auto;
}

.tag-widget__dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.45em 0.75em;
  cursor: pointer;
  color: var(--bl-text);
}
.tag-widget__dropdown-item:hover,
.tag-widget__dropdown-item.active {
  background-color: var(--bl-bg-white);
}

.tag-widget__swatch {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  border-radius: 50%;
  flex-shrink: 0;
}

.tag-widget--inline {
  max-width: 300px;
  min-height: auto;
  padding: 0.25rem 0.45rem;
  font-size: 0.875rem;
}

/* Responsive width utilities missing from Bootstrap */
@media (min-width: 768px) {
  .w-md-auto {
    width: auto !important;
  }
}

/* Inputs */

.

/* ── PDF Viewer Modal ───────────────────────────────────── */

.pdf-viewer-dialog {
  margin: 0;
}

.pdf-viewer-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bl-bg-light);
  border: none;
  overflow: hidden;
}

.pdf-viewer-toolbar {
  background: var(--bl-bg-dark);
  border-bottom: none;
}

.pdf-viewer-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bl-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.pdf-viewer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--bl-text);
  padding: 0.3rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.pdf-viewer-btn:hover {
  background: var(--bl-bg-light);
  border-color: var(--bl-primary-subtle);
}

.pdf-viewer-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #525659;
}

.pdf-viewer-frame {
  width: 100%;
  height: 100%;
  border: none;
}

.pdf-viewer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 0.95rem;
}

.pdf-viewer-loading[hidden] {
  display: none;
}

.pdf-viewer-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--bl-primary-light);
  border-radius: 50%;
  animation: pdfSpin 0.7s linear infinite;
  margin-bottom: 0.75rem;
}

@keyframes pdfSpin {
  to { transform: rotate(360deg); }
}