/* ============================================
   YMCA Manchester Dashboard — Modern Redesign
   Palette: YMCA Blue #0095da, Green #8cc63f
   ============================================ */

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f4f6f9;
  color: #1e293b;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
header {
  background: linear-gradient(135deg, #0077b6 0%, #0095da 60%, #00b4d8 100%);
  color: white;
  padding: 1.5rem 2rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-subtitle {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 2px;
}

.powered-by {
  font-size: 0.8rem;
  opacity: 0.8;
}

.powered-by a {
  color: #fff;
  text-decoration: none;
  transition: opacity 0.2s;
}

.powered-by a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* --- Dashboard Container --- */
.dashboard {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: white;
  padding: 0.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  flex-wrap: wrap;
}

.tab-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  padding: 0.7rem 1.2rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tab-button:hover {
  background: #f1f5f9;
  color: #334155;
}

.tab-button.active {
  background: #0095da;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 149, 218, 0.3);
}

.tab-button svg {
  flex-shrink: 0;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- KPI Cards --- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: white;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  border-left: 4px solid #0095da;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.kpi-card.kpi-highlight {
  border-left-color: #8cc63f;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.kpi-trend {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.kpi-trend.trend-up {
  color: #16a34a;
}

.kpi-trend.trend-down {
  color: #dc2626;
}

.kpi-trend.trend-neutral {
  color: #64748b;
}

.kpi-context {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}

/* --- Filters --- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.filter-group select,
.filters select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.85rem;
  font-family: inherit;
  color: #334155;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  transition: border-color 0.2s;
}

.filter-group select:focus,
.filters select:focus {
  outline: none;
  border-color: #0095da;
  box-shadow: 0 0 0 3px rgba(0, 149, 218, 0.15);
}

/* --- Chart Sections --- */
.chart-section {
  margin-bottom: 1.5rem;
}

.chart-description {
  margin-bottom: 0.75rem;
}

.chart-description h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.chart-description p {
  font-size: 0.825rem;
  color: #64748b;
  line-height: 1.5;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  padding: 1.25rem;
  height: 380px;
  position: relative;
}

.chart-container-half {
  max-width: 600px;
}

/* --- Map --- */
#map {
  height: 420px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  margin-bottom: 1.5rem;
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.stats-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.stat-card {
  background: white;
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  border-top: 3px solid #0095da;
}

.stat-card-compact {
  padding: 1rem;
  border-top-color: #e2e8f0;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.4rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0077b6;
}

.stat-value-small {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.stat-sublabel {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 0.2rem;
}

.stat-badge {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.stat-badge.badge-significant {
  background: #dcfce7;
  color: #166534;
}

.stat-badge.badge-not-significant {
  background: #fee2e2;
  color: #991b1b;
}

.stat-badge.badge-small-sample {
  background: #fef3c7;
  color: #92400e;
}

/* --- Completion Funnel --- */
.funnel-container {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  min-height: 140px;
}

.funnel-stage {
  flex: 1;
  padding: 1.25rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: background 0.2s;
}

.funnel-stage:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 24px solid transparent;
  border-bottom: 24px solid transparent;
  border-left: 12px solid;
  border-left-color: inherit;
  z-index: 2;
}

.funnel-stage-1 { background: #e0f2fe; border-left-color: #e0f2fe; }
.funnel-stage-1::after { border-left-color: #e0f2fe; }
.funnel-stage-2 { background: #bae6fd; }
.funnel-stage-2::after { border-left-color: #bae6fd; }
.funnel-stage-3 { background: #7dd3fc; }
.funnel-stage-3::after { border-left-color: #7dd3fc; }
.funnel-stage-4 { background: #38bdf8; }

.funnel-stage-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0369a1;
  margin-bottom: 0.35rem;
}

.funnel-stage-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0c4a6e;
  line-height: 1;
}

.funnel-stage-percent {
  font-size: 0.75rem;
  font-weight: 500;
  color: #0369a1;
  margin-top: 0.25rem;
}

/* --- Programme Details Tab --- */
.details-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.details-hero-image {
  overflow: hidden;
}

.details-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-height: 280px;
}

.details-hero-text {
  padding: 2rem 2rem 2rem 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.details-hero-text h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0077b6;
  margin-bottom: 0.75rem;
}

.details-lead {
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.7;
}

.details-features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.feature-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem 1.25rem;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  color: #0077b6;
  margin-bottom: 0.75rem;
}

.feature-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.4rem;
}

.feature-card p {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.5;
}

/* Journey Steps */
.details-journey {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  margin-bottom: 2rem;
}

.details-journey > h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 1.5rem;
  text-align: center;
}

.journey-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.journey-step {
  text-align: center;
  flex: 1;
  max-width: 280px;
}

.journey-number {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0095da, #0077b6);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 149, 218, 0.3);
}

.journey-step h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.3rem;
}

.journey-step p {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.5;
}

.journey-connector {
  width: 60px;
  height: 2px;
  background: linear-gradient(to right, #0095da, #8cc63f);
  flex-shrink: 0;
  margin: 0 0.5rem;
  margin-bottom: 2rem;
}

/* Mission Statement */
.details-mission {
  background: linear-gradient(135deg, #0077b6, #0095da);
  color: white;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}

.details-mission p {
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 700px;
  margin: 0 auto;
}

.details-mission strong {
  color: #a7f3d0;
}

/* --- Measurement Tab --- */
.measurement-intro {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.measurement-intro h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #0077b6;
  margin-bottom: 0.5rem;
}

.measurement-intro p {
  font-size: 0.95rem;
  color: #475569;
  max-width: 600px;
  margin: 0 auto;
}

.measure-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.measure-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  border-top: 3px solid #0095da;
  transition: transform 0.15s ease;
}

.measure-card:hover {
  transform: translateY(-2px);
}

.measure-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.measure-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0077b6;
  flex-shrink: 0;
}

.measure-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #0077b6;
}

.measure-card h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.5rem;
}

.measure-card p {
  font-size: 0.825rem;
  color: #64748b;
  line-height: 1.6;
}

.measurement-stats-approach {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 1.5rem;
}

.measurement-stats-approach h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #166534;
  margin-bottom: 0.4rem;
}

.measurement-stats-approach p {
  font-size: 0.85rem;
  color: #15803d;
  line-height: 1.6;
}

/* --- Footer --- */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: #94a3b8;
  border-top: 1px solid #e2e8f0;
  margin-top: 2rem;
}

.site-footer a {
  color: #0095da;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }
  .details-features {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .measure-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  header {
    padding: 1rem;
  }
  header h1 {
    font-size: 1.2rem;
  }
  .header-inner {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
  .dashboard {
    padding: 1rem;
  }
  .tabs {
    gap: 0.25rem;
    padding: 0.35rem;
  }
  .tab-button {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
  .tab-button svg {
    display: none;
  }
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid-4 {
    grid-template-columns: 1fr;
  }
  .details-hero {
    grid-template-columns: 1fr;
  }
  .details-hero-text {
    padding: 1.5rem;
  }
  .details-features {
    grid-template-columns: 1fr;
  }
  .journey-steps {
    flex-direction: column;
  }
  .journey-connector {
    width: 2px;
    height: 30px;
    margin: 0.5rem 0;
  }
  .funnel-container {
    flex-direction: column;
  }
  .funnel-stage:not(:last-child)::after {
    display: none;
  }
  .filters {
    flex-direction: column;
  }
  .filter-group {
    width: 100%;
  }
  .filter-group select {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .kpi-row {
    grid-template-columns: 1fr;
  }
}
