/*
 * Rogue Logics — Shared Global Styles
 * Source of truth: ~/apps/shared-assets/public/shared-global.css
 * Served at: /shared/shared-global.css
 * Used by: all Rogue Logics apps
 *
 * Defines CSS custom properties for the RL color system.
 * Components reference these variables so color changes here
 * cascade to every app automatically.
 */

/* ── Light mode tokens ───────────────────────────────────── */
:root {
  /* Surfaces */
  --rl-sidebar-bg: #ffffff;
  --rl-sidebar-border: #e2e8f0;
  --rl-header-bg: #ffffff;
  --rl-header-border: #e2e8f0;

  /* Nav links */
  --rl-nav-text: #334155;
  --rl-nav-text-hover: #0f172a;
  --rl-nav-text-active: #1d4ed8;
  --rl-nav-bg-hover: #f1f5f9;
  --rl-nav-bg-active: #eff6ff;

  /* Nav section labels */
  --rl-nav-section: #94a3b8;

  /* Nav icons */
  --rl-nav-icon: #94a3b8;
  --rl-nav-icon-active: #2563eb;

  /* Logout */
  --rl-nav-logout-text: #64748b;
  --rl-nav-logout-bg-hover: #fff1f2;
  --rl-nav-logout-text-hover: #dc2626;

  /* Dividers */
  --rl-divider: #e2e8f0;

  /* Header text */
  --rl-header-title: #0f172a;
  --rl-header-desc: #94a3b8;
  --rl-header-icon: #94a3b8;
  --rl-header-icon-hover-bg: #f1f5f9;
  --rl-header-icon-hover: #475569;

  /* Brand */
  --rl-brand-blue: #2563eb;
  --rl-brand-teal: #2eb8b8;
}

/* ── Dark mode tokens ────────────────────────────────────── */
html.dark {
  /* Surfaces */
  --rl-sidebar-bg: #0d1b2a;
  --rl-sidebar-border: rgba(255, 255, 255, 0.07);
  --rl-header-bg: #0d1b2a;
  --rl-header-border: rgba(255, 255, 255, 0.07);

  /* Nav links */
  --rl-nav-text: #cbd5e1;
  --rl-nav-text-hover: #f1f5f9;
  --rl-nav-text-active: #93c5fd;
  --rl-nav-bg-hover: rgba(255, 255, 255, 0.06);
  --rl-nav-bg-active: rgba(59, 130, 246, 0.12);

  /* Nav section labels — brighter for dark bg visibility */
  --rl-nav-section: #94a3b8;

  /* Nav icons */
  --rl-nav-icon: #64748b;
  --rl-nav-icon-active: #60a5fa;

  /* Logout */
  --rl-nav-logout-text: #94a3b8;
  --rl-nav-logout-bg-hover: rgba(239, 68, 68, 0.08);
  --rl-nav-logout-text-hover: #f87171;

  /* Dividers */
  --rl-divider: rgba(255, 255, 255, 0.07);

  /* Header text */
  --rl-header-title: #f1f5f9;
  --rl-header-desc: #94a3b8;
  --rl-header-icon: #94a3b8;
  --rl-header-icon-hover-bg: rgba(255, 255, 255, 0.06);
  --rl-header-icon-hover: #f1f5f9;

  /* Brand */
  --rl-brand-blue: #3b82f6;
  --rl-brand-teal: #2eb8b8;
}

/* ── Logo dark mode filter ──────────────────────────────── */
html.dark .rl-logo {
  filter: brightness(0) invert(1);
}

/* ── LeftNav component styles ────────────────────────────── */
[data-leftnav] {
  background: var(--rl-sidebar-bg);
  border-color: var(--rl-sidebar-border);
}
[data-leftnav-divider] {
  color: var(--rl-nav-section);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 20px 12px 4px;
}
[data-leftnav-link] {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--rl-nav-text);
  text-decoration: none;
  transition:
    background 0.1s,
    color 0.1s;
}
[data-leftnav-link]:hover {
  background: var(--rl-nav-bg-hover);
  color: var(--rl-nav-text-hover);
}
[data-leftnav-link][data-active="true"] {
  background: var(--rl-nav-bg-active);
  color: var(--rl-nav-text-active);
  font-weight: 500;
}
[data-leftnav-icon] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--rl-nav-icon);
  display: flex;
  align-items: center;
  justify-content: center;
}
[data-leftnav-icon] svg {
  width: 16px;
  height: 16px;
}
[data-leftnav-link][data-active="true"] [data-leftnav-icon] {
  color: var(--rl-nav-icon-active);
}
[data-leftnav-logout] {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 400;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--rl-nav-logout-text);
  transition:
    background 0.1s,
    color 0.1s;
  font-family: inherit;
}
[data-leftnav-logout]:hover {
  background: var(--rl-nav-logout-bg-hover);
  color: var(--rl-nav-logout-text-hover);
}
[data-leftnav-border] {
  border-top: 1px solid var(--rl-divider);
}
[data-leftnav-logo-border] {
  border-bottom: 1px solid var(--rl-divider);
}

