:root {
  --bg-primary: #121824;
  --bg-secondary: #1a2333;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  padding: 20px;
}

.simulation-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 5px solid var(--accent-blue);
}

.brand-name {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 1px;
}

.badge {
  background: #374151;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  margin-left: 10px;
  color: var(--text-muted);
}

.system-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
}

.system-status.green { background-color: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.system-status.red { background-color: rgba(239, 68, 68, 0.2); color: var(--accent-red); animation: pulse 1.5s infinite; }

/* Grid Layout */
.grid-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 20px;
}

.card {
  background-color: var(--bg-secondary);
  border-radius: 8px;
  padding: 20px;
}

h2 {
  font-size: 1.1rem;
  margin-top: 0;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Buttons */
.button-group {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}

.btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  background-color: #374151;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.btn.active {
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.btn-danger {
  background-color: var(--accent-red);
}

.btn-danger:hover {
  background-color: #dc2626;
}

/* Logging System */
.log-panel h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.log-box {
  background-color: #0f172a;
  border-radius: 6px;
  padding: 10px;
  height: 200px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.8rem;
}

.log-entry { margin: 4px 0; }
.text-success { color: var(--accent-green); }
.text-danger { color: var(--accent-red); }
.text-warning { color: #f59e0b; }

/* Metrics */
.metrics-row {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.metric-card {
  flex: 1;
  background-color: #243046;
  padding: 12px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}

.metric-card .label { font-size: 0.75rem; color: var(--text-muted); }
.metric-card .value { font-size: 1.2rem; font-weight: bold; margin-top: 5px; }

/* Mock App Container */
.mock-device {
  width: 320px;
  height: 520px;
  background-color: #000;
  border: 8px solid #2d3748;
  border-radius: 36px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
}

.device-notch {
  width: 140px;
  height: 18px;
  background-color: #2d3748;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  z-index: 10;
}

.device-screen {
  width: 100%;
  height: 100%;
  background-color: #fff;
  color: #333;
  position: relative;
}

.screen-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* App UI Normal state */
.app-mock-nav {
  background-color: #0d5c3a; /* Thomson Green accent */
  color: white;
  padding: 30px 15px 15px 15px;
  font-weight: bold;
}

.app-body { padding: 15px; }

.welcome-box {
  background-color: #e6f4ea;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 15px;
}

.welcome-box h4 { margin: 0 0 5px 0; color: #0d5c3a; }
.welcome-box p { margin: 0; font-size: 0.75rem; color: #555; }

.app-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.menu-item {
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 15px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: transform 0.1s;
}

.menu-item:active { transform: scale(0.95); }

/* App UI Error state */
.error-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  padding: 20px;
  text-align: center;
  background-color: #fafafa;
}

.error-icon { font-size: 3rem; margin-bottom: 10px; }
.error-code { font-size: 2.2rem; font-weight: 900; margin: 0; color: #374151; }
.error-container h2 { margin: 5px 0; color: #111827; text-transform: none; font-size: 1.1rem;}
.error-desc { font-size: 0.75rem; color: #6b7280; line-height: 1.4; margin: 15px 0; }

.btn-retry {
  width: 100%;
  padding: 10px;
  background-color: #e5e7eb;
  border: none;
  border-radius: 6px;
  color: #9ca3af;
  font-size: 0.8rem;
  font-weight: bold;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}