/* ============================================
   Analytics Tab Styles
   ============================================ */

.analytics-view {
  padding: 0 1rem;
}

.analytics-view .analytics-panel {
  max-width: 60rem;
}

.analytics-panel {
  padding: 1.4rem;
  animation: fadeIn var(--duration-entrance) var(--ease-out-quart) both;
}

.analytics-panel:nth-of-type(1) {
  animation-delay: 50ms;
}

.analytics-panel:nth-of-type(2) {
  animation-delay: 100ms;
}

.analytics-panel:nth-of-type(3) {
  animation-delay: 150ms;
}

.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: var(--space-md);
  margin-bottom: 0.75rem;
}

.analytics-header h2 {
  margin: 0;
  font-size: 1.45rem;
}

.time-range-selector {
  display: flex;
  gap: 0.5rem;
}

.time-range-btn {
  padding: 0.6rem 1rem;
  border-radius: var(--radius-full);
  background: color-mix(in oklch, var(--panel), var(--bg-strong) 35%);
  border: 1px solid transparent;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
  min-height: 38px;
}

.time-range-btn:hover {
  transform: translateY(-1px);
  background: color-mix(in oklch, var(--panel), var(--accent) 12%);
}

.time-range-btn.active {
  border-color: color-mix(in oklch, var(--accent), white 50%);
  background: color-mix(in oklch, var(--panel), var(--accent) 16%);
}

.analytics-period {
  margin-bottom: 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.analytics-loading,
.analytics-error {
  color: var(--muted);
  font-size: 0.95rem;
}

.analytics-error {
  color: var(--danger);
}

.analytics-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-md);
  margin-bottom: 1.5rem;
}

/* Premium stat cards with enhanced interactions */
.stat-card {
  display: grid;
  gap: 0.4rem;
  padding: 1.4rem;
  border-radius: 1.3rem;
  background: linear-gradient(135deg, color-mix(in oklch, var(--panel), var(--accent) 6%) 0%, color-mix(in oklch, var(--panel), var(--accent) 2%) 100%);
  border: 1px solid color-mix(in oklch, var(--panel-border), var(--accent) 25%);
  text-align: center;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px color-mix(in oklch, var(--accent), transparent 20%), inset 0 1px 2px color-mix(in oklch, white, transparent 30%);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px oklch(0.52 0.04 60 / 0.15), inset 0 1px 2px color-mix(in oklch, white, transparent 40%);
  border-color: color-mix(in oklch, var(--panel-border), var(--accent) 35%);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.analytics-section {
  margin-bottom: 1.5rem;
}

.analytics-section:last-child {
  margin-bottom: 0;
}

.analytics-section h3 {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.adoption-bars {
  display: grid;
  gap: 0.85rem;
}

.adoption-bar-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
  transition: background-color 180ms ease;
}

.adoption-bar-row:hover {
  background: color-mix(in oklch, var(--panel), var(--bg-strong) 8%);
  border-radius: var(--radius-lg);
}

.adoption-bar-track {
  height: 0.75rem;
  border-radius: var(--radius-full);
  background: color-mix(in oklch, var(--bg-strong), var(--muted) 15%);
  overflow: hidden;
}

.adoption-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent) 0%, var(--olive) 100%);
  transition: width var(--duration-slow) var(--ease-material);
}

.adoption-bar-label {
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
}

.adoption-bar-percent {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  min-width: 3rem;
  text-align: right;
}

.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 4rem;
  padding: 0.5rem 0;
}

.sparkline-bar {
  flex: 1;
  min-width: 4px;
  max-width: 12px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, var(--accent) 0%, color-mix(in oklch, var(--accent), var(--bg) 30%) 100%);
  transition: height 200ms ease;
}

.sparkline-bar:hover {
  background: var(--olive);
}

.sparkline-empty {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Cost Summary Panel Styles */
.cost-summary-panel {
  padding: 1.4rem;
  animation: fadeIn var(--duration-entrance) var(--ease-out-quart) both;
}

.cost-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: var(--space-md);
  margin-bottom: 0.75rem;
}

.cost-summary-header h2 {
  margin: 0;
  font-size: 1.45rem;
}

.cost-period {
  margin-bottom: 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.cost-summary-loading,
.cost-summary-error {
  color: var(--muted);
  font-size: 0.95rem;
}

.cost-summary-error {
  color: var(--danger);
}

.cost-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-md);
  margin-bottom: 1.5rem;
}

.cost-section {
  margin-bottom: 1.5rem;
}

.cost-section:last-child {
  margin-bottom: 0;
}

.cost-section h3 {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* Framework breakdown styles */
.cost-framework-list {
  display: grid;
  gap: 1rem;
}

.cost-framework-item {
  display: grid;
  gap: 0.5rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: color-mix(in oklch, var(--panel), var(--bg-strong) 8%);
  transition: background-color 180ms ease;
}

.cost-framework-item:hover {
  background: color-mix(in oklch, var(--panel), var(--bg-strong) 12%);
}

.cost-framework-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cost-framework-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.cost-framework-cost {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.cost-framework-bar-track {
  height: 0.6rem;
  border-radius: var(--radius-full);
  background: color-mix(in oklch, var(--bg-strong), var(--muted) 15%);
  overflow: hidden;
}

.cost-framework-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent) 0%, var(--olive) 100%);
  transition: width var(--duration-slow) var(--ease-material);
}

.cost-framework-details {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.cost-framework-details span {
  display: flex;
  align-items: center;
}

/* Top sessions styles */
.cost-top-sessions {
  display: grid;
  gap: 0.75rem;
}

.cost-top-session-item {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem;
  border-radius: var(--radius-lg);
  background: color-mix(in oklch, var(--panel), var(--bg-strong) 6%);
  border: 1px solid color-mix(in oklch, var(--panel-border), transparent 50%);
  transition: all 180ms ease;
}

.cost-top-session-item:hover {
  background: color-mix(in oklch, var(--panel), var(--bg-strong) 10%);
  border-color: color-mix(in oklch, var(--panel-border), var(--accent) 25%);
}

.cost-top-session-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cost-top-session-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.cost-top-session-cost {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.cost-top-session-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.cost-top-session-framework {
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: color-mix(in oklch, var(--bg-strong), var(--muted) 10%);
}

.cost-top-session-date {
  font-variant-numeric: tabular-nums;
}

/* Rolling Summary Card Styles */
.rolling-summary-card {
  padding: var(--space-md);
  border-radius: 1rem;
  border: 1px solid var(--panel-border);
  background: color-mix(in oklch, var(--panel), white 28%);
}

.rolling-summary-text {
  margin: 0 0 0.75rem;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}

.rolling-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.9rem;
  border-radius: 0.75rem;
  background: var(--bg-strong);
}

.rolling-metrics h3 {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Analytics panel specific overrides */
.analytics-panel .stat-value {
  font-variant-numeric: tabular-nums;
}

.analytics-panel .cost-value {
  font-variant-numeric: tabular-nums;
}
