/**
 * GX Foundry Platform -- Shared Component Styles
 * Developed for Becchio Group LLC. 2026. All rights reserved.
 *
 * Premium Liquid Glass treatment for all GX intelligence components.
 * All values use CSS custom properties from :root.
 * Zero hardcoded colors. Brand adapts via brand-config.json tokens.
 *
 * Components styled here:
 *   - GX Info Panel (WHY/WHERE/WHEN provenance)
 *   - GX Summary (intelligence narrative)
 *   - GX Loading state
 *   - GX Intelligence Renderer (Targets / Insights / Actions / Sources)
 */

/* ========================================================================
   GX Info Panel -- WHY / WHERE / WHEN data provenance
   ======================================================================== */

.gx-info-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.35);
  opacity: 0.7;
  transition: opacity 0.15s ease, background 0.15s ease;
  min-height: 28px;
}

.gx-info-trigger:hover,
.gx-info-trigger:focus-visible {
  opacity: 1;
  background: rgba(255, 255, 255, 0.04);
}

.gx-info-trigger:focus-visible {
  outline: 2px solid var(--brand-accent, #00E0FF);
  outline-offset: 2px;
}

.gx-info-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gx-info-dot--fresh {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.gx-info-dot--stale {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.gx-info-dot--expired {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.gx-info-source {
  white-space: nowrap;
}

.gx-info-chevron {
  font-size: 0.625rem;
  transition: transform 0.15s ease;
  display: inline-block;
}

.gx-info-chevron--open {
  transform: rotate(90deg);
}

.gx-info-body {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.gx-info-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.gx-info-row:last-child {
  margin-bottom: 0;
}

.gx-info-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
  min-width: 48px;
}

.gx-info-value {
  color: rgba(255, 255, 255, 0.5);
}

/* ========================================================================
   GX Summary -- Intelligence narrative
   ======================================================================== */

.gx-summary {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--brand-accent, #00E0FF);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.gx-summary-label {
  font-family: 'Poppins', sans-serif;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand-accent, #00E0FF);
  margin-bottom: 8px;
}

.gx-summary-text {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
}

.gx-summary-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 8px;
  opacity: 0.6;
}

/* ========================================================================
   GX Loading -- Placeholder while async data loads
   ======================================================================== */

.gx-loading {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.35);
  padding: 20px;
  text-align: center;
  opacity: 0.5;
}

/* ========================================================================
   Reduced motion
   ======================================================================== */

@media (prefers-reduced-motion: reduce) {
  .gx-info-trigger,
  .gx-info-chevron {
    transition: none;
  }
}

/* ==========================================================================
   GX Intelligence Renderer -- Targets / Insights / Actions / Sources
   Premium Liquid Glass treatment for all intelligence output.
   ========================================================================== */

.gx-intel-section { margin: 24px 0; }

.gx-intel-heading {
  font-family: 'Poppins', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.gx-intel-heading::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--brand-accent, #00E0FF);
  box-shadow: 0 0 8px rgba(var(--brand-accent-rgb, 0, 224, 255), 0.3);
  border-radius: 2px;
  flex-shrink: 0;
}

/* GX Targets */
.gx-targets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.gx-target-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  backdrop-filter: blur(40px) saturate(1.2);
  -webkit-backdrop-filter: blur(40px) saturate(1.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1),
    0 4px 24px rgba(0, 0, 0, 0.2);
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.gx-target-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

.gx-target-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  border-top-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(var(--brand-accent-rgb, 0, 224, 255), 0.1),
    0 4px 24px rgba(var(--brand-accent-rgb, 0, 224, 255), 0.06);
}

.gx-target-card > * {
  position: relative;
  z-index: 1;
}

.gx-target-metric {
  font-family: 'Poppins', sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 4px;
}

.gx-target-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 0 60px rgba(255, 255, 255, 0.06);
  line-height: 1.1;
}

.gx-target-benchmark {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 4px;
}

/* Target status borders */
.gx-target-on_target { border-color: rgba(34, 197, 94, 0.2); }
.gx-target-below_target { border-color: rgba(239, 68, 68, 0.2); }
.gx-target-benchmark { border-color: rgba(0, 224, 255, 0.15); }
.gx-target-target { border-color: rgba(251, 191, 36, 0.2); }
.gx-target-active { border-color: rgba(34, 197, 94, 0.2); }
.gx-target-info { border-color: rgba(255, 255, 255, 0.08); }

/* GX Insights */
.gx-insight-card {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
  backdrop-filter: blur(40px) saturate(1.2);
  -webkit-backdrop-filter: blur(40px) saturate(1.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 2px 12px rgba(0, 0, 0, 0.2);
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.gx-insight-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 20px rgba(0, 0, 0, 0.3);
}

.gx-insight-info { border-left-color: rgba(0, 224, 255, 0.4); }
.gx-insight-warning { border-left-color: rgba(251, 191, 36, 0.5); }
.gx-insight-critical { border-left-color: rgba(239, 68, 68, 0.5); }

.gx-insight-title {
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.gx-insight-summary {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
}

/* GX Actions */
.gx-action-card {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
  backdrop-filter: blur(40px) saturate(1.2);
  -webkit-backdrop-filter: blur(40px) saturate(1.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 2px 12px rgba(0, 0, 0, 0.2);
  margin-bottom: 8px;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.gx-action-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 20px rgba(0, 0, 0, 0.3);
}

.gx-action-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.gx-action-priority {
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-p0 { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-p1 { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.badge-p2 { background: rgba(0, 224, 255, 0.1); color: var(--brand-accent, #00e0ff); }

.gx-action-owner {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
}

.gx-action-title {
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.gx-action-desc {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
  margin-top: 4px;
}

/* GX Sources */
.gx-sources-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  color: rgba(255, 255, 255, 0.3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: inherit;
  transition: color 0.2s;
}
.gx-sources-toggle:hover { color: var(--brand-accent, #00e0ff); }

.gx-info-icon { display: flex; align-items: center; }
.gx-info-icon svg { width: 14px; height: 14px; }

.gx-sources-panel {
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
  backdrop-filter: blur(40px) saturate(1.2);
  -webkit-backdrop-filter: blur(40px) saturate(1.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 2px 12px rgba(0, 0, 0, 0.2);
}

.gx-source-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.gx-source-item:last-child { border-bottom: none; }

.gx-source-label {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
}

.gx-source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.gx-source-meta span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
}

.gx-source-type {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gx-source-internal .gx-source-type { color: rgba(34, 197, 94, 0.8); }
.gx-source-external .gx-source-type { color: rgba(0, 224, 255, 0.8); }

/* GX Source Drill-Down */
.gx-source-item-header {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  transition: opacity 0.15s ease;
}
.gx-source-item-header:hover { opacity: 0.85; }

.gx-source-expand-icon {
  display: flex;
  align-items: center;
  margin-left: auto;
  color: rgba(255, 255, 255, 0.3);
  transition: transform 0.15s ease;
}
.gx-source-item--expanded .gx-source-expand-icon {
  transform: rotate(180deg);
}

.gx-source-detail {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.gx-source-detail-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
}
.gx-source-detail-row:last-child { margin-bottom: 0; }

.gx-source-detail-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
  min-width: 72px;
}

.gx-source-detail-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gx-source-confidence-bar {
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.gx-source-confidence-fill {
  height: 100%;
  border-radius: 2px;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
  transition: width 0.3s ease;
}

.gx-source-confidence-pct {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  .gx-info-trigger,
  .gx-info-chevron,
  .gx-source-item-header,
  .gx-source-expand-icon,
  .gx-source-confidence-fill,
  .gx-target-card,
  .gx-insight-card,
  .gx-action-card {
    transition: none;
  }
}
