/* ================================================================
   TilbudsBooster — Custom Theme
   Primary: #2D6A4F  (Forest Green / Sage)
   ================================================================ */

:root {
  --tb-green:        #2D6A4F;
  --tb-green-dark:   #1B4332;
  --tb-green-mid:    #40916C;
  --tb-green-light:  #52B788;
  --tb-green-pale:   #D8F3DC;
  --tb-green-ghost:  #F0FAF4;

  --tb-sidebar-bg:   #1B4332;
  --tb-sidebar-text: #95D5B2;
  --tb-sidebar-w:    260px;

  --tb-body-bg:      #F4F8F6;
  --tb-card-bg:      #FFFFFF;
  --tb-border:       #DDE8E3;
  --tb-text:         #1C2B24;
  --tb-muted:        #6B8077;

  --tb-shadow-sm:    0 1px 4px rgba(45, 106, 79, 0.08);
  --tb-shadow:       0 2px 16px rgba(45, 106, 79, 0.12);
  --tb-radius:       10px;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  position: relative;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background: var(--tb-body-bg);
  color: var(--tb-text);
  margin: 0;
  line-height: 1.65;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--tb-sidebar-w);
  height: 100vh;
  background: var(--tb-sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 1.75rem 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand a {
  color: #FFFFFF;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.02em;
  background: transparent;
}

.sidebar-brand a:hover { color: var(--tb-green-pale); }

.sidebar-brand-tagline {
  display: block;
  color: var(--tb-sidebar-text);
  font-size: 0.75rem;
  margin-top: 0.2rem;
  opacity: 0.75;
}

.sidebar-nav {
  list-style: none;
  padding: 1rem 0;
  margin: 0;
  flex: 1;
}

.sidebar-nav li { margin: 0; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 1.5rem;
  color: var(--tb-sidebar-text);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.08);
  border-left-color: var(--tb-green-light);
}

.sidebar-link-icon {
  opacity: 0.7;
  font-size: 1rem;
  width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user {
  display: block;
  color: var(--tb-sidebar-text);
  font-size: 0.83rem;
  margin-bottom: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--tb-sidebar-text);
  padding: 0.4rem 0;
  border-radius: 7px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Mobile toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1rem; left: 1rem;
  z-index: 1100;
  background: var(--tb-green);
  color: #FFF;
  border: none;
  border-radius: 8px;
  width: 42px; height: 42px;
  font-size: 1.25rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--tb-shadow);
  line-height: 1;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 999;
}

/* ── Main content ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--tb-sidebar-w);
  min-height: 100vh;
  padding: 2.5rem 2.75rem;
}

/* ── Page header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--tb-text);
  margin: 0;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.page-subtitle {
  color: var(--tb-muted);
  font-size: 0.88rem;
  margin-top: 0.25rem;
  margin-bottom: 0;
}

/* ── Cards ────────────────────────────────────────────────── */
.tb-card {
  background: var(--tb-card-bg);
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius);
  box-shadow: var(--tb-shadow-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.tb-card-header {
  padding: 0.95rem 1.4rem;
  border-bottom: 1px solid var(--tb-border);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--tb-text);
  background: var(--tb-green-ghost);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tb-card-body {
  padding: 1.5rem;
}

/* ── Status Badges ────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.8rem;
  border-radius: 999px;
  font-size: 0.81rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status-pending  { background: #FEF9C3; color: #713F12; }
.status-accepted { background: #DCFCE7; color: #14532D; }
.status-rejected { background: #FEE2E2; color: #7F1D1D; }
.status-expired  { background: #F1F5F9; color: #475569; }

/* ── Info list (definition list grid) ────────────────────── */
.info-list {
  display: grid;
  grid-template-columns: 155px 1fr;
  gap: 0.8rem 1.25rem;
  margin: 0;
}

.info-list dd { margin: 0; }

.info-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--tb-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-top: 0.15rem;
  align-self: start;
}

.info-value {
  color: var(--tb-text);
  font-size: 0.94rem;
}

.text-muted-value { color: var(--tb-muted); }

/* ── Follow-up progress dots ──────────────────────────────── */
.followup-progress {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.followup-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--tb-border);
  transition: background 0.15s;
}

.followup-dot.done { background: var(--tb-green); }

/* ── Table ────────────────────────────────────────────────── */
.tb-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

.tb-table th {
  background: var(--tb-green-ghost);
  color: var(--tb-muted);
  font-size: 0.77rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--tb-border);
  text-align: left;
  white-space: nowrap;
}

.tb-table td {
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--tb-border);
  font-size: 0.93rem;
  vertical-align: middle;
}

.tb-table tbody tr:last-child td { border-bottom: none; }
.tb-table tbody tr:hover { background: var(--tb-green-ghost); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-tb-primary,
.btn-tb-outline,
.btn-tb-danger,
.btn-tb-success,
.btn-tb-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.15rem;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  line-height: 1.4;
  white-space: nowrap;
  border: 1.5px solid transparent;
}

