/* Design Tokens & Theme Variables */
:root {
  --font-family: 'Outfit', sans-serif;
  
  /* Dark Mode Default Values */
  --bg-color: #0b0f19;
  --bg-gradient: radial-gradient(circle at 50% 50%, #111827 0%, #030712 100%);
  --panel-bg: rgba(17, 24, 39, 0.65);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-shadow: rgba(0, 0, 0, 0.4);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-highlight: #00f5a0;
  --accent-primary: #00f5a0;
  --accent-secondary: #05d5ff;
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --cmp-btn-bg: #1f2937;
  --cmp-btn-hover: #374151;
  --table-header-bg: rgba(31, 41, 55, 0.5);
  --glow-orb-1: rgba(0, 245, 160, 0.15);
  --glow-orb-2: rgba(5, 213, 255, 0.15);
}

.light-mode {
  /* Light Mode Values */
  --bg-color: #f3f4f6;
  --bg-gradient: radial-gradient(circle at 50% 50%, #f9fafb 0%, #e5e7eb 100%);
  --panel-bg: rgba(255, 255, 255, 0.75);
  --panel-border: rgba(0, 0, 0, 0.08);
  --panel-shadow: rgba(0, 0, 0, 0.08);
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --text-highlight: #059669;
  --accent-primary: #10b981;
  --accent-secondary: #0ea5e9;
  --danger-color: #dc2626;
  --danger-hover: #b91c1c;
  --cmp-btn-bg: #e5e7eb;
  --cmp-btn-hover: #d1d5db;
  --table-header-bg: rgba(229, 231, 235, 0.7);
  --glow-orb-1: rgba(16, 185, 129, 0.1);
  --glow-orb-2: rgba(14, 165, 233, 0.1);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

body {
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Background Blur Orbs */
.glow-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  animation: floatOrb 12s infinite alternate ease-in-out;
}
.orb-1 {
  top: 15%;
  left: 10%;
  width: 40vw;
  height: 40vw;
  background-color: var(--glow-orb-1);
}
.orb-2 {
  bottom: 15%;
  right: 10%;
  width: 45vw;
  height: 45vw;
  background-color: var(--glow-orb-2);
  animation-delay: -6s;
}

@keyframes floatOrb {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-40px) scale(1.1); }
}

/* Monospaced Font Class */
.monospaced {
  font-family: 'Courier New', Courier, monospace;
}

/* Helper Classes */
.hidden {
  display: none !important;
}
.text-highlight {
  color: var(--accent-primary);
  font-weight: 600;
}

/* Consent Management Platform Banner (Airtight Compliance) */
.cmp-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  max-width: 900px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  box-shadow: 0 10px 30px var(--panel-shadow);
  padding: 24px;
  z-index: 1000;
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from { transform: translate(-50%, 100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.cmp-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.cmp-text h3 {
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 6px;
}
.cmp-text p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.cmp-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

/* Airtight regulatory compliance: Reject All & Accept All MUST be identical in coloring, scaling, prominence */
.cmp-btn {
  padding: 12px 24px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background-color: var(--cmp-btn-bg);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  width: 130px;
  transition: transform 0.2s, background-color 0.2s, border-color 0.2s;
}
.cmp-btn:hover {
  background-color: var(--cmp-btn-hover);
  transform: translateY(-2px);
  border-color: var(--accent-primary);
}
.cmp-btn:active {
  transform: translateY(0);
}

/* Nav Bar */
.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 48px;
  background: rgba(11, 15, 25, 0.4);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--panel-border);
  z-index: 100;
}
.nav-logo {
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 2px;
}
.logo-accent {
  color: var(--accent-primary);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}
.version-tag {
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid var(--panel-border);
  padding: 4px 10px;
  border-radius: 20px;
}
.nav-icon-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
}
.nav-btn-primary {
  padding: 10px 20px;
  background-color: var(--text-main);
  color: var(--bg-color);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.nav-btn-primary:hover {
  opacity: 0.9;
}

/* Main Layout Views */
.view-section {
  flex: 1;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Hero Section */
.hero-section {
  text-align: center;
  max-width: 800px;
  margin: 48px auto;
}
.hero-title {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 24px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 36px;
}
.btn-large {
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #030712;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(0, 245, 160, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-large:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 25px rgba(0, 245, 160, 0.3);
}

/* Feature Cards (Public) */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 48px;
}
.feature-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 8px 32px var(--panel-shadow);
}
.feature-card h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.feature-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Dashboard Gated Layout */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
.dashboard-header h1 {
  font-weight: 900;
  font-size: 2.25rem;
}
.subtitle {
  color: var(--text-muted);
  margin-top: 4px;
}
.btn-secondary {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  border-radius: 8px;
  cursor: pointer;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
}

