/* ==========================================================================
   XIMOS Parental Control & Remote Monitoring Web Suite
   Pure CSS3 Stylesheet - Modern, Responsive, Light & Dark Theme
   ========================================================================== */

:root {
  /* Sophisticated Dark Color Palette - Deep Slate / Emerald Accent */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-serif: "Playfair Display", Georgia, Cambria, "Times New Roman", Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Sophisticated Dark Theme (Default) */
  --bg-app: #070b14;
  --bg-surface: #0a101f;
  --bg-surface-elevated: #0f172a;
  --bg-surface-sidebar: #080d1a;
  --bg-card: rgba(10, 16, 31, 0.85);
  --bg-card-hover: #111a2e;
  --bg-input: #050811;
  --bg-highlight: rgba(16, 185, 129, 0.15);
  
  --border-subtle: #1e293b;
  --border-medium: #334155;
  --border-focus: #10b981;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-inverse: #070b14;

  /* Accent Colors */
  --accent-primary: #10b981;
  --accent-primary-hover: #059669;
  --accent-green: #10b981;
  --accent-emerald: #34d399;
  --accent-blue: #38bdf8;
  --accent-cyan: #06b6d4;
  --accent-amber: #f59e0b;
  --accent-orange: #fb923c;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;

  /* Badges & Indicators */
  --badge-bg-primary: rgba(16, 185, 129, 0.12);
  --badge-text-primary: #34d399;
  --badge-border-primary: rgba(16, 185, 129, 0.25);

  --badge-bg-blue: rgba(56, 189, 248, 0.12);
  --badge-text-blue: #38bdf8;
  --badge-border-blue: rgba(56, 189, 248, 0.25);

  --badge-bg-green: rgba(16, 185, 129, 0.12);
  --badge-text-green: #34d399;
  --badge-border-green: rgba(16, 185, 129, 0.25);

  --badge-bg-amber: rgba(245, 158, 11, 0.12);
  --badge-text-amber: #fbbf24;
  --badge-border-amber: rgba(245, 158, 11, 0.25);

  --badge-bg-red: rgba(239, 68, 68, 0.12);
  --badge-text-red: #f87171;
  --badge-border-red: rgba(239, 68, 68, 0.25);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px -5px rgba(16, 185, 129, 0.35);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --nav-height: 72px;
  --toc-width: 290px;
  --content-max-width: 1240px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Light Theme Variables (Maintains high-contrast elegance) */
body.light-theme {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-sidebar: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f1f5f9;
  --bg-highlight: rgba(16, 185, 129, 0.15);
  
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #10b981;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --accent-primary: #059669;
  --accent-primary-hover: #047857;
  --accent-green: #059669;
  --accent-emerald: #059669;

  --badge-bg-primary: rgba(16, 185, 129, 0.1);
  --badge-text-primary: #059669;
  --badge-border-primary: rgba(16, 185, 129, 0.2);

  --badge-bg-blue: rgba(2, 132, 199, 0.1);
  --badge-text-blue: #0284c7;
  --badge-border-blue: rgba(2, 132, 199, 0.2);

  --badge-bg-green: rgba(16, 185, 129, 0.1);
  --badge-text-green: #059669;
  --badge-border-green: rgba(16, 185, 129, 0.2);

  --badge-bg-amber: rgba(245, 158, 11, 0.1);
  --badge-text-amber: #d97706;
  --badge-border-amber: rgba(245, 158, 11, 0.2);

  --badge-bg-red: rgba(239, 68, 68, 0.1);
  --badge-text-red: #dc2626;
  --badge-border-red: rgba(239, 68, 68, 0.2);

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 20px -4px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 0 20px -3px rgba(16, 185, 129, 0.2);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

a {
  color: var(--badge-text-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* Reading Progress Bar */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #34d399, #38bdf8);
  width: 0%;
  z-index: 1000;
  transition: width 0.1s ease-out;
}

/* Header & Navigation */
.header-nav {
  position: sticky;
  top: 0;
  z-index: 900;
  height: var(--nav-height);
  background: rgba(10, 16, 31, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

body.light-theme .header-nav {
  background: rgba(255, 255, 255, 0.92);
}

.nav-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon-box {
  width: 40px;
  height: 40px;
  background: #10b981;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #070b14;
  font-weight: 900;
  font-size: 1.25rem;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.35);
  transition: transform var(--transition-fast);
}

.brand-wrapper:hover .brand-icon-box {
  transform: scale(1.04);
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-primary);
}

.brand-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #10b981;
}

.brand-subtitle {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
}

/* Nav Tabs & Switcher */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

body.light-theme .nav-tabs {
  background: #f1f5f9;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn svg {
  width: 16px;
  height: 16px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}

body.light-theme .tab-btn.active {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

/* Nav Controls */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-indicator-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.theme-toggle-btn, .mobile-menu-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover, .mobile-menu-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.mobile-menu-btn {
  display: none;
}

/* Hero Section */
.hero-banner {
  background: radial-gradient(circle at 50% -20%, rgba(16, 185, 129, 0.12) 0%, transparent 65%), var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 3.5rem 1.5rem 2.75rem;
  position: relative;
  overflow: hidden;
}

.hero-content {
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 2;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.95rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #34d399;
  margin-bottom: 1.25rem;
}

.hero-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.hero-breadcrumb .active-crumb {
  color: #10b981;
  font-weight: 700;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.hero-title.serif-styled {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
}

.hero-title .highlight {
  color: #10b981;
}

.hero-desc {
  max-width: 720px;
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
  line-height: 1.6;
}

/* Global Search & Action Bar */
.search-action-bar {
  width: 100%;
  max-width: 700px;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.9375rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.search-clear-btn {
  position: absolute;
  right: 0.85rem;
  color: var(--text-muted);
  display: none;
  padding: 4px;
}

.search-clear-btn:hover {
  color: var(--text-primary);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: var(--border-subtle);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.action-btn.primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #070b14;
  font-weight: 700;
}

.action-btn.primary:hover {
  background: var(--accent-primary-hover);
  color: #ffffff;
}

/* Document Meta Bar */
.doc-meta-strip {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.doc-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.doc-meta-item svg {
  width: 15px;
  height: 15px;
  color: #10b981;
}

/* Main Layout Grid */
.main-wrapper {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: var(--toc-width) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
  flex: 1;
  width: 100%;
}

/* Sticky Sidebar Table of Contents */
.sidebar-toc {
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
  background: var(--bg-surface-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  max-height: calc(100vh - var(--nav-height) - 3rem);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.toc-header {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.toc-link {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: all var(--transition-fast);
  line-height: 1.4;
}

.toc-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

.toc-link.active {
  color: #34d399;
  background: rgba(16, 185, 129, 0.1);
  border-left-color: #10b981;
  font-weight: 600;
}

.toc-sublink {
  padding-left: 1.4rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Sidebar System Status Card */
.sidebar-status-card {
  padding: 1rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-top: auto;
}

.status-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.status-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.status-score-value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #10b981;
}

.status-progress-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.status-progress-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: var(--radius-full);
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.sidebar-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* Document Content Area */
.document-content-area {
  min-width: 0;
}

.page-view {
  display: none;
}

.page-view.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

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

/* Callout & Alert Boxes */
.callout-box {
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-primary);
  background: rgba(10, 16, 31, 0.6);
}

.callout-box.info {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.2);
  border-left-color: #10b981;
  color: var(--text-primary);
}

.callout-box.warning {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.2);
  border-left-color: #f59e0b;
  color: var(--text-primary);
}

.callout-box.danger {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.2);
  border-left-color: #ef4444;
  color: var(--text-primary);
}

.callout-box.success {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.2);
  border-left-color: #10b981;
  color: var(--text-primary);
}

.callout-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 2px;
}

.callout-box.info .callout-icon { color: #10b981; }
.callout-box.warning .callout-icon { color: var(--accent-amber); }
.callout-box.danger .callout-icon { color: var(--accent-red); }
.callout-box.success .callout-icon { color: #10b981; }

.callout-text h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.callout-text p {
  font-size: 0.9125rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Quick Summary Highlights Grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.summary-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.35);
}

.summary-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
}

.summary-card-header svg {
  width: 18px;
  height: 18px;
  color: #10b981;
}

.summary-card p {
  font-size: 0.84375rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Data Retention Grid Widget */
.retention-grid-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.retention-grid-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.retention-live-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.retention-items-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

.retention-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  gap: 0.75rem;
}

.retention-item-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.retention-icon-box {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.retention-icon-box.blue {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
}

.retention-icon-box.orange {
  background: rgba(251, 146, 60, 0.12);
  color: #fb923c;
}

.retention-icon-box.green {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

.retention-item-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.retention-item-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
}

/* Legal Article Sections */
.legal-article {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.article-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.article-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.article-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.article-number-bar {
  display: inline-block;
  width: 3px;
  height: 10px;
  background: #10b981;
  border-radius: 1px;
}

.article-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.article-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  transition: all var(--transition-fast);
}

.article-copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.article-body {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.article-body p {
  margin-bottom: 1rem;
}

.article-body p:last-child {
  margin-bottom: 0;
}

.article-body ul, .article-body ol {
  margin: 1rem 0 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.article-body li {
  line-height: 1.6;
}

.article-body strong {
  color: var(--text-primary);
}

/* Permissions Matrix Table / Interactive Cards */
.permissions-container {
  margin: 1.5rem 0;
}

.permissions-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.perm-filter-btn {
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.perm-filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.perm-filter-btn.active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.perm-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: all var(--transition-fast);
}

.perm-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
}

.perm-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.perm-code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.08);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  word-break: break-all;
}

.perm-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.perm-badge.critical {
  background: var(--badge-bg-red);
  color: var(--badge-text-red);
  border: 1px solid var(--badge-border-red);
}

.perm-badge.normal {
  background: var(--badge-bg-blue);
  color: var(--badge-text-blue);
  border: 1px solid var(--badge-border-blue);
}

.perm-badge.special {
  background: var(--badge-bg-amber);
  color: var(--badge-text-amber);
  border: 1px solid var(--badge-border-amber);
}

.perm-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
}

.perm-desc {
  font-size: 0.84375rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.perm-usage {
  font-size: 0.78125rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.5rem;
  margin-top: auto;
}

/* Open Source Licenses Styles */
.licenses-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.licenses-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.license-filter-btn {
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.license-filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.license-filter-btn.active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.license-search-box {
  width: 240px;
  position: relative;
}

.license-search-box input {
  width: 100%;
  padding: 0.45rem 0.75rem 0.45rem 2rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}

.license-search-box input:focus {
  border-color: var(--border-focus);
}

.license-search-box svg {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.package-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.package-card:hover {
  border-color: rgba(16, 185, 129, 0.35);
  transform: translateY(-2px);
}

.package-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.package-title-group {
  display: flex;
  flex-direction: column;
}

.package-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.package-author {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.package-badge {
  font-size: 0.71875rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.package-badge.apache {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.package-badge.mit {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.package-badge.bsd {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.package-badge.google {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.package-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.package-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
}

.package-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
}

.package-link:hover {
  color: #34d399;
}

.view-license-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  color: #34d399;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  transition: all var(--transition-fast);
}

.view-license-btn:hover {
  background: rgba(16, 185, 129, 0.25);
}

/* Full License Modal / Drawer */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.license-modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.modal-close-btn:hover {
  color: var(--text-primary);
  background: var(--border-subtle);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--bg-input);
  white-space: pre-wrap;
  user-select: text;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-surface-elevated);
}

/* Search Highlight */
mark.search-matched {
  background: #10b981;
  color: #070b14;
  padding: 1px 3px;
  border-radius: 2px;
  font-weight: 700;
}

/* Floating Back to Top Button */
.back-to-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: #10b981;
  color: #070b14;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg), 0 0 20px rgba(16, 185, 129, 0.4);
  z-index: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: all var(--transition-normal);
}

.back-to-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top-btn:hover {
  background: #059669;
  color: #ffffff;
  transform: translateY(-3px);
}

/* Footer Styles */
.footer-section {
  background: #050912;
  border-top: 1px solid var(--border-subtle);
  padding: 3.5rem 1.5rem 2rem;
  margin-top: auto;
}

.footer-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.footer-top {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 2.5rem;
}

.footer-brand-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
  max-width: 320px;
  line-height: 1.6;
}

.footer-col h5 {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: #34d399;
  text-decoration: none;
}

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 2px 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-message {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
  animation: slideUp 0.25s ease;
}

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

/* Print Styles */
@media print {
  .header-nav, .hero-banner, .sidebar-toc, .search-action-bar, .theme-toggle-btn, .back-to-top-btn, .footer-section, .nav-tabs {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .main-wrapper {
    display: block !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  .legal-article, .summary-card, .perm-card, .package-card {
    border: 1px solid #cccccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 1.5rem !important;
  }

  .article-title, .article-number, strong, h1, h2, h3, h4 {
    color: #000000 !important;
  }
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 1024px) {
  .main-wrapper {
    grid-template-columns: 1fr;
  }

  .sidebar-toc {
    display: none;
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav-tabs {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .hero-title {
    font-size: 1.85rem;
  }

  .search-action-bar {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
    justify-content: center;
  }

  .footer-top {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Mobile Drawer */
.mobile-drawer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1050;
  display: none;
}

.mobile-drawer.active {
  display: block;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 290px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideLeft 0.25s ease;
}

@keyframes slideLeft {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
}

.drawer-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.drawer-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  transition: all var(--transition-fast);
}

.drawer-nav-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
}
