:root {
  /* ARES AI DESIGN SYSTEM - Mission Control Aesthetics */
  --bg-core: #09090b;
  --bg-card: rgba(17, 17, 19, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --primary: #3b82f6; /* Tactical Blue */
  --secondary: #8b5cf6; /* Neural Purple */
  --success: #10b981; /* Metric Stable */
  --warning: #f59e0b; /* Anomaly Warning */
  --danger: #ef4444; /* Breach Threat */
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --panel-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
  --font-main: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --sidebar-width: 260px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-core);
  background-image: 
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
  color: var(--text);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow: hidden; /* Main container handles scroll */
}

/* --- AUTH UI --- */
#login-container {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg-core);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 400px;
  padding: 3rem;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--panel-shadow);
  text-align: center;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-family: var(--font-main);
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
}

.btn-secondary { background: var(--secondary); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); }

/* --- MAIN LAYOUT --- */
#dashboard-container {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: rgba(10, 10, 12, 0.9);
  border-right: 1px solid var(--glass-border);
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  z-index: 100;
}

.brand {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand span { color: var(--primary); }

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s;
}

.nav-item:hover, .nav-item.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.nav-item.active {
  color: var(--primary);
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
}

header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

/* --- MACHINE VIEW --- */
.machine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
  gap: 2rem;
}

.machine-card {
  padding: 1.5rem;
  transition: 0.3s;
}

.machine-card:hover { border-color: rgba(59, 130, 246, 0.4); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-offline { background: var(--danger); }

.metric-mini {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.6rem;
  border-radius: 8px;
  text-align: center;
}

.metric-mini span:first-child { font-size: 0.6rem; color: var(--text-muted); display: block; text-transform: uppercase; }
.metric-mini span:last-child { font-size: 1rem; font-weight: 700; font-family: var(--font-mono); }

/* --- DATA TABLES --- */
.table-container {
  overflow-x: auto;
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th {
  text-align: left;
  padding: 1rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 1px;
}

td {
  padding: 1rem;
  border-top: 1px solid var(--glass-border);
}

.badge {
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-info { background: rgba(59, 130, 246, 0.2); color: var(--primary); }
.badge-warn { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-crit { background: rgba(239, 68, 68, 0.2); color: var(--danger); box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }

/* --- MODALS --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2.5rem;
  overflow-y: auto;
  position: relative;
}

.close-modal {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* --- LOGS --- */
.log-stream {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.4;
  height: 400px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.5);
  padding: 1rem;
  border-radius: 12px;
}

.log-entry { margin-bottom: 0.4rem; padding: 0.2rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.02); }
.log-ts { color: var(--primary); margin-right: 0.8rem; }
.log-src { color: var(--secondary); margin-right: 0.8rem; font-weight: 700; }

.hidden { display: none !important; }

/* AI HUD */
.ai-hud {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 320px;
  z-index: 500;
}

.ai-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.ai-pulse {
    width: 12px;
    height: 12px;
    background: var(--secondary);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--secondary);
    animation: brain-throb 3s infinite;
}

@keyframes brain-throb {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.4); opacity: 0.4; }
    100% { transform: scale(1); opacity: 0.8; }
}

.ai-thought {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.5;
  padding: 1.5rem;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  position: relative;
}

.ai-thought:after {
  content: '';
  position: absolute;
  bottom: -10px;
  right: 30px;
  border-width: 10px 10px 0 0;
  border-style: solid;
  border-color: rgba(139, 92, 246, 0.2) transparent;
}

/* User Submenu Styles */
.user-submenu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary);
}

.modal-overlay {
    backdrop-filter: blur(8px);
}

.modal {
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    position: relative;
}
