/* =====================================================
   STARLINK VMS — Reports Module CSS (SCR-30)
   ===================================================== */

/* Page header row */
.rpt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-3);
}
.rpt-header h1 { font-size: var(--font-size-2xl); font-weight: 700; color: var(--color-navy); }

/* Date-range toolbar */
.rpt-toolbar-container {
  display: flex;
  align-items: center;
  position: relative;
  margin-bottom: var(--space-6);
  width: 100%;
}
.rpt-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  flex: 1;
  scrollbar-width: none;
}
.rpt-toolbar::-webkit-scrollbar {
  display: none;
}
.rpt-toolbar-nav {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-secondary);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  display: none;
}
.rpt-toolbar-nav:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}
.rpt-toolbar-nav--left {
  margin-right: var(--space-2);
}
.rpt-toolbar-nav--right {
  margin-left: var(--space-2);
}
.rpt-period-btn {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  background: white;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.rpt-period-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.rpt-period-btn.active { 
  background: var(--color-primary); 
  color: white; 
  border-color: var(--color-primary);
}
.rpt-date-sep { color: var(--color-text-muted); font-size: var(--font-size-sm); }

/* Summary KPI row */
.rpt-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
@media (max-width:1200px) { .rpt-kpi-row { grid-template-columns: repeat(2,1fr); } }
@media (max-width:640px)  { .rpt-kpi-row { grid-template-columns: 1fr; } }

.rpt-kpi {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}
.rpt-kpi:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }

.rpt-kpi__icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rpt-kpi__icon--blue   { background: #EAF4FB; color: var(--color-primary); }
.rpt-kpi__icon--amber  { background: #FEF5E7; color: var(--color-orange); }
.rpt-kpi__icon--green  { background: #EAFAF1; color: var(--color-success); }
.rpt-kpi__icon--purple { background: #F5EEF8; color: #8E44AD; }

.rpt-kpi__body { min-width: 0; }
.rpt-kpi__val {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-navy);
  line-height: 1;
  margin-bottom: 4px;
}
.rpt-kpi__label { font-size: var(--font-size-sm); color: var(--color-text-secondary); }
.rpt-kpi__delta {
  font-size: var(--font-size-xs);
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.rpt-kpi__delta--up   { color: var(--color-success); }
.rpt-kpi__delta--down { color: var(--color-error); }

/* Two-column chart layout */
.rpt-charts {
  display: grid;
  grid-template-columns: 60fr 40fr;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}
@media (max-width:1024px) { .rpt-charts { grid-template-columns: 1fr; } }

/* Chart card */
.rpt-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 416.59px;
  display: flex;
  flex-direction: column;
}
.rpt-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}
.rpt-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.rpt-card__title { font-size: var(--font-size-md); font-weight: 600; color: var(--color-navy); }
.rpt-card__sub   { font-size: var(--font-size-xs); color: var(--color-text-muted); }

/* Trend line chart (CSS-only) */
.trend-chart {
  height: 220px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  position: relative;
  padding-bottom: 24px;
  margin-top: auto;
}
.trend-chart::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 0; bottom: 24px;
  background: repeating-linear-gradient(
    to bottom,
    var(--color-border-light) 0px,
    var(--color-border-light) 1px,
    transparent 1px,
    transparent 25%
  );
}
.trend-bar { 
  flex: 1; 
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--color-primary) 0%, rgba(46,134,193,0.5) 100%);
  transition: opacity var(--transition-fast), height 600ms cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
  cursor: pointer;
}
.trend-bar:hover { opacity: 0.85; }
.trend-bar--highlight {
  background: linear-gradient(180deg, var(--color-orange) 0%, rgba(232,114,42,0.5) 100%);
}
.trend-bar__label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.trend-bar__tooltip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,42,74,0.9);
  color: white;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.trend-bar:hover .trend-bar__tooltip { opacity: 1; }

/* Donut chart (CSS) */
.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}
.donut {
  width: 140px; height: 140px;
  border-radius: 50%;
  position: relative;
}
.donut__svg { width: 140px; height: 140px; }
.donut__center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.donut__center-val { font-size: 24px; font-weight: 700; color: var(--color-navy); line-height: 1; }
.donut__center-label { font-size: 10px; color: var(--color-text-muted); }

/* Legend */
.donut-legend { width: 100%; }
.donut-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: var(--font-size-sm);
}
.donut-legend-item:last-child { border-bottom: none; }
.donut-legend-item__left { display: flex; align-items: center; gap: 8px; }
.donut-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.donut-legend-item__pct { font-weight: 600; color: var(--color-navy); }

/* Top-visiting companies table */
.rpt-table-wrap {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-5);
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

/* Horizontal scroll is scoped ONLY to the table — the title stays fixed */
.rpt-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.rpt-table-scroll::-webkit-scrollbar {
  height: 6px;
}
.rpt-table-scroll::-webkit-scrollbar-track {
  background: var(--color-bg);
}
.rpt-table-scroll::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 99px;
}
.rpt-table-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}
.rpt-table-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rpt-table-title { font-size: var(--font-size-md); font-weight: 600; color: var(--color-navy); }

.rpt-table { width: 100%; border-collapse: collapse; }
.rpt-table th {
  padding: var(--space-3) var(--space-5);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border-light);
}
.rpt-table td {
  padding: 10px var(--space-5);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}
.rpt-table tbody tr:last-child td { border-bottom: none; }
.rpt-table tbody tr:hover { background: var(--color-bg-alt); }

/* Inline mini bar (for table) */
.mini-bar-wrap { display: flex; align-items: center; gap: 8px; }
.mini-bar {
  flex: 1; height: 6px;
  background: var(--color-border-light);
  border-radius: 99px;
  overflow: hidden;
}
.mini-bar__fill {
  height: 100%;
  border-radius: 99px;
  background: var(--color-primary);
  transition: width 800ms ease;
}
.mini-bar__val { font-size: var(--font-size-xs); font-weight: 600; color: var(--color-text-secondary); min-width: 24px; text-align: right; }

/* Compliance table */
.compliance-row-rpt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
  font-size: var(--font-size-sm);
}
.compliance-row-rpt:last-child { border-bottom: none; }
.compliance-pct {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-navy);
}