/* ── LeftNav collapsible group styles ────────────────────── */
.rl-nav-group {
}
.rl-nav-group-header {
  display: flex;
  align-items: center;
  width: 100%;
  border-radius: var(--rl-radius-sm, 6px);
}
.rl-nav-group-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.4375rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--rl-nav-text, var(--rl-text-muted));
  text-decoration: none;
  border-radius: var(--rl-radius-sm, 6px) 0 0 var(--rl-radius-sm, 6px);
  transition:
    color 0.15s,
    background 0.15s;
  min-width: 0;
}
.rl-nav-group-link:hover,
.rl-nav-group-link.active {
  color: var(--rl-nav-text-active, var(--rl-text-heading));
  background: var(--rl-nav-bg-active, rgba(255, 255, 255, 0.06));
}
.rl-nav-group-link.active {
  font-weight: 600;
}
.rl-nav-group-chevron {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  background: transparent;
  color: var(--rl-nav-section);
  cursor: pointer;
  border-radius: 0 var(--rl-radius-sm, 6px) var(--rl-radius-sm, 6px) 0;
  transition:
    color 0.15s,
    background 0.15s,
    transform 0.2s;
  padding: 0;
}
.rl-nav-group-chevron:hover {
  background: var(--rl-nav-bg-hover);
  color: var(--rl-nav-text-hover);
}
.rl-nav-group-chevron.open {
  transform: rotate(90deg);
}
.rl-nav-group-children {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}
.rl-nav-group-children.open {
  max-height: 20rem;
}
.rl-nav-group-child {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.625rem 0.35rem 2rem;
  font-size: 0.775rem;
  color: var(--rl-nav-text);
  text-decoration: none;
  border-radius: var(--rl-radius-sm, 6px);
  border-left: 2px solid transparent;
  transition:
    color 0.15s,
    background 0.15s,
    border-color 0.15s;
}
.rl-nav-group-child:hover {
  color: var(--rl-nav-text-hover, var(--rl-nav-text-active));
  background: var(--rl-nav-bg-hover);
  border-left-color: var(--rl-nav-bg-hover);
}
.rl-nav-group-child.active {
  color: var(--rl-nav-text-active);
  background: var(--rl-nav-bg-active);
  font-weight: 600;
  border-left-color: var(--rl-accent, #3b82f6);
}
[data-leftnav-child-link] span[aria-hidden] {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  flex-shrink: 0;
  font-size: 0;
  line-height: 1;
}

/* ── Header component styles ─────────────────────────────── */
[data-app-header] {
  background: var(--rl-header-bg);
  border-bottom: 1px solid var(--rl-header-border);
  box-shadow: none;
}
[data-header-icon-btn] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: none;
  cursor: pointer;
  transition:
    background 0.1s,
    color 0.1s;
  color: var(--rl-header-icon);
  text-decoration: none;
}
[data-header-icon-btn]:hover {
  background: var(--rl-header-icon-hover-bg);
  color: var(--rl-header-icon-hover);
}

/* ── Framework card (readiness hub & similar grids) ──────── */
/*
 * .rl-fw-card  — a card that works in both dark and light mode.
 * Dark: semi-transparent dark surface with subtle border.
 * Light: white card with soft border and shadow.
 * Apply a --rl-fw-accent CSS variable on the element itself (or inline)
 * for the top accent bar and tint colors.
 */
.rl-fw-card {
  background: rgba(15, 30, 50, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.rl-fw-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

html.light .rl-fw-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
html.light .rl-fw-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* In light mode, icon tint background and tag backgrounds should be very subtle */
html.light .rl-fw-card-icon {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}
html.light .rl-fw-card-tag {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border-color: #e2e8f0 !important;
}

/* Accent top bar */
.rl-fw-card-accent {
  height: 3px;
  width: 100%;
  flex-shrink: 0;
}

/* Card body */
.rl-fw-card-body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

/* Icon container */
.rl-fw-card-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* Short name label above display name */
.rl-fw-card-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.125rem;
  color: rgba(148, 163, 184, 0.9); /* slate-400 in dark */
}
html.light .rl-fw-card-label {
  color: #64748b;
}

/* Display name */
.rl-fw-card-name {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
  color: #ffffff;
}
html.light .rl-fw-card-name {
  color: #0f172a;
}

/* Description */
.rl-fw-card-description {
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(148, 163, 184, 1); /* slate-400 */
  flex: 1;
}
html.light .rl-fw-card-description {
  color: #475569;
}

/* Audience tags */
.rl-fw-card-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  border-width: 1px;
  border-style: solid;
}

/* CTA row */
.rl-fw-card-cta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: auto;
  padding-top: 0.5rem;
  transition: gap 0.2s ease;
}
.rl-fw-card:hover .rl-fw-card-cta {
  gap: 0.625rem;
}
html.light .rl-fw-card-cta {
  color: #334155;
}
