/**
 * EasyMan v1 - Master Design System & Core Stylesheet
 * Executive Security Operations & Management Theme
 */

:root {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #24344d;
  --bg-input: #0f172a;
  --border-color: #334155;
  --border-light: #475569;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.15);
  
  --accent: #38bdf8;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography & Utilities */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-main);
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-muted { color: var(--text-muted); }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-primary { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.p-0 { padding: 0 !important; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Header & Nav */
.app-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-logo i {
  color: var(--accent);
}
.brand-tagline {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-left: 1px solid var(--border-color);
  padding-left: 12px;
}

.app-nav {
  display: flex;
  gap: 4px;
}
.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}
.nav-link:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
  text-decoration: none;
}
.nav-link.active {
  background-color: var(--primary);
  color: #fff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mgmt-co-badge {
  font-size: 12px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 20px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Main Container & Tab Views */
.app-main {
  flex: 1;
  padding: 24px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.tab-view {
  display: none;
}
.tab-view.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

/* Cards & Panels */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(255, 255, 255, 0.02);
}
.card-body {
  padding: 20px;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.btn-primary {
  background-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}
.btn-outline {
  background-color: transparent;
  border-color: var(--border-light);
  color: var(--text-main);
}
.btn-outline:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--accent);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
}
.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.btn-icon:hover {
  color: var(--text-main);
  background-color: var(--bg-card-hover);
}

/* Form Controls */
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}
.form-control:focus {
  border-color: var(--accent);
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}
.badge-primary { background-color: var(--primary-light); color: var(--accent); }
.badge-success { background-color: var(--success-bg); color: var(--success); }
.badge-warning { background-color: var(--warning-bg); color: var(--warning); }
.badge-danger { background-color: var(--danger-bg); color: var(--danger); }
.badge-info { background-color: rgba(56, 189, 248, 0.15); color: var(--accent); }
.badge-light { background-color: rgba(255, 255, 255, 0.1); color: var(--text-main); }
.badge-dark { background-color: #0f172a; color: var(--text-muted); border: 1px solid var(--border-color); }
.badge-outline { border: 1px solid var(--border-light); background: transparent; color: var(--text-main); }

/* Grade Pills */
.grade-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.grade-gradea { background-color: #4f46e5; color: #fff; }
.grade-gradeb { background-color: #0284c7; color: #fff; }
.grade-gradec { background-color: #0d9488; color: #fff; }
.grade-graded { background-color: #d97706; color: #fff; }
.grade-gradee { background-color: #dc2626; color: #fff; }

/* Live / Offline Status Beacons (Blue = Live, Red = Offline) */
.beacon-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
}
.beacon-live-blue {
  background-color: #38bdf8;
  box-shadow: 0 0 10px #38bdf8, 0 0 20px #0284c7;
  animation: pulseBlue 1.5s infinite;
}
.beacon-offline-red {
  background-color: #ef4444;
  box-shadow: 0 0 10px #ef4444, 0 0 20px #b91c1c;
  animation: pulseRed 1s infinite;
}

@keyframes pulseBlue {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(56, 189, 248, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

@keyframes pulseRed {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8); }
  70% { transform: scale(1.2); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.badge-live-blue {
  background-color: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  font-weight: 700;
  padding: 4px 10px;
}
.badge-offline-red {
  background-color: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #f87171;
  font-weight: 700;
  padding: 4px 10px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.table th {
  background-color: rgba(0, 0, 0, 0.2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  vertical-align: middle;
}
.table-hover tbody tr:hover {
  background-color: var(--bg-card-hover);
}
.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal-dialog {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: all 0.2s ease;
}
.modal-overlay.active .modal-dialog {
  transform: translateY(0);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body {
  padding: 20px;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: rgba(0, 0, 0, 0.1);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}
.toast.visible {
  transform: translateY(0);
  opacity: 1;
}
.toast-success { border-left: 4px solid var(--success); }
.toast-info { border-left: 4px solid var(--accent); }
.toast-danger { border-left: 4px solid var(--danger); }

/* Empty States */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}
.empty-icon {
  font-size: 42px;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.empty-state h3 {
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 20px;
}
