/* NudgeGuard Styling & Glassmorphism Design System */

:root {
  --bg-dark: #0b0f19;
  --panel-bg: rgba(22, 31, 51, 0.75);
  --panel-border: rgba(255, 255, 255, 0.08);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  
  --amber: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.25);
  
  --crimson: #ef4444;
  --crimson-glow: rgba(239, 68, 68, 0.3);
  
  --cyan: #06b6d4;
  --blue: #3b82f6;
  
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--panel-border);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 24px;
}

.header-brand h1 {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 600;
}

/* Split View Main Layout */
.app-layout {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 28px;
  padding: 24px 32px;
  flex: 1;
}

@media (max-width: 1100px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
}

/* Glass Card */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Simulator Phone Frame */
.simulator-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.phone-frame {
  width: 380px;
  height: 740px;
  background: #0f172a;
  border: 3px solid #334155;
  border-radius: 44px;
  padding: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.phone-screen {
  background: #1e293b;
  border-radius: 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}

.phone-header {
  background: #0f172a;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.active-call-bar {
  background: linear-gradient(90deg, #dc2626, #b91c1c);
  color: white;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  animation: pulse-red 2s infinite;
}

.active-call-bar.hidden {
  display: none;
}

@keyframes pulse-red {
  0% { box-shadow: inset 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: inset 0 0 12px rgba(239, 68, 68, 0.8); }
  100% { box-shadow: inset 0 0 0 rgba(239, 68, 68, 0.4); }
}

.sim-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.sim-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.input-control {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.input-control:focus {
  border-color: var(--cyan);
}

.toggle-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.5);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-group label {
  font-size: 12px;
  font-weight: 500;
}

.sim-pay-button {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border: none;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: auto;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.sim-pay-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

/* Preset Scenario Selector Cards */
.preset-selector {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.preset-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.preset-card {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-card:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: var(--cyan);
  transform: translateX(3px);
}

/* Dashboard Panel */
.dashboard-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dash-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dash-title {
  font-size: 18px;
  font-weight: 700;
}

/* Risk Meter Card */
.risk-meter-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.risk-score-display {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.risk-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.risk-val {
  font-size: 32px;
  font-weight: 900;
}

.risk-meter-bar {
  height: 14px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  overflow: hidden;
  position: relative;
}

.risk-meter-fill {
  height: 100%;
  width: 0%;
  background: var(--emerald);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s;
  border-radius: 7px;
}

.dash-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 10px;
}

.badge-emerald { background: rgba(16, 185, 129, 0.2); color: var(--emerald); border: 1px solid var(--emerald); }
.badge-amber { background: rgba(245, 158, 11, 0.2); color: var(--amber); border: 1px solid var(--amber); }
.badge-red { background: rgba(239, 68, 68, 0.2); color: var(--crimson); border: 1px solid var(--crimson); }
.badge-blue { background: rgba(59, 130, 246, 0.2); color: var(--blue); border: 1px solid var(--blue); }

.emerald-text { color: var(--emerald); font-weight: 700; }
.gray-text { color: var(--text-muted); }

/* Audit List & Telemetry Stream */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.dash-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.box-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.dash-audit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.dash-audit-item {
  background: rgba(30, 41, 59, 0.6);
  border-left: 3px solid var(--cyan);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.dash-audit-rule {
  font-weight: 700;
  display: block;
  color: var(--text-main);
}

.dash-audit-details {
  color: var(--text-muted);
}

.dash-telemetry-stream {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 11px;
}

.dash-log-entry {
  background: rgba(15, 23, 42, 0.9);
  padding: 6px 10px;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.log-emergency { border-left: 3px solid var(--emerald); }
.log-high { border-left: 3px solid var(--crimson); }
.log-normal { border-left: 3px solid var(--blue); }

/* Interventions & Modals Overlay */
.ng-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 20px;
}

.ng-modal {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modal-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-pop {
  0% { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

.ng-modal-emergency { border-color: var(--emerald); box-shadow: 0 0 30px var(--emerald-glow); }
.ng-modal-high-risk { border-color: var(--crimson); box-shadow: 0 0 40px var(--crimson-glow); }
.ng-modal-warning { border-color: var(--amber); box-shadow: 0 0 30px var(--amber-glow); }

.ng-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  width: fit-content;
}

.ng-badge-emergency { background: rgba(16, 185, 129, 0.2); color: var(--emerald); border: 1px solid var(--emerald); }
.ng-badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--crimson); border: 1px solid var(--crimson); }
.ng-badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--amber); border: 1px solid var(--amber); }

.ng-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.ng-message {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Countdown Ring */
.ng-timer-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100px;
  height: 100px;
  margin: 10px auto;
}

.ng-timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ng-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 8;
}

.ng-ring-progress {
  fill: none;
  stroke: var(--crimson);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.ng-timer-text {
  position: absolute;
  font-size: 24px;
  font-weight: 900;
  color: var(--crimson);
}

/* Quiz Box */
.ng-quiz-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ng-quiz-question {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.ng-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ng-quiz-opt-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.ng-quiz-opt-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: var(--cyan);
}

.ng-quiz-opt-btn.selected {
  border-color: var(--crimson);
  background: rgba(239, 68, 68, 0.15);
}

.ng-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.ng-btn {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.ng-btn-primary { background: rgba(239, 68, 68, 0.3); color: #fca5a5; border: 1px solid var(--crimson); }
.ng-btn-primary[disabled] { opacity: 0.6; cursor: not-allowed; }
.ng-btn-ready { background: var(--crimson) !important; color: white !important; box-shadow: 0 0 20px var(--crimson-glow); }

.ng-btn-secondary { background: rgba(51, 65, 85, 0.8); color: var(--text-main); }
.ng-btn-secondary:hover { background: rgba(71, 85, 105, 1); }

.ng-btn-emergency { background: var(--emerald); color: white; box-shadow: 0 0 20px var(--emerald-glow); }
.ng-btn-warning { background: var(--amber); color: black; box-shadow: 0 0 20px var(--amber-glow); }
