/* CSS Variables for Premium Dark Mode (Emerald Theme) */
:root {
  --bg: #060813;
  --panel: #0d1226;
  --panel-light: #161e38;
  --border: rgba(16, 185, 129, 0.15);
  --border-active: rgba(16, 185, 129, 0.45);
  --border-glow: rgba(16, 185, 129, 0.25);
  
  --emerald: #10b981;
  --teal: #14b8a6;
  --light-green: #34d399;
  --red: #f43f5e;
  --yellow: #f59e0b;
  
  --text: #f3f4f6;
  --text-muted: #8b9bb4;
  --white: #ffffff;
  
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  --transition: all 0.3s ease;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  padding: 24px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

.simulator-wrapper {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.logo {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--light-green) 0%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--light-green);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.online {
  background-color: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: pulse 2s infinite;
}

/* Main Grid Layout */
.sim-main-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 20px;
}

@media (max-width: 1024px) {
  .sim-main-grid {
    grid-template-columns: 1fr;
  }
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: var(--transition);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
}

.panel-header h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.step-badge {
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--light-green);
}

/* Form Styles */
form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .form-group select {
  background: var(--panel-light);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  color: white;
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.submit-btn {
  background: linear-gradient(135deg, var(--emerald) 0%, var(--teal) 100%);
  border: none;
  border-radius: 8px;
  padding: 12px;
  color: #060813;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.15);
  transition: var(--transition);
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.submit-btn:disabled {
  background: var(--panel-light);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Terminal Styles */
.terminal-panel {
  flex: 1;
  min-height: 200px;
}

.terminal {
  background: #060813;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 14px;
  flex: 1;
  font-family: monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
}

.clear-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
}

.clear-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.log-line.system { color: var(--text-muted); }
.log-line.running { color: var(--teal); }
.log-line.success { color: var(--light-green); }
.log-line.warn { color: var(--yellow); }
.log-line.error { color: var(--red); }

/* Schema Node Map Flow */
.flow-panel {
  padding-bottom: 24px;
}

.flow-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  position: relative;
}

.flow-node {
  width: 95px;
  background: var(--panel-light);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  transition: var(--transition);
  position: relative;
  z-index: 2;
}

.flow-node.branch {
  width: 90px;
}

.flow-node.active {
  border-color: var(--emerald);
  box-shadow: 0 0 15px var(--border-glow);
  transform: scale(1.05);
}

.flow-node.completed {
  border-color: var(--teal);
  background: rgba(20, 184, 166, 0.06);
}

.flow-node.failed {
  border-color: var(--red);
  background: rgba(244, 63, 94, 0.06);
}

.node-icon {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.node-name {
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.node-status {
  font-size: 8px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.flow-node.active .node-status {
  color: var(--light-green);
}

.flow-node.completed .node-status {
  color: var(--teal);
}

/* Connector Lines & Pulses */
.flow-line {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 1;
}

.flow-pulse {
  position: absolute;
  top: -1px;
  left: 0;
  width: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--emerald), var(--teal));
  opacity: 0;
  border-radius: 2px;
}

.flow-pulse.animate {
  animation: pulseLine 1.5s forwards;
  opacity: 1;
}

/* Branches on Route split */
.flow-branches {
  position: relative;
  width: 40px;
  height: 120px;
  z-index: 1;
}

.branch-line {
  position: absolute;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
}

.branch-line.upper {
  top: 25px;
  transform: rotate(-35deg);
  transform-origin: left center;
  width: 48px;
}

.branch-line.lower {
  bottom: 25px;
  transform: rotate(35deg);
  transform-origin: left center;
  width: 48px;
}

.branch-nodes {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Device Panel */
.device-panel {
  flex: 1;
}

.device-tab-bar {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 4px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--panel-light);
  color: white;
}

.device-view {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

.device-view.hidden {
  display: none;
}

/* Phone Mock Screen */
.phone-frame {
  width: 260px;
  height: 480px;
  background: #000;
  border: 8px solid #1a1a1a;
  border-radius: 36px;
  padding: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  position: relative;
}

.phone-screen {
  background: #0a0e1a;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.phone-header {
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
}

.sms-sender {
  padding: 10px;
  text-align: center;
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
}

.sms-chat {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.sms-system-note {
  font-size: 8px;
  color: var(--text-muted);
  text-align: center;
  margin: 4px 0;
  font-style: italic;
}

.sms-bubble {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 10px;
  line-height: 1.4;
  word-wrap: break-word;
}

.sms-bubble.incoming {
  background: var(--panel-light);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: white;
  align-self: flex-start;
  border-bottom-left-radius: 2px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease;
}

.sms-bubble.incoming a {
  color: var(--light-green);
  font-weight: bold;
  text-decoration: underline;
}

/* Email Mock Screen */
.email-frame {
  width: 100%;
  max-width: 520px;
  height: 480px;
  background: #111;
  border: 8px solid #222;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

.email-screen {
  background: #0c0f1c;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.email-header {
  background: #151b33;
  padding: 10px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.email-search {
  background: #0c0f1c;
  width: 100%;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 10px;
  color: var(--text-muted);
}

.email-content-pane {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.email-empty {
  color: var(--text-muted);
  text-align: center;
  font-size: 11px;
  margin-top: 150px;
}

.email-details {
  animation: fadeIn 0.4s ease;
}

.email-subject {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: white;
}

.email-meta {
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 10px;
}

.email-body {
  font-size: 11px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
}

.email-body a {
  color: var(--teal);
  font-weight: 600;
  text-decoration: underline;
}

.email-box-negative {
  margin-top: 14px;
  background: rgba(244, 63, 94, 0.05);
  border: 1px dashed rgba(244, 63, 94, 0.2);
  padding: 10px;
  border-radius: 6px;
}

.email-box-positive {
  margin-top: 14px;
  background: rgba(20, 184, 166, 0.08);
  border: 1px dashed rgba(20, 184, 166, 0.32);
  padding: 10px;
  border-radius: 6px;
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

@keyframes pulseLine {
  0% { width: 0; opacity: 1; }
  100% { width: 100%; opacity: 1; }
}

@keyframes slideIn {
  0% { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
