/* app.css - Branded Realities analytics report styles */

body {
  font-family: 'Inter', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  background: #f4f5f7;
  padding-top: 28px;
}

/* ---- cards ---- */
.metric-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(15, 15, 15, 0.06), 0 1px 2px rgba(15, 15, 15, 0.05);
  border-top: 5px solid var(--accent, #333333);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 15, 15, 0.12), 0 2px 6px rgba(15, 15, 15, 0.08);
}
@media (prefers-reduced-motion: reduce) {
  .metric-card, .metric-card:hover { transition: none; transform: none; }
}

/* ---- date range + actions ---- */
.date-range-inline { display: flex; align-items: center; gap: 8px; }
.date-range-inline .form-group { margin-bottom: 0; }
.date-range-inline .input-daterange { width: 260px; }
.date-range-inline .input-daterange input {
  font-size: 13px; height: 34px; padding: 4px 8px; text-align: center;
}
.date-range-inline .input-daterange .input-group-addon {
  font-size: 12px; padding: 4px 8px;
}
.date-range-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.date-range-actions .btn {
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 18px;
  border: none;
}
.date-range-actions .btn-apply {
  background: var(--accent, #333333);
  color: #ffffff;
}
.date-range-actions .btn-apply:hover { filter: brightness(1.15); }
.date-range-actions .btn-reset {
  background: #eceef1;
  color: #55595f;
}
.date-range-actions .btn-reset:hover { background: #dfe2e6; }

/* ---- metrics ---- */
.html-card {
  background: transparent;
  box-shadow: none;
  border-top: none;
  padding: 0;
}
.html-card:hover { transform: none; box-shadow: none; }
.tile-empty { color: #8a8f98; font-size: 14px; margin: 8px 0; }
.chart-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #333333;
}
.section-title {
  margin: 22px 4px 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8f98;
}
.metric-label {
  margin: 0 0 8px 0;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8a8f98;
}
.metric-value {
  margin: 0;
  font-weight: 800;
  font-size: 48px;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--accent, #222222);
}

/* ---- page tint ---- */
.team-page {
  padding: 22px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent, #888888) 7%, white);
}

/* ---- tab bar (pill style) ---- */
.nav-tabs {
  border-bottom: none;
  display: flex;
  gap: 6px;
  padding-bottom: 10px;
}
.nav-tabs::before, .nav-tabs::after { display: none; }   /* Bootstrap clearfix would add gaps in a flex row */
.nav-tabs > li { float: none; margin: 0; }
.nav-tabs > li > a {
  font-weight: 600;
  color: #6b7280;
  border: none !important;
  background: transparent !important;
  border-radius: 999px !important;
  padding: 8px 20px;
  transition: background 0.15s, color 0.15s;
}
.nav-tabs > li > a:hover { background: rgba(0, 0, 0, 0.05) !important; }
.nav-tabs > li.active > a {
  background: #111827 !important;
  color: #ffffff !important;
}
.tabbable { position: relative; }

/* ---- hero header ---- */
.hero-header {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 28px 32px;
  border-radius: 20px;
  margin-bottom: 24px;
  box-shadow: 0 14px 34px rgba(15, 15, 15, 0.16), 0 2px 8px rgba(15, 15, 15, 0.08);
  position: relative;
}
.logo-chip {
  background: #ffffff;
  border-radius: 16px;
  padding: 10px 16px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(15, 15, 15, 0.18);
}
.logo-monogram {
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.02em;
}
.hero-title {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 32px;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.hero-corner {
  position: absolute; top: 14px; right: 18px;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 6px; border-radius: 10px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.9); font-size: 12px; font-weight: 600;
}

/* ---- refresh control ---- */
.page-refresh {
  display: flex; align-items: center; gap: 12px;
  padding-left: 18px; border-left: 1px solid rgba(0,0,0,0.12);
}
.page-refresh .btn {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.15);
  color: #333333;
  border-radius: 8px; padding: 6px 16px;
  font-size: 13px; font-weight: 600;
}
.page-refresh .btn:hover { background: #eceef1; color: #333333; }
.hero-updated {
  font-size: 12px; color: #55595f; text-align: right;
  line-height: 1.35;
}
.hero-updated .hero-updated-label {
  display: block; font-size: 11px; color: #8a8f98;
}

/* ---- save-as-PDF button: icon that turns into a spinner while working ---- */
.page-refresh .btn-pdf { margin-left: 4px; min-width: 38px; }
.btn-pdf .pdf-spinner {
  display: none; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #d5d9df; border-top-color: #6b7280;
  animation: br-spin 0.8s linear infinite; vertical-align: middle;
}
.btn-pdf.is-loading .fa, .btn-pdf.is-loading svg { display: none; }
.btn-pdf.is-loading .pdf-spinner { display: inline-block; }

/* ---- loading overlay ---- */
#loadingOverlay {
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  align-items: center; justify-content: center;
  background: rgba(247, 248, 250, 0.92);
}
html.shiny-busy #loadingOverlay {
  display: flex;
  animation: br-fade-in 0.2s ease 0.4s both;
}
@keyframes br-fade-in { from { opacity: 0; } to { opacity: 1; } }
.loading-box { text-align: center; }
.loading-spinner {
  width: 34px; height: 34px; margin: 0 auto 14px;
  border: 3px solid #e3e6ea; border-top-color: #9aa0a6;
  border-radius: 50%;
  animation: br-spin 0.8s linear infinite;
}
@keyframes br-spin { to { transform: rotate(360deg); } }
.loading-text {
  font-size: 14px; font-weight: 600; color: #6b7178;
  letter-spacing: 0.01em;
}
.loading-note { font-size: 12px; color: #9aa0a6; margin-top: 4px; }

/* ---- empty states ---- */
.rpt-empty {
  border: 2px dashed #d5d9df;
  border-radius: 14px;
  padding: 72px 24px;
  text-align: center;
  color: #6b7280;
  background: #ffffff;
}
.rpt-empty h2 { font-size: 19px; font-weight: 700; color: #374151; margin: 0 0 6px; }
.rpt-empty p  { font-size: 14px; margin: 0; }
.rpt-detail   { font-size: 12px; color: #9aa0a6; margin-top: 8px; }

/* ---- top-players podium ---- */
.podium-floor {
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 340px;
}
.podium-row {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 0; flex-wrap: wrap;
}
.podium-col { display: flex; flex-direction: column; align-items: center; }
.podium-figure { width: 150px; margin: 0; padding: 0; line-height: 0; }
.podium-img { width: 150px; height: auto; display: block; margin: 0; padding: 0; }
.podium-monogram-box {
  width: 150px; height: 150px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 48px;
}
.podium-plate {
  width: 150px;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 10px 20px rgba(15, 15, 15, 0.18),
              inset 0 1px 0 rgba(255, 255, 255, 0.5),
              inset 0 -2px 0 rgba(0, 0, 0, 0.3);
  padding: 14px 10px 16px;
}
.podium-plate-top {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.podium-rank-num { font-weight: 800; font-size: 44px; line-height: 1; color: #ffffff; }
.podium-plate-name {
  color: #ffffff; font-weight: 700; font-size: 15px; text-align: center; line-height: 1.2;
}
.podium-selections-line {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  margin-top: auto;
}

/* ---- experience / group toggle buttons ---- */
/* shinyWidgets::radioGroupButtons(status = "br", individual = TRUE) */
.br-toggle-group-wrapper {
  padding: 20px 26px 4px;
}
.br-toggle-group-wrapper .form-group { margin-bottom: 0; }
.br-toggle-group-wrapper .btn-group-container-sw {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}
.radio-group-buttons .btn-br {
  padding: 10px 26px;
  border-radius: 24px;
  border: 2px solid rgba(0,0,0,0.12);
  background: #ffffff;
  color: #6b7280;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15,15,15,0.06);
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}
.radio-group-buttons .btn-br:hover,
.radio-group-buttons .btn-br:focus {
  border-color: var(--accent, #333333);
  color: var(--accent, #333333);
  box-shadow: 0 4px 12px rgba(15,15,15,0.10);
  outline: none;
}
.radio-group-buttons .btn-br.active,
.radio-group-buttons .btn-br.active:hover,
.radio-group-buttons .btn-br.active:focus {
  background: var(--accent, #333333);
  border-color: var(--accent, #333333);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(15,15,15,0.18);
}

/* ---- controls row (toggle buttons + date filter + refresh) ---- */
.br-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 4px 4px;
  margin-bottom: 8px;
}
.br-controls-subtitle {
  font-size: 15px;
  font-weight: 600;
  color: #6b7280;
  padding: 10px 0;
}
.br-controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- info icon ---- */
.info-icon {
  display: inline-block;
  margin-left: 6px;
  color: #b0b4ba;
  cursor: help;
  font-size: 0.8em;
  vertical-align: middle;
}
.info-icon:hover {
  color: #8a8f98;
}

/* ---- responsive: laptops, tablets, phones ---- */
@media (max-width: 1200px) {
  .br-controls-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .br-toggle-group-wrapper { padding: 8px 0 0; }
  .br-toggle-group-wrapper .btn-group-container-sw { margin-bottom: 6px; }
  .br-controls-right { justify-content: flex-start; }
  .page-refresh { border-left: none; padding-left: 0; flex-wrap: wrap; }
}

@media (max-width: 767px) {
  body { padding-top: 12px; }
  .hero-header { flex-direction: column; text-align: center; padding: 48px 16px 20px; gap: 12px; }
  .hero-title { font-size: 24px; }
  .team-page { padding: 12px; }
  .metric-value { font-size: 40px; }
  .nav-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .date-range-inline { flex-wrap: wrap; }
  .date-range-inline .input-daterange { width: 100%; max-width: 280px; }
  .podium-figure, .podium-img, .podium-plate, .podium-monogram-box { width: 100px; }
}

/* ---- save as PDF: dialog ---- */
.br-pdf-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(17, 24, 39, 0.45);
}
.br-pdf-card {
  background: #ffffff; border-radius: 16px; padding: 24px 26px;
  width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(15, 15, 15, 0.25);
}
.br-pdf-title { margin: 0 0 4px; font-size: 18px; font-weight: 800; color: #111827; }
.br-pdf-hint { margin: 0 0 14px; font-size: 13px; color: #6b7280; }
.br-pdf-dates {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px; font-size: 13px; color: #6b7280;
}
.br-pdf-dates-label { font-weight: 700; color: #111827; margin-right: 6px; }
.br-pdf-date {
  border: 1px solid transparent; border-radius: 10px; padding: 8px 12px;
  font-family: inherit; font-size: 13px; color: #111827;
  background: #eceef1;
  transition: background 0.15s, border-color 0.15s;
}
.br-pdf-date:hover { background: #e3e6ea; }
.br-pdf-date:focus { outline: none; background: #ffffff; border-color: #9aa0a6; }
.br-pdf-error { margin: -6px 0 10px; font-size: 12px; color: #b91c1c; }
.br-pdf-error:empty { display: none; }
.br-pdf-links { display: flex; gap: 14px; margin-bottom: 8px; }
.br-pdf-link {
  background: none; border: none; padding: 0;
  font-size: 12px; font-weight: 600; color: #6b7280; cursor: pointer;
}
.br-pdf-link:hover { color: #111827; text-decoration: underline; }
.br-pdf-list { overflow-y: auto; margin: 0 -6px 16px; padding: 0 6px; }
.br-pdf-row {
  display: flex; align-items: center; gap: 10px;
  margin: 0; padding: 9px 10px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: #374151; cursor: pointer;
}
.br-pdf-row:hover { background: #f4f5f7; }
.br-pdf-row input { margin: 0; width: 16px; height: 16px; accent-color: #111827; }
.br-pdf-actions { display: flex; justify-content: flex-end; gap: 10px; }
.br-pdf-btn {
  border: none; border-radius: 8px; padding: 9px 18px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.br-pdf-cancel { background: #eceef1; color: #55595f; }
.br-pdf-cancel:hover { background: #dfe2e6; }
.br-pdf-go { background: #111827; color: #ffffff; }
.br-pdf-go:hover { filter: brightness(1.2); }
.br-pdf-go:disabled { opacity: 0.4; cursor: not-allowed; }
.br-pdf-progress {
  width: 34px; height: 34px; margin: 10px auto 14px; border-radius: 50%;
  border: 3px solid #e3e6ea; border-top-color: #9aa0a6;
  animation: br-spin 0.8s linear infinite;
}

/* ---- save as PDF: the printed copy ---- */
/* app.js builds #br-export (one .br-export-page per ticked section) just before printing */
#br-export { display: none; }

@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body { background: #ffffff !important; padding-top: 0 !important; }

  /* print only the copy, not the live report */
  body.br-exporting > *:not(#br-export) { display: none !important; }
  body.br-exporting #br-export { display: block !important; }
  .br-export-page { break-after: page; }
  .br-export-page:last-child { break-after: auto; }

  .nav-tabs, .page-refresh .btn, .date-range-actions, #loadingOverlay { display: none !important; }

  /* soft shadows turn into grey boxes in PDFs, so drop them */
  * { box-shadow: none !important; text-shadow: none !important; }
  .metric-card { border: 1px solid #e5e7eb; border-top: 5px solid var(--accent, #333333); }
  .html-card { border: none; }

  /* keep the desktop grid in the PDF whatever the window width */
  [class*="col-sm-"] { float: left; }
  .col-sm-1 { width: 8.3333%; }  .col-sm-2 { width: 16.6667%; }
  .col-sm-3 { width: 25%; }      .col-sm-4 { width: 33.3333%; }
  .col-sm-5 { width: 41.6667%; } .col-sm-6 { width: 50%; }
  .col-sm-7 { width: 58.3333%; } .col-sm-8 { width: 66.6667%; }
  .col-sm-9 { width: 75%; }      .col-sm-10 { width: 83.3333%; }
  .col-sm-11 { width: 91.6667%; } .col-sm-12 { width: 100%; }
}
