/**
 * Arkivmappen Theme Overrides
 * Warm palette matching the landing page design.
 * Loaded after tabler.min.css to override Tabler's defaults.
 */

/* ─── FONTS ─── */
:root {
  --tblr-font-sans-serif: 'Manrope', -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
  --tblr-body-font-family: var(--tblr-font-sans-serif);
}

/* ─── LIGHT MODE (default) ─── */
:root,
[data-bs-theme="light"] {
  /* Primary = forest green */
  --tblr-primary: #2D6A4F;
  --tblr-primary-rgb: 45, 106, 79;
  --tblr-primary-text-emphasis: #1B4332;
  --tblr-primary-bg-subtle: rgba(27, 67, 50, 0.08);
  --tblr-primary-border-subtle: rgba(45, 106, 79, 0.25);

  /* Links */
  --tblr-link-color: #2D6A4F;
  --tblr-link-color-rgb: 45, 106, 79;
  --tblr-link-hover-color: #40916C;

  /* Backgrounds - warm beige */
  --tblr-body-bg: #F5F1EB;
  --tblr-body-bg-rgb: 245, 241, 235;

  /* Surfaces - warm whites */
  --tblr-bg-surface: #FFFCF7;
  --tblr-bg-surface-primary: #FFFCF7;
  --tblr-bg-surface-secondary: #F5F1EB;
  --tblr-bg-surface-tertiary: #EDE8DF;
  --tblr-bg-surface-dark: #1C1917;
  --tblr-bg-surface-inverted: #1C1917;
  --tblr-white: #FFFCF7;
  --tblr-gray-50: #F5F1EB;

  /* Text - warm stone */
  --tblr-body-color: #1C1917;
  --tblr-body-color-rgb: 28, 25, 23;
  --tblr-secondary-color: rgba(28, 25, 23, 0.65);
  --tblr-secondary-color-rgb: 28, 25, 23;
  --tblr-muted: #78716C;
  --tblr-muted-rgb: 120, 113, 108;
  --tblr-secondary: #78716C;
  --tblr-secondary-rgb: 120, 113, 108;
  --tblr-secondary-bg: #EDE8DF;
  --tblr-secondary-bg-rgb: 237, 232, 223;

  /* Borders - warm translucent */
  --tblr-border-color: rgba(28, 25, 23, 0.12);
  --tblr-border-color-translucent: rgba(28, 25, 23, 0.08);

  /* Cards */
  --tblr-card-bg: #FFFCF7;
  --tblr-card-border-color: rgba(28, 25, 23, 0.08);
  --tblr-card-cap-bg: #F5F1EB;

  /* Active / hover states */
  --tblr-active-bg: rgba(45, 106, 79, 0.06);

  /* Info color - warm green instead of blue */
  --tblr-info: #2D6A4F;
  --tblr-info-rgb: 45, 106, 79;
  --tblr-info-text-emphasis: #1B4332;
  --tblr-info-bg-subtle: rgba(45, 106, 79, 0.08);
  --tblr-info-border-subtle: rgba(45, 106, 79, 0.25);

  /* Page loading bg */
  --tblr-page-bg: #F5F1EB;
}

