/* ============================================================
   Entra RoleLens — Design System
   Premium dark theme with glassmorphism and micro-animations.
   ============================================================ */

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

/* ---- CSS Custom Properties ---- */
:root {
  /* Color palette — deep blues with electric accents */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --bg-glass: rgba(15, 23, 42, 0.6);
  --bg-input: rgba(30, 41, 59, 0.5);

  --border-default: rgba(71, 85, 105, 0.3);
  --border-hover: rgba(99, 102, 241, 0.5);
  --border-focus: rgba(99, 102, 241, 0.8);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #818cf8;

  --accent-primary: #6366f1;
  --accent-primary-hover: #818cf8;
  --accent-secondary: #06b6d4;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-info: #3b82f6;

  /* Confidence badge colors */
  --confidence-high: #10b981;
  --confidence-medium: #f59e0b;
  --confidence-low: #f97316;
  --confidence-none: #ef4444;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Layout ---- */
#app {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 2rem;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header__logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  box-shadow: var(--shadow-glow);
}

.header__title {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--text-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header__subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ---- Navigation ---- */
.nav {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 0.25rem;
}

.nav__btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav__btn:hover {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.1);
}

.nav__btn--active {
  background: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* ---- Status Bar ---- */
.status-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.status-bar__item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.status-bar__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.status-bar__dot--ok { background: var(--accent-success); }
.status-bar__dot--warn { background: var(--accent-warning); }
.status-bar__dot--error { background: var(--accent-danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---- Disclaimer Banner ---- */
.disclaimer {
  padding: 0.75rem 1rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: 0.8rem;
  color: var(--accent-warning);
  line-height: 1.5;
}

.disclaimer strong {
  color: var(--accent-warning);
}

/* ---- Search ---- */
.search-container {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

/* ---- Filter bar ---- */
.filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--border-default);
  border-radius: 99px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.filter-chip--active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  color: var(--text-accent);
}

/* ---- Cards / Role List ---- */
.role-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.role-card {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.role-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.role-card__info {
  flex: 1;
  min-width: 0;
}

.role-card__name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}

.role-card__desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-card__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.role-card__perms {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge--documented {
  background: rgba(16, 185, 129, 0.12);
  color: var(--confidence-high);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge--fuzzy {
  background: rgba(245, 158, 11, 0.12);
  color: var(--confidence-medium);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge--weak {
  background: rgba(249, 115, 22, 0.12);
  color: var(--confidence-low);
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.badge--not-found {
  background: rgba(239, 68, 68, 0.12);
  color: var(--confidence-none);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge--unknown {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(100, 116, 139, 0.25);
}

/* ---- Confidence Badge with tooltip ---- */
.confidence-badge {
  position: relative;
  cursor: help;
}

.confidence-badge__tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

.confidence-badge:hover .confidence-badge__tooltip {
  display: block;
}

/* ---- Detail View ---- */
.detail {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail__back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0;
  color: var(--text-accent);
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: color var(--transition-fast);
}

.detail__back:hover {
  color: var(--accent-primary-hover);
}

.detail__header {
  margin-bottom: 1.5rem;
}

.detail__name {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.detail__id {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.detail__desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.detail__section {
  margin-bottom: 2rem;
}

.detail__section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-default);
}

/* ---- Permissions List ---- */
.perm-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.perm-item {
  padding: 0.375rem 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.perm-item:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
}

/* ---- Compare View ---- */
.compare-selectors {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.compare-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}

.compare-select:focus {
  border-color: var(--border-focus);
}

.compare-vs {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  padding-bottom: 0.75rem;
}

.compare-btn {
  padding: 0.75rem 2rem;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.compare-btn:hover {
  background: var(--accent-primary-hover);
  box-shadow: var(--shadow-glow);
}

.compare-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Compare results */
.compare-results {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.compare-column {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.compare-column__title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.compare-column__count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.compare-column--shared .compare-column__title { color: var(--accent-info); }
.compare-column--only-a .compare-column__title { color: var(--accent-warning); }
.compare-column--only-b .compare-column__title { color: var(--accent-secondary); }

/* ---- Evidence Card ---- */
.evidence-card {
  padding: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-top: 0.75rem;
}

.evidence-row {
  display: flex;
  gap: 0.75rem;
  padding: 0.375rem 0;
  font-size: 0.85rem;
}

.evidence-row__label {
  color: var(--text-muted);
  font-weight: 500;
  min-width: 120px;
  flex-shrink: 0;
}

.evidence-row__value {
  color: var(--text-secondary);
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state__text {
  font-size: 1rem;
}

/* ---- Loading ---- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

.loading__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 1rem 0;
}

.pagination__btn {
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination__btn:hover:not(:disabled) {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.pagination__btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination__info {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0 0.75rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
  }

  .compare-selectors {
    grid-template-columns: 1fr;
  }

  .compare-vs {
    display: none;
  }

  .compare-results {
    grid-template-columns: 1fr;
  }

  .status-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
