/* IPR Dashboard – lightweight layout (no sidebar) */

:root {
  --ipr-primary: #4e73df;
  --ipr-primary-dark: #3a5fc8;
  --ipr-bg: #f4f6f9;
  --ipr-card-border: #e3e6f0;
  --ipr-text: #3a3b45;
  --ipr-muted: #858796;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--ipr-bg);
  color: var(--ipr-text);
}

a {
  color: var(--ipr-primary);
  text-decoration: none;
}

a:hover {
  color: var(--ipr-primary-dark);
  text-decoration: underline;
}

/* ── Header ── */
.ipr-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: #fff;
  border-bottom: 1px solid var(--ipr-card-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ipr-header-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  min-height: 52px;
}

.ipr-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ipr-primary);
  justify-self: start;
}

.ipr-brand img {
  height: 36px;
  width: auto;
}

.ipr-brand-text {
  display: none;
}

.ipr-header-center {
  justify-self: center;
}

.ipr-header-right {
  justify-self: end;
}

.ipr-strava-link img {
  height: 36px;
  width: auto;
  display: block;
}

.ipr-flag {
  height: 36px;
  width: auto;
}

.ipr-header-filters {
  padding: 0 12px 10px;
  border-top: 1px solid var(--ipr-card-border);
  background: #fafbfc;
}

@media (min-width: 768px) {
  .ipr-header-top {
    padding: 10px 20px;
  }

  .ipr-brand img {
    height: 44px;
  }

  .ipr-brand-text {
    display: inline;
  }

  .ipr-strava-link img {
    height: 44px;
  }

  .ipr-flag {
    height: 44px;
  }

  .ipr-header-filters {
    padding: 0 20px 12px;
  }
}

@media (min-width: 992px) {
  .ipr-header-top {
    grid-template-columns: auto 1fr auto;
  }

  .ipr-header-center {
    order: 3;
    justify-self: end;
    margin-right: 12px;
  }

  .ipr-header-right {
    order: 4;
  }

  .ipr-header-filters {
    border-top: none;
    background: #fff;
    padding: 0 20px 12px;
  }
}

/* ── Filters ── */
.ipr-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
  padding-top: 10px;
}

.ipr-filters > div {
  flex: 1 1 auto;
  min-width: 0;
}

.ipr-filters label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ipr-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 2px;
  display: block;
}

.ipr-filters select {
  width: 100%;
  font-size: 0.85rem;
  border: 1px solid var(--ipr-card-border);
  border-radius: 6px;
  padding: 5px 8px;
  background: #fff;
  color: var(--ipr-text);
}

@media (min-width: 768px) {
  .ipr-filters {
    flex-wrap: nowrap;
    justify-content: center;
    padding-top: 0;
  }

  .ipr-filters > div {
    flex: 0 0 auto;
  }

  .ipr-filters select {
    width: auto;
    min-width: 130px;
  }
}

/* ── Main content ── */
.ipr-main {
  padding: 1.25rem 12px 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .ipr-main {
    padding: 1.25rem 20px 2rem;
  }
}

.ipr-page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ipr-text);
  margin: 0 0 0.25rem;
}

.ipr-filter-summary {
  font-size: 0.875rem;
  color: var(--ipr-muted);
  margin-bottom: 1.25rem;
}

.ipr-filter-summary strong {
  color: var(--ipr-text);
}

/* ── Stat cards ── */
.ipr-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .ipr-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

.ipr-stat-card {
  background: #fff;
  border: 1px solid var(--ipr-card-border);
  border-radius: 8px;
  padding: 14px 16px;
  border-left: 4px solid var(--ipr-primary);
}

.ipr-stat-card.success { border-left-color: #1cc88a; }
.ipr-stat-card.info    { border-left-color: #36b9cc; }
.ipr-stat-card.warning { border-left-color: #f6c23e; }

.ipr-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ipr-muted);
  margin-bottom: 4px;
}

.ipr-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ipr-text);
  line-height: 1.2;
}

@media (max-width: 575px) {
  .ipr-stat-value {
    font-size: 1rem;
  }
}

/* ── Table card ── */
.ipr-table-card {
  background: #fff;
  border: 1px solid var(--ipr-card-border);
  border-radius: 8px;
  overflow: visible;
}

.ipr-table-card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--ipr-card-border);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ipr-primary);
}

.ipr-table-body {
  padding: 0;
  overflow: visible;
}

.ipr-table {
  width: 100% !important;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  table-layout: auto;
  margin: 0 !important;
}

.ipr-table thead th {
  background: #f8f9fc;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ipr-muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--ipr-card-border);
  white-space: normal;
  vertical-align: bottom;
  position: static;
}

.ipr-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--ipr-card-border);
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
}

.ipr-table tbody tr:hover {
  background: #f8f9fc;
}

@media (max-width: 767px) {
  .ipr-col-elapsed {
    display: none;
  }

  .ipr-table {
    font-size: 0.8rem;
  }

  .ipr-table thead th,
  .ipr-table tbody td {
    padding: 8px 6px;
  }
}

/* DataTables overrides – no horizontal scroll */
.dataTables_wrapper {
  overflow-x: visible !important;
  width: 100%;
}

.dataTables_wrapper .row {
  margin-left: 0;
  margin-right: 0;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  padding: 10px 16px 6px;
  font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  padding: 8px 16px 12px;
  font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--ipr-card-border);
  border-radius: 6px;
  padding: 4px 8px;
  max-width: 140px;
}

@media (max-width: 575px) {
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    float: none;
    text-align: left;
    padding: 8px 12px 4px;
  }

  .dataTables_wrapper .dataTables_filter {
    margin-top: 0;
  }

  .dataTables_wrapper .dataTables_filter input {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
  }
}

/* ── Footer ── */
.ipr-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--ipr-card-border);
  background: #fff;
  margin-top: 2rem;
}

.ipr-footer img {
  height: 36px;
  opacity: 0.7;
}

.ipr-footnote {
  font-size: 0.78rem;
  color: var(--ipr-muted);
  padding: 0 16px 12px;
}