/* ─── DARK MODE ─── */
[data-bs-theme="dark"] {
  /* Primary green - slightly lighter for dark bg */
  --tblr-primary: #40916C;
  --tblr-primary-rgb: 64, 145, 108;
  --tblr-primary-text-emphasis: #52B788;
  --tblr-primary-bg-subtle: rgba(64, 145, 108, 0.12);
  --tblr-primary-border-subtle: rgba(64, 145, 108, 0.3);

  /* Links */
  --tblr-link-color: #52B788;
  --tblr-link-color-rgb: 82, 183, 136;
  --tblr-link-hover-color: #74C69D;

  /* Backgrounds - dark green */
  --tblr-body-bg: #0F1F18;
  --tblr-body-bg-rgb: 15, 31, 24;

  /* Surfaces - dark green */
  --tblr-bg-surface: #162920;
  --tblr-bg-surface-primary: #162920;
  --tblr-bg-surface-secondary: #0F1F18;
  --tblr-bg-surface-tertiary: #1B3228;
  --tblr-bg-surface-inverted: #F5F1EB;
  --tblr-gray-50: #0F1F18;

  /* Text */
  --tblr-body-color: #E7E5E4;
  --tblr-body-color-rgb: 231, 229, 228;
  --tblr-secondary-color: rgba(231, 229, 228, 0.65);
  --tblr-secondary-color-rgb: 231, 229, 228;
  --tblr-muted: #A8A29E;
  --tblr-muted-rgb: 168, 162, 158;
  --tblr-secondary: #A8A29E;
  --tblr-secondary-rgb: 168, 162, 158;
  --tblr-secondary-bg: #1B3228;
  --tblr-secondary-bg-rgb: 27, 50, 40;

  /* Borders - dark green */
  --tblr-border-color: #2A4A3A;
  --tblr-border-color-translucent: rgba(82, 183, 136, 0.1);

  /* Cards - dark green */
  --tblr-card-bg: #162920;
  --tblr-card-border-color: #2A4A3A;
  --tblr-card-cap-bg: #1B3228;

  /* Info color */
  --tblr-info: #40916C;
  --tblr-info-rgb: 64, 145, 108;
  --tblr-info-text-emphasis: #52B788;
  --tblr-info-bg-subtle: rgba(64, 145, 108, 0.12);
  --tblr-info-border-subtle: rgba(64, 145, 108, 0.3);
}

/* ─── BUTTON OVERRIDES ─── */
.btn-primary,
.bg-primary {
  --tblr-primary: #2D6A4F;
  --tblr-primary-rgb: 45, 106, 79;
}

.btn-primary {
  --tblr-btn-bg: #2D6A4F;
  --tblr-btn-border-color: #2D6A4F;
  --tblr-btn-hover-bg: #40916C;
  --tblr-btn-hover-border-color: #40916C;
  --tblr-btn-active-bg: #1B4332;
  --tblr-btn-active-border-color: #1B4332;
  --tblr-btn-focus-shadow-rgb: 45, 106, 79;
  --tblr-btn-color: #fff;
  --tblr-btn-hover-color: #fff;
  --tblr-btn-active-color: #fff;
}

.btn-outline-primary {
  --tblr-btn-color: #2D6A4F;
  --tblr-btn-border-color: #2D6A4F;
  --tblr-btn-hover-bg: #2D6A4F;
  --tblr-btn-hover-border-color: #2D6A4F;
  --tblr-btn-hover-color: #fff;
  --tblr-btn-active-bg: #1B4332;
  --tblr-btn-active-border-color: #1B4332;
  --tblr-btn-active-color: #fff;
  --tblr-btn-focus-shadow-rgb: 45, 106, 79;
}

.btn-ghost-primary {
  --tblr-btn-color: #2D6A4F;
  --tblr-btn-hover-bg: rgba(45, 106, 79, 0.08);
  --tblr-btn-hover-color: #2D6A4F;
  --tblr-btn-active-bg: rgba(45, 106, 79, 0.12);
  --tblr-btn-active-color: #1B4332;
}

.btn-info {
  --tblr-btn-bg: #2D6A4F;
  --tblr-btn-border-color: #2D6A4F;
  --tblr-btn-hover-bg: #40916C;
  --tblr-btn-hover-border-color: #40916C;
  --tblr-btn-active-bg: #1B4332;
  --tblr-btn-active-border-color: #1B4332;
  --tblr-btn-focus-shadow-rgb: 45, 106, 79;
  --tblr-btn-color: #fff;
  --tblr-btn-hover-color: #fff;
  --tblr-btn-active-color: #fff;
}

.btn-outline-info {
  --tblr-btn-color: #2D6A4F;
  --tblr-btn-border-color: #2D6A4F;
  --tblr-btn-hover-bg: #2D6A4F;
  --tblr-btn-hover-border-color: #2D6A4F;
  --tblr-btn-hover-color: #fff;
  --tblr-btn-active-bg: #1B4332;
  --tblr-btn-active-border-color: #1B4332;
  --tblr-btn-active-color: #fff;
  --tblr-btn-focus-shadow-rgb: 45, 106, 79;
}