.db-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 12px 40px var(--panel-shadow);
}

.visualizer-card {
  grid-column: 1 / 2;
}

.siem-card {
  grid-column: 2 / 3;
  display: flex;
  flex-direction: column;
  min-height: 380px;
}

.compliance-card {
  grid-column: 1 / 3;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 12px;
}
.card-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
}

/* Switch styling for encryption toggle */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 12px;
}
.toggle-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #374151;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider {
  background-color: var(--accent-primary);
}
input:checked + .slider:before {
  transform: translateX(24px);
}
.slider.round {
  border-radius: 24px;
}
.slider.round:before {
  border-radius: 50%;
}

/* Ledger Table styling */
.table-container {
  overflow-x: auto;
  margin-bottom: 16px;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  background-color: var(--table-header-bg);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px;
  font-weight: 700;
}
td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.9rem;
}
.status-pill {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: rgba(16, 185, 129, 0.2);
  color: var(--accent-primary);
}
.encryption-key-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  border: 1px solid var(--panel-border);
  width: max-content;
  padding: 6px 12px;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.02);
}
.badge-label {
  color: var(--text-muted);
}
.badge-value {
  color: var(--accent-primary);
  font-weight: 700;
}

/* SIEM Logs Console styling */
.badge-pulse {
  background-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge-pulse::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #ef4444;
  border-radius: 50%;
  animation: pulseAnim 1.5s infinite;
}

@keyframes pulseAnim {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.siem-console {
  background-color: #030712;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.logs-container {
  overflow-y: auto;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #10b981;
  max-height: 280px;
}
.log-line {
  margin-bottom: 6px;
  border-left: 2px solid transparent;
  padding-left: 6px;
}
.log-alert {
  color: #f87171;
  border-left-color: #ef4444;
}
.log-info {
  color: #60a5fa;
  border-left-color: #3b82f6;
}

/* Compliance Dashboard styling */
.residency-selector-group {
  margin-bottom: 24px;
}
.residency-selector-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}
.styled-select {
  width: 100%;
  max-width: 450px;
  padding: 12px;
  background-color: var(--bg-color);
  color: var(--text-main);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
}
.hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.compliance-badges {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.c-badge {
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--panel-border);
  padding: 6px 14px;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.03);
}

.dsar-actions {
  border-top: 1px solid var(--panel-border);
  padding-top: 20px;
}
.dsar-actions h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.btn-group {
  display: flex;
  gap: 12px;
}
.btn-action {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  cursor: pointer;
  font-weight: 600;
}
.btn-action:hover {
  background-color: rgba(255, 255, 255, 0.1);
}
.btn-action.danger {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-action.danger:hover {
  background-color: rgba(239, 68, 68, 0.15);
}

/* Modal Overlay & Card (WebAuthn Simulator) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}
.modal-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  width: calc(100% - 32px);
  max-width: 480px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  text-align: center;
  animation: modalIn 0.3s ease-out;
}

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

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
}
.modal-header .subtitle {
  font-size: 0.9rem;
}
.security-shield {
  font-size: 3rem;
  margin-bottom: 12px;
}

.modal-body {
  margin: 32px 0;
}
.attestation-graphic {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 20px;
}
.key-ring {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 4px dashed var(--accent-primary);
  border-radius: 50%;
  animation: spinRing 4s linear infinite;
}
.key-sensor {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 70px;
  height: 70px;
  background-color: var(--panel-border);
  border-radius: 50%;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.key-sensor::after {
  content: "👆";
  font-size: 1.8rem;
}
.key-sensor:hover {
  background-color: rgba(0, 245, 160, 0.1);
}

@keyframes spinRing {
  100% { transform: rotate(360deg); }
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background-color: rgba(255,255,255,0.05);
  border-radius: 3px;
  margin-top: 16px;
  overflow: hidden;
}
.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 3px;
}

.modal-btn-secondary {
  padding: 10px 24px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
}
.modal-btn-secondary:hover {
  background: rgba(255,255,255,0.05);
}

/* Footer styling */
.footer-container {
  padding: 32px 48px;
  border-top: 1px solid var(--panel-border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  z-index: 10;
  background: rgba(11, 15, 25, 0.4);
}

/* Responsive */
@media(max-width: 900px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .visualizer-card, .siem-card, .compliance-card {
    grid-column: 1 / -1;
  }
  .cmp-content {
    flex-direction: column;
    text-align: center;
  }
  .nav-container, .footer-container {
    padding: 16px 24px;
    flex-direction: column;
    gap: 16px;
  }
}
