@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ==========================================================================
   AiVRIC Vision - Usage Analytics Styles
   Minimal CSS - Only rules that cannot be expressed as Tailwind utilities
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Variables - Needed for theme toggle and JS canvas rendering
   -------------------------------------------------------------------------- */
:root {
  /* Linked to shared-ui tokens with local fallbacks */
  --color-background: var(--dark-background, #000522);
  --color-surface-border: rgba(255, 255, 255, 0.08);
  --color-text-primary: var(--dark-text-primary, #EAF2FF);
  --color-text-secondary: var(--dark-text-secondary, #9FB0CC);
  --color-text-muted: var(--dark-text-tertiary, #7A8FAD);
  --color-primary: var(--aivric-primary, #2050C0);
  --color-success: var(--system-success, #2BD4A7);
  --color-info: var(--system-info, #38BDF8);
  --color-border: var(--dark-border, #1B2A47);
  --shadow-card: 0 20px 60px rgba(6, 12, 14, 0.45);
  --font-family-primary: var(--font-sans, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  --font-family-mono: var(--font-mono, 'JetBrains Mono', 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace);
}

.light {
  --color-background: #f8fafc;
  --color-surface-border: rgba(0, 0, 0, 0.1);
  --color-text-primary: #000522;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;
  --color-border: #e2e8f0;
  --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Ambient Background (complex multi-stop radial gradient)
   -------------------------------------------------------------------------- */
.ambient {
  background: radial-gradient(circle at 20% 20%, rgba(32, 80, 192, 0.08), transparent 55%),
    radial-gradient(circle at 80% 30%, rgba(244, 184, 96, 0.12), transparent 55%),
    radial-gradient(circle at 50% 80%, rgba(43, 212, 167, 0.1), transparent 55%);
}

/* --------------------------------------------------------------------------
   Site Header Background (gradient with theme support, not expressible as Tailwind)
   -------------------------------------------------------------------------- */
.site-header {
  background: linear-gradient(180deg, rgba(0, 5, 34, 0.9), rgba(0, 5, 34, 0));
}

.light .site-header {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(248, 250, 252, 0));
}

/* --------------------------------------------------------------------------
   Cards (JS-created via createEl in app.js and enterprise_user_report.js)
   -------------------------------------------------------------------------- */
.card {
  background: rgba(13, 21, 40, 0.72);
  border: 1px solid var(--color-surface-border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(32, 80, 192, 0.4);
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(32, 80, 192, 0.18), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover::after {
  opacity: 1;
}

.card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-text-secondary);
}

.card-value {
  font-size: 28px;
  font-weight: 600;
  margin-top: 10px;
}

.card-meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--color-success);
}

.light .card {
  background: rgba(255, 255, 255, 0.9);
}

/* --------------------------------------------------------------------------
   Legend (JS-created in drawDonut via createEl)
   -------------------------------------------------------------------------- */
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Canvas (element selector, not a class)
   -------------------------------------------------------------------------- */
canvas {
  width: 100%;
  border-radius: 14px;
  background: rgba(8, 13, 15, 0.4);
}

.light canvas {
  background: rgba(0, 0, 0, 0.03);
}

/* --------------------------------------------------------------------------
   Data Table Rows (JS-created dynamic rows and cells)
   -------------------------------------------------------------------------- */
.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.light .data-table th,
.light .data-table td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.light .data-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* --------------------------------------------------------------------------
   Bar List (JS-created in enterprise_user_report.js renderBarList)
   -------------------------------------------------------------------------- */
.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 70px 1.5fr;
  gap: 12px;
  align-items: center;
}

.bar-label {
  font-size: 13px;
  color: var(--color-text-primary);
}

.bar-value {
  font-size: 12px;
  text-align: right;
  color: var(--color-text-secondary);
}

.bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.light .bar-track {
  background: rgba(0, 0, 0, 0.08);
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(32, 80, 192, 0.6), rgba(43, 212, 167, 0.9));
  border-radius: 999px;
}

/* --------------------------------------------------------------------------
   Callout & Pill (JS-created in showDataError / showError)
   -------------------------------------------------------------------------- */
.callout h3 {
  margin: 0 0 6px;
  font-weight: 600;
}

.callout p {
  margin: 0;
  color: var(--color-text-secondary);
}

/* --------------------------------------------------------------------------
   Light Theme Overrides (filter input)
   -------------------------------------------------------------------------- */
.light .filters input {
  background: rgba(255, 255, 255, 0.8);
}

.light .pill {
  background: rgba(255, 255, 255, 0.8);
}

/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