/* Background utility overrides */
.bg-primary {
  background-color: #2D6A4F !important;
}

.bg-primary-lt {
  background-color: rgba(45, 106, 79, 0.08) !important;
  color: #2D6A4F !important;
}

.text-primary {
  color: #2D6A4F !important;
}

[data-bs-theme="dark"] .text-primary {
  color: #52B788 !important;
}

[data-bs-theme="dark"] .bg-primary-lt {
  background-color: rgba(64, 145, 108, 0.12) !important;
  color: #52B788 !important;
}

/* ─── SPINNER OVERRIDE ─── */
.spinner-border.text-primary {
  color: #2D6A4F !important;
}

[data-bs-theme="dark"] .spinner-border.text-primary {
  color: #52B788 !important;
}

/* ─── PAGE LOADING OVERLAY ─── */
.page-loading-overlay {
  background: var(--tblr-body-bg, #F5F1EB);
}

/* ─── HEADING FONT ─── */
.page-title,
h1, h2, h3,
.card-title,
.modal-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* Keep smaller UI text in sans-serif */
h4, h5, h6,
.subheader,
.card-header .card-title {
  font-family: var(--tblr-font-sans-serif);
}

/* ─── CARD REFINEMENTS ─── */
.card {
  border-radius: 12px;
  border-color: var(--tblr-card-border-color);
}

.card-header {
  background-color: var(--tblr-card-cap-bg);
}

/* ─── FORM FOCUS ─── */
.form-control:focus,
.form-select:focus {
  border-color: #2D6A4F;
  box-shadow: 0 0 0 0.25rem rgba(45, 106, 79, 0.15);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  border-color: #40916C;
  box-shadow: 0 0 0 0.25rem rgba(64, 145, 108, 0.2);
}

/* ─── NAV / NAVBAR ─── */
.navbar-brand {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

/* ─── BADGE PRIMARY ─── */
.badge.bg-primary {
  background-color: #2D6A4F !important;
}

[data-bs-theme="dark"] .badge.bg-primary {
  background-color: #40916C !important;
}

/* ─── FORM SWITCH / CHECK ─── */
.form-check-input:checked {
  background-color: #2D6A4F;
  border-color: #2D6A4F;
}

[data-bs-theme="dark"] .form-check-input:checked {
  background-color: #40916C;
  border-color: #40916C;
}

/* ─── DROPDOWN ACTIVE ─── */
.dropdown-item.active,
.dropdown-item:active {
  background-color: rgba(45, 106, 79, 0.08);
  color: #2D6A4F;
}

[data-bs-theme="dark"] .dropdown-item.active,
[data-bs-theme="dark"] .dropdown-item:active {
  background-color: rgba(64, 145, 108, 0.12);
  color: #52B788;
}

/* ─── TABLE ROW HOVER ─── */
.table-hover > tbody > tr:hover {
  --tblr-table-hover-bg: rgba(45, 106, 79, 0.04);
}

[data-bs-theme="dark"] .table-hover > tbody > tr:hover {
  --tblr-table-hover-bg: rgba(64, 145, 108, 0.06);
}

/* ─── PAGINATION ─── */
.page-item.active .page-link {
  background-color: #2D6A4F;
  border-color: #2D6A4F;
}

/* ─── NAV PILLS / TABS ─── */
.nav-pills .nav-link.active {
  background-color: #2D6A4F;
}

.nav-tabs .nav-link.active {
  border-bottom-color: #2D6A4F;
  color: #2D6A4F;
}

/* ─── PROGRESS BAR ─── */
.progress-bar {
  background-color: #2D6A4F;
}

/* ─── GRAIN TEXTURE (matches landing page) ─── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

[data-bs-theme="dark"] body::after {
  opacity: 0.015;
}

/* ─── SELECTION COLOR ─── */
::selection {
  background: rgba(45, 106, 79, 0.2);
}

[data-bs-theme="dark"] ::selection {
  background: rgba(82, 183, 136, 0.25);
}

/* ─── SCROLLBAR (subtle warm tint) ─── */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(28, 25, 23, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(28, 25, 23, 0.25);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(82, 183, 136, 0.15);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(82, 183, 136, 0.25);
}
