/* ===================================================================
   PSW SOVEREIGN 3D PREMIUM GLASSMORPHISM SYSTEM
   High Readability, Frosted Glass Acrylic, 3D Holographic Arc Reactor
   =================================================================== */

:root {
  --bg-dark: #030714;
  --bg-card: rgba(11, 20, 42, 0.85);
  --bg-card-border: rgba(0, 240, 255, 0.36);
  --bg-card-hover: rgba(16, 29, 60, 0.92);
  --cyan: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.5);
  --cyan-deep: #00a8b5;
  --emerald: #00ff88;
  --emerald-glow: rgba(0, 255, 136, 0.5);
  --amber: #ffaa00;
  --magenta: #d946ef;
  --gold: #ffbe0b;
  --text-main: #ffffff;
  --text-muted: #cbd5e1;
  --text-bright: #f8fafc;
  --font-mono: 'Consolas', 'Fira Code', 'Courier New', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Subtle High-Contrast Scanline Effect (Non-obstructive) */
body::before {
  content: " ";
  display: block;
  position: fixed;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%), linear-gradient(90deg, rgba(0, 240, 255, 0.01), rgba(0, 255, 136, 0.01), rgba(0, 240, 255, 0.01));
  z-index: 9999;
  background-size: 100% 4px, 8px 100%;
  pointer-events: none;
  opacity: 0.08;
}

body {
  font-family: var(--font-sans);
  background: radial-gradient(circle at 50% 10%, #0d1b38 0%, #030714 85%);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 3D Frosted Acrylic Glass Cards */
.card, .glass-card, .psw-reactor-wrap, .stat-card, .tab-pane {
  background: var(--bg-card) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid var(--bg-card-border) !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 20px rgba(0, 240, 255, 0.05) !important;
  color: var(--text-main) !important;
  transition: all 0.25s ease-in-out !important;
}

.card:hover, .stat-card:hover {
  border-color: rgba(0, 240, 255, 0.6) !important;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 25px rgba(0, 240, 255, 0.25) !important;
  transform: translateY(-2px);
}

/* Typography High Readability */
h1, h2, h3, h4, .title, .card-title {
  color: #ffffff !important;
  font-weight: 700 !important;
  letter-spacing: 0.6px !important;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.45) !important;
}

p, span, div, td, th, li, label {
  color: var(--text-main);
}

.text-muted, .stat-label, .sub-text, .timestamp {
  color: var(--text-muted) !important;
  font-weight: 500 !important;
}

/* 3D Arc Reactor Polish */
.orb-container {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  filter: drop-shadow(0 0 30px rgba(0, 240, 255, 0.35));
}

.orb-ring-outer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed var(--cyan);
  box-shadow: 0 0 30px var(--cyan-glow), inset 0 0 15px rgba(0, 240, 255, 0.2);
  animation: spin 12s linear infinite;
}

.orb-ring-inner {
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  border: 2px solid var(--magenta);
  border-left-color: transparent;
  box-shadow: 0 0 20px rgba(217, 70, 239, 0.4);
  animation: spin-reverse 7s linear infinite;
}

.orb-core {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, var(--cyan) 40%, rgba(0, 240, 255, 0.15) 80%);
  box-shadow: 0 0 45px var(--cyan), inset 0 0 15px #ffffff;
  animation: pulse 2.2s ease-in-out infinite;
}

.psw-state-text {
  margin-top: 18px;
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--cyan);
  font-weight: 800;
  text-shadow: 0 0 15px var(--cyan);
}

/* 3D Arc Reactor Gyro Rings */
.iron-arc-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px auto;
}

.arc-gyro-outer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed var(--cyan);
  box-shadow: 0 0 35px var(--cyan-glow), inset 0 0 20px rgba(0, 240, 255, 0.15);
  animation: spin 14s linear infinite;
}

.arc-gyro-mid {
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  border-top-color: transparent;
  border-bottom-color: transparent;
  animation: spin-reverse 8s linear infinite;
}

.arc-gyro-inner {
  position: absolute;
  inset: 48px;
  border-radius: 50%;
  border: 2px dotted var(--magenta);
  animation: spin 5s linear infinite;
}

.arc-power-core {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, var(--cyan) 45%, rgba(0, 240, 255, 0.1) 80%);
  box-shadow: 0 0 45px var(--cyan), 0 0 80px rgba(0, 240, 255, 0.6);
  animation: pulse 2s ease-in-out infinite;
}

/* Camera Scanner & Vision Box */
.camera-preview-box {
  width: 100%;
  max-width: 480px;
  height: 280px;
  background: #000;
  border: 1px solid var(--cyan);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  margin: 0 auto 14px auto;
}

#camera-video, #camera-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.reticle-overlay {
  position: absolute;
  inset: 20px;
  border: 2px solid rgba(0, 240, 255, 0.35);
  border-radius: 16px;
  pointer-events: none;
}

.reticle-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--cyan);
  border-style: solid;
}
.reticle-tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.reticle-tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; }
.reticle-bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }
.reticle-br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }

