/* I·AM·Xhe - Core Design System */
/* Sovereign Cyberpunk / Terminal Realism */

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

:root {
  /* Colors */
  --bg-void: #050505;
  --bg-panel: #0A0A0A;
  --bg-panel-hover: #111111;
  --text-primary: #E0E0E0;
  --text-secondary: #888888;
  --text-muted: #444444;
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-active: rgba(255, 255, 255, 0.3);
  --accent-cyan: #00F0FF;
  --accent-green: #00FF94;
  --accent-red: #FF003C;
  --accent-purple: #7000FF;
  --glow-cyan: 0 0 10px rgba(0, 240, 255, 0.5);
  --glow-green: 0 0 10px rgba(0, 255, 148, 0.5);
  --glow-red: 0 0 10px rgba(255, 0, 60, 0.5);
  
  /* Typography */
  --font-heading: 'Unbounded', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Spacing */
  --p-sm: 8px;
  --p-md: 16px;
  --p-lg: 24px;
  --p-xl: 32px;
  --gap-sm: 8px;
  --gap-md: 16px;
  --gap-lg: 24px;
  
  /* Borders */
  --radius-sm: 2px;
  --radius-md: 4px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

/* Scanline Effect */
.scanline-overlay {
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0) 50%,
    rgba(0,0,0,0.2) 50%,
    rgba(0,0,0,0.2) 100%
  );
  background-size: 100% 4px;
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  opacity: 0.1;
}

/* Shell Layout */
.xhe-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

@media (max-width: 768px) {
  .xhe-shell {
    grid-template-columns: 1fr;
  }
  .xhe-sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transition: left 0.2s ease;
  }
  .xhe-sidebar.open {
    left: 0;
  }
  .mobile-toggle {
    display: block !important;
  }
}

/* Sidebar Navigation */
.xhe-sidebar {
  background-color: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  padding: var(--p-lg);
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
  overflow-y: auto;
  height: 100vh;
  position: sticky;
  top: 0;
}

.xhe-logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--accent-cyan);
  text-decoration: none;
  letter-spacing: 2px;
  padding-bottom: var(--p-md);
  border-bottom: 1px solid var(--border-subtle);
  text-shadow: var(--glow-cyan);
}

.xhe-nav {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

.xhe-nav-link {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: var(--p-sm) var(--p-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  border-left: 2px solid transparent;
  transition: all 0.1s steps(2);
}

.xhe-nav-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-panel-hover);
  border-left-color: var(--accent-cyan);
}

.xhe-nav-link.active {
  color: var(--accent-cyan);
  border-left-color: var(--accent-cyan);
  background-color: rgba(0, 240, 255, 0.05);
}

.xhe-nav-link .nav-index {
  color: var(--text-muted);
  font-size: 0.75rem;
  min-width: 24px;
}

/* Main Content */
.xhe-main {
  padding: var(--p-xl);
  max-width: 1200px;
}

/* Page Header */
.xhe-page-header {
  margin-bottom: var(--p-xl);
  padding-bottom: var(--p-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.xhe-page-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--accent-cyan);
  margin-bottom: var(--p-sm);
  text-shadow: var(--glow-cyan);
}

.xhe-page-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Panels */
.xhe-panel {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  padding: var(--p-lg);
  position: relative;
  margin-bottom: var(--p-lg);
}

.xhe-panel::before,
.xhe-panel::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid var(--accent-cyan);
}

.xhe-panel::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.xhe-panel::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}

.xhe-panel-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: var(--p-md);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Grid Layout */
.xhe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gap-lg);
}

/* Buttons */
.xhe-btn {
  background: transparent;
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  padding: var(--p-sm) var(--p-md);
  font-family: var(--font-heading);
  font-size: 0.875rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.1s steps(2);
  letter-spacing: 1px;
}

.xhe-btn:hover {
  background: var(--accent-cyan);
  color: var(--bg-void);
  box-shadow: var(--glow-cyan);
}

.xhe-btn:focus {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.xhe-btn--green {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.xhe-btn--green:hover {
  background: var(--accent-green);
  color: var(--bg-void);
  box-shadow: var(--glow-green);
}

.xhe-btn--red {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.xhe-btn--red:hover {
  background: var(--accent-red);
  color: var(--bg-void);
  box-shadow: var(--glow-red);
}

.xhe-btn--purple {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}

.xhe-btn--purple:hover {
  background: var(--accent-purple);
  color: var(--text-primary);
}

/* Inputs */
.xhe-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1rem;
  width: 100%;
  padding: var(--p-sm) 0;
  outline: none;
  transition: border-color 0.1s;
}

.xhe-input:focus {
  border-bottom-color: var(--accent-green);
}

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

.xhe-textarea {
  background: var(--bg-void);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  width: 100%;
  padding: var(--p-md);
  resize: vertical;
  min-height: 120px;
  outline: none;
}

.xhe-textarea:focus {
  border-color: var(--accent-green);
}

/* Form Groups */
.xhe-form-group {
  margin-bottom: var(--p-lg);
}

.xhe-label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--p-sm);
}

/* Data Display */
.xhe-hash {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-green);
  word-break: break-all;
  background: rgba(0, 255, 148, 0.05);
  padding: var(--p-sm);
  border-left: 2px solid var(--accent-green);
}

.xhe-code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--bg-void);
  padding: var(--p-md);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  white-space: pre-wrap;
}