.btn-tb-primary {
  background: var(--tb-green);
  color: #FFF;
  border-color: var(--tb-green);
}
.btn-tb-primary:hover { background: var(--tb-green-mid); border-color: var(--tb-green-mid); color: #FFF; }

.btn-tb-outline {
  background: transparent;
  color: var(--tb-green);
  border-color: var(--tb-green);
}
.btn-tb-outline:hover { background: var(--tb-green-ghost); color: var(--tb-green); }

.btn-tb-success {
  background: #059669;
  color: #FFF;
  border-color: #059669;
}
.btn-tb-success:hover { background: #047857; border-color: #047857; color: #FFF; }

.btn-tb-danger {
  background: #DC2626;
  color: #FFF;
  border-color: #DC2626;
}
.btn-tb-danger:hover { background: #B91C1C; border-color: #B91C1C; color: #FFF; }

.btn-tb-ghost {
  background: transparent;
  color: var(--tb-muted);
  border-color: var(--tb-border);
}
.btn-tb-ghost:hover { background: #FEE2E2; color: #B91C1C; border-color: #FECACA; }

button:disabled,
.btn-disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* ── Form controls ────────────────────────────────────────── */
.tb-form-group { margin-bottom: 1.1rem; }

.tb-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--tb-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tb-input {
  width: 100%;
  padding: 0.62rem 0.9rem;
  border: 1.5px solid var(--tb-border);
  border-radius: 7px;
  font-size: 0.95rem;
  color: var(--tb-text);
  background: #FFF;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  line-height: 1.4;
}

.tb-input:focus {
  border-color: var(--tb-green-light);
  box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.18);
}

.tb-input::placeholder { color: #B6C5BE; }

/* ── Alert / notice ───────────────────────────────────────── */
.tb-notice {
  padding: 0.85rem 1.15rem;
  border-radius: 8px;
  font-size: 0.91rem;
  margin-bottom: 1rem;
  border-width: 1px;
  border-style: solid;
}

.tb-notice-info  { background: var(--tb-green-pale); color: #1B4332; border-color: #95D5B2; }
.tb-notice-warn  { background: #FEF3C7; color: #78350F; border-color: #FDE68A; }
.tb-notice-error { background: #FEE2E2; color: #7F1D1D; border-color: #FECACA; }

/* ── Log result badges ────────────────────────────────────── */
.log-badge-ok,
.log-badge-err {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.log-badge-ok  { background: #DCFCE7; color: #14532D; }
.log-badge-err { background: #FEE2E2; color: #7F1D1D; }

/* ── Back link ────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--tb-muted);
  text-decoration: none;
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
  transition: color 0.15s;
}

.back-link:hover { color: var(--tb-green); }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3.5rem 2rem;
  color: var(--tb-muted);
}

.empty-state-icon {
  font-size: 2.75rem;
  margin-bottom: 0.75rem;
  opacity: 0.35;
  line-height: 1;
}

.empty-state-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--tb-text);
}

.empty-state-sub {
  font-size: 0.88rem;
  margin-top: 0.4rem;
  color: var(--tb-muted);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--tb-sidebar-w)));
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 1.5rem 1.5rem;
    padding-top: 4.5rem;
  }
}

@media (max-width: 575.98px) {
  .main-content {
    padding: 1rem;
    padding-top: 4rem;
  }

  .page-title { font-size: 1.3rem; }

  .info-list {
    grid-template-columns: 1fr;
    gap: 0 0;
  }

  .info-label {
    margin-top: 0.9rem;
    margin-bottom: 0.1rem;
  }

  .tb-card-body { padding: 1.1rem; }
}

/* ── Filter bar ───────────────────────────────────────────── */
.filter-card { margin-bottom: 1.25rem; }

.filter-search-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.filter-search-wrap {
  display: flex;
  gap: 0.5rem;
  flex: 1;
}

.filter-search-wrap .tb-input { flex: 1; }

.filter-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Status filter pills */
.filter-pills {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.81rem;
  font-weight: 500;
  border: 1.5px solid var(--tb-border);
  background: transparent;
  color: var(--tb-muted);
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.4;
}

.filter-pill:hover {
  border-color: var(--tb-green);
  color: var(--tb-green);
  background: var(--tb-green-ghost);
}

.filter-pill.active {
  background: var(--tb-green);
  border-color: var(--tb-green);
  color: #fff;
}

/* "Ryd filtre" inline link */
.clear-filters-link {
  font-size: 0.82rem;
  color: var(--tb-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left: 0.6rem;
  transition: color 0.15s;
}
.clear-filters-link:hover { color: var(--tb-green); }

@media (max-width: 767px) {
  .filter-controls-row { flex-direction: column; align-items: flex-start; }
  .filter-sort-wrap { width: 100%; }
  .filter-sort-wrap select { width: 100% !important; }
}

/* Footer */
.site-footer {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 1rem 1.5rem;
  margin-top: 2rem;
  border-top: 1px solid var(--tb-border, #e5e7eb);
  font-size: 0.85rem;
  color: #6b7280;
}
.site-footer a { color: #6b7280; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* Missing contact info badge */
.badge-missing-contact {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}

/* Test-flow badge */
.badge-test {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
  vertical-align: middle;
  letter-spacing: 0.03em;
}

/* ── Sidebar brand logo ── */
.nav-logo,
.nav-logo:link,
.nav-logo:visited,
.nav-logo:hover,
.nav-logo:active {
  color: #ffffff !important;
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.nav-logo span {
  color: #52b788;
}