.reticle-scanline {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 12px var(--cyan);
  animation: scanline 2.4s ease-in-out infinite;
}

@keyframes scanline {
  0% { top: 0; opacity: 0; }
  50% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* People Face Cards Grid */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.person-card {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  transition: all 0.2s;
}

.person-card:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 15px var(--cyan-glow);
}

.person-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 8px auto;
  border: 2px solid var(--cyan);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 240, 255, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(217, 70, 239, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-bottom: calc(70px + var(--safe-bottom));
}

/* Header */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(6, 9, 19, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bg-card-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  color: #000;
  box-shadow: 0 0 12px var(--cyan-glow);
}

.brand-text h1 {
  font-size: 16px;
  letter-spacing: 1.5px;
  color: var(--cyan);
  font-weight: 800;
  text-transform: uppercase;
}

.brand-text p {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid var(--bg-card-border);
  color: var(--cyan);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:active {
  transform: scale(0.92);
  background: var(--cyan);
  color: #000;
}

/* Status Banner */
.status-banner {
  background: rgba(0, 240, 255, 0.04);
  border-bottom: 1px solid rgba(0, 240, 255, 0.08);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.badge-online {
  color: var(--emerald);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: pulse 1.8s infinite;
}

.active-window-label {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}

/* Tabs Content Container */
.tab-content {
  display: none;
  padding: 16px;
  animation: fadeIn 0.25s ease-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glass Card */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.card-title {
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Screen Viewer Tab */
.screen-container {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--bg-card-border);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
  touch-action: none;
}

#screen-stream-img {
  width: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.screen-touch-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.screen-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.btn-pill {
  flex: 1 1 calc(33.333% - 8px);
  min-height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-pill:active {
  background: var(--cyan);
  color: #000;
}

.btn-pill.primary {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* Remote Keyboard Input Bar */
.input-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.input-text {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.input-text:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

/* PSW ARC Reactor Tab */
.psw-reactor-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}

.orb-container {
  position: relative;
  width: 170px;
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.orb-ring-outer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed var(--cyan);
  box-shadow: 0 0 25px var(--cyan-glow);
  animation: spin 12s linear infinite;
}

.orb-ring-inner {
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  border: 2px solid var(--magenta);
  border-left-color: transparent;
  animation: spin-reverse 7s linear infinite;
}

.orb-core {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--cyan) 0%, rgba(0, 240, 255, 0.1) 75%);
  box-shadow: 0 0 35px var(--cyan);
  animation: pulse 2.5s ease-in-out infinite;
}

.orb-container[data-state="listening"] .orb-core {
  background: radial-gradient(circle, var(--emerald) 0%, rgba(0, 255, 136, 0.2) 75%);
  box-shadow: 0 0 40px var(--emerald);
  animation-duration: 0.9s;
}

.orb-container[data-state="thinking"] .orb-core {
  background: radial-gradient(circle, var(--amber) 0%, rgba(255, 183, 3, 0.2) 75%);
  box-shadow: 0 0 40px var(--amber);
  animation-duration: 0.7s;
}

.psw-state-text {
  margin-top: 16px;
  font-size: 13px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--cyan);
  font-weight: 700;
}

/* Suggestions Cards */
.suggestion-card {
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-left: 4px solid var(--cyan);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--amber);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.suggestion-body {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-main);
}

.btn-action-small {
  align-self: flex-start;
  background: linear-gradient(135deg, var(--cyan), #00a2ff);
  color: #000;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
}

.btn-action-small:active {
  transform: scale(0.94);
}

/* Chat Messages Box */
.chat-box {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0;
}

.chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.chat-bubble.user {
  align-self: flex-end;
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid var(--cyan);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.chat-bubble.psw {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border-bottom-left-radius: 2px;
}

/* Terminal Tab */
.terminal-window {
  background: #020408;
  border: 1px solid var(--bg-card-border);
  border-radius: 10px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  min-height: 220px;
  max-height: 340px;
  overflow-y: auto;
  color: #89ddff;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Gauges & Vitals */
.vitals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.vital-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
}

.vital-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.vital-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--cyan);
  margin-top: 4px;
}

/* Tasks */
.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  margin-bottom: 8px;
}

.task-title {
  font-size: 13px;
  font-weight: 500;
}

.task-item.completed .task-title {
  text-decoration: line-through;
  opacity: 0.5;
}

/* File Explorer */
.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
  cursor: pointer;
}

.file-row:hover {
  background: rgba(0, 240, 255, 0.06);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.file-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55vw;
}

/* Bottom Navigation Bar (Mobile Native Style) */
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(60px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(6, 9, 19, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--bg-card-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  letter-spacing: 0.5px;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item.active {
  color: var(--cyan);
}

.nav-icon {
  font-size: 18px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: #0d1428;
  border: 1px solid var(--cyan);
  box-shadow: 0 0 30px var(--cyan-glow);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-reverse { to { transform: rotate(-360deg); } }
@keyframes pulse { 50% { transform: scale(1.15); opacity: 0.8; } }