/* Status Indicators */
.xhe-status {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.xhe-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.xhe-status--active::before {
  background: var(--accent-green);
  box-shadow: var(--glow-green);
}

.xhe-status--warning::before {
  background: #FFB800;
  box-shadow: 0 0 10px rgba(255, 184, 0, 0.5);
}

.xhe-status--error::before {
  background: var(--accent-red);
  box-shadow: var(--glow-red);
}

/* Lists */
.xhe-list {
  list-style: none;
}

.xhe-list-item {
  padding: var(--p-md);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.1s;
}

.xhe-list-item:hover {
  background-color: var(--bg-panel-hover);
}

.xhe-list-item:last-child {
  border-bottom: none;
}

/* Tables */
.xhe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.xhe-table th,
.xhe-table td {
  padding: var(--p-md);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.xhe-table th {
  color: var(--text-secondary);
  font-weight: normal;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 1px;
}

.xhe-table tr:hover td {
  background-color: var(--bg-panel-hover);
}

/* Tags */
.xhe-tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.xhe-tag--cyan {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.xhe-tag--green {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.xhe-tag--red {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* Alerts */
.xhe-alert {
  padding: var(--p-md);
  border-left: 3px solid var(--accent-cyan);
  background: rgba(0, 240, 255, 0.05);
  margin-bottom: var(--p-lg);
}

.xhe-alert--warning {
  border-left-color: #FFB800;
  background: rgba(255, 184, 0, 0.05);
}

.xhe-alert--error {
  border-left-color: var(--accent-red);
  background: rgba(255, 0, 60, 0.05);
}

.xhe-alert--success {
  border-left-color: var(--accent-green);
  background: rgba(0, 255, 148, 0.05);
}

/* Progress */
.xhe-progress {
  height: 4px;
  background: var(--border-subtle);
  overflow: hidden;
}

.xhe-progress-bar {
  height: 100%;
  background: var(--accent-cyan);
  transition: width 0.3s;
}

/* Modal */
.xhe-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 5, 5, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.xhe-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.xhe-modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

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

.xhe-modal-title {
  font-family: var(--font-heading);
  color: var(--accent-cyan);
}

.xhe-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.xhe-modal-close:hover {
  color: var(--text-primary);
}

.xhe-modal-body {
  padding: var(--p-lg);
}

.xhe-modal-footer {
  padding: var(--p-lg);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: var(--gap-md);
  justify-content: flex-end;
}

/* Pulse Animation */
@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.xhe-pulse {
  animation: pulse-glow 2s infinite;
}

/* Loading */
.xhe-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Tooltip */
.xhe-tooltip {
  position: relative;
}

.xhe-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  padding: var(--p-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.1s;
}

.xhe-tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Mobile Toggle */
.mobile-toggle {
  display: none;
  position: fixed;
  top: var(--p-md);
  left: var(--p-md);
  z-index: 1001;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--accent-cyan);
  padding: var(--p-sm);
  cursor: pointer;
}

/* Blur sensitive data */
.xhe-sensitive {
  filter: blur(4px);
  transition: filter 0.2s;
}

.xhe-sensitive:hover,
.xhe-sensitive.revealed {
  filter: blur(0);
}

/* Section Divider */
.xhe-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--p-xl) 0;
}

/* Constitution specific styles */
.xhe-principle {
  padding: var(--p-lg);
  border-left: 3px solid var(--accent-cyan);
  margin-bottom: var(--p-lg);
  background: rgba(0, 240, 255, 0.02);
}

.xhe-principle-title {
  font-family: var(--font-heading);
  color: var(--accent-cyan);
  font-size: 1.25rem;
  margin-bottom: var(--p-sm);
}

.xhe-principle-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Pulsar visual */
.xhe-pulsar {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  padding: var(--p-md);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  margin-bottom: var(--p-sm);
}

.xhe-pulsar-index {
  color: var(--text-muted);
  font-size: 0.75rem;
  min-width: 40px;
}

.xhe-pulsar-type {
  color: var(--accent-purple);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.xhe-pulsar-hash {
  color: var(--accent-green);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

/* Identity Card */
.xhe-identity-card {
  background: var(--bg-panel);
  border: 1px solid var(--accent-cyan);
  padding: var(--p-lg);
  position: relative;
}

.xhe-identity-card::before {
  content: 'SOVEREIGN IDENTITY';
  position: absolute;
  top: -10px;
  left: var(--p-md);
  background: var(--bg-void);
  padding: 0 var(--p-sm);
  font-size: 0.625rem;
  color: var(--accent-cyan);
  letter-spacing: 2px;
}

/* Log/Console Output */
.xhe-console {
  background: #000;
  border: 1px solid var(--border-subtle);
  padding: var(--p-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
}

.xhe-console-line {
  margin-bottom: 4px;
}

.xhe-console-timestamp {
  color: var(--text-muted);
}

.xhe-console-info {
  color: var(--accent-cyan);
}

.xhe-console-success {
  color: var(--accent-green);
}

.xhe-console-error {
  color: var(--accent-red);
}

.xhe-console-warn {
  color: #FFB800;
}

/* Utility Classes */
.text-cyan { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-purple { color: var(--accent-purple); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.mt-sm { margin-top: var(--p-sm); }
.mt-md { margin-top: var(--p-md); }
.mt-lg { margin-top: var(--p-lg); }
.mb-sm { margin-bottom: var(--p-sm); }
.mb-md { margin-bottom: var(--p-md); }
.mb-lg { margin-bottom: var(--p-lg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--gap-sm); }
.gap-md { gap: var(--gap-md); }
.gap-lg { gap: var(--gap-lg); }

.hidden { display: none; }
.w-full { width: 100%; }
