/* Custom HSL Styling System - Dark Mode/Indigo Accent */
:root {
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --bg-app: hsl(222, 47%, 7%);
  --bg-card: hsl(223, 47%, 11%);
  --bg-card-hover: hsl(223, 47%, 14%);
  --border-color: hsl(217, 32%, 18%);
  
  --text-primary: hsl(210, 40%, 98%);
  --text-secondary: hsl(215, 20%, 65%);
  --text-muted: hsl(215, 12%, 45%);
  
  --primary: hsl(217, 91%, 60%);
  --primary-glow: hsla(217, 91%, 60%, 0.35);
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --transition-speed: 0.25s;
}

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

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem;
}

/* Header Styles */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: hsla(223, 47%, 11%, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 1rem 2rem;
  border-radius: 16px;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: linear-gradient(135deg, var(--primary), hsl(250, 91%, 60%));
  color: white;
  font-weight: 700;
  font-family: var(--font-display);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 1.1rem;
  letter-spacing: 1px;
  box-shadow: 0 0 20px var(--primary-glow);
}

.logo-text h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.logo-text p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.app-nav {
  display: flex;
  gap: 8px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.nav-tab:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-tab.active {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

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

.lang-switch-wrapper {
  display: flex;
  align-items: center;
}

.btn-lang {
  background: hsla(217, 32%, 18%, 0.4);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  backdrop-filter: blur(12px);
}

.btn-lang:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: hsla(217, 32%, 18%, 0.4);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

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

.status-indicator.online {
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.status-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Card layout */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  margin-bottom: 1.5rem;
}

/* Main Area Layout */
.app-main {
  flex: 1;
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease;
}

.tab-content.active {
  display: block;
}

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

/* Overview grid */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: linear-gradient(145deg, var(--bg-card), hsl(223, 47%, 9%));
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background-color: var(--primary);
}

.metric-card h3 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}

.metric-card .value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  background: linear-gradient(135deg, white, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.metric-card .description {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Charts and layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-container h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.chart-wrapper {
  position: relative;
  height: 280px;
}

/* Exporter and utilities */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  background: linear-gradient(90deg, var(--bg-card) 0%, hsl(220, 50%, 15%) 100%);
  border: 1px solid var(--border-color);
}

.action-text h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.action-text p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  background-color: hsl(217, 91%, 65%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
  background-color: var(--border-color);
  color: var(--text-primary);
  border: 1px solid hsl(217, 32%, 25%);
}

.btn-secondary:hover {
  background-color: hsl(217, 32%, 22%);
}

/* Forms and search */
.search-card h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.search-form {
  display: flex;
  gap: 1.25rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 200px;
}

.input-group.shrink {
  flex: 0 0 160px;
  min-width: 160px;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.input-group input, .input-group select {
  background-color: hsl(223, 47%, 8%);
  border: 1px solid var(--border-color);
  color: white;
  border-radius: 8px;
  padding: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-group input:focus, .input-group select:focus {
  border-color: var(--primary);
}

.btn-search {
  height: 48px;
  padding: 0 24px;
}

/* Tables */
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.table-header h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
}

.badge {
  background-color: var(--border-color);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background-color: hsl(223, 47%, 9%);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-primary);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: var(--bg-card-hover);
}

/* Status Badges */
.status-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-tag.matched {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.status-tag.unmatched {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.status-tag.mismatched {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.status-tag.expired {
  background-color: rgba(100, 116, 139, 0.15);
  color: var(--text-secondary);
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* Footer */
.app-footer-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* --- Sandbox Switcher Styles --- */
.sandbox-bar {
  background: hsla(223, 47%, 11%, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.sandbox-content {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
}

.sandbox-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.sandbox-select {
  background-color: hsl(223, 47%, 8%);
  border: 1px solid var(--border-color);
  color: white;
  border-radius: 6px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.sandbox-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.sandbox-client-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.3s ease;
}

/* --- Sandbox Modal Overlay Styles --- */
.sandbox-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(6, 10, 20, 0.9);
  backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: fadeIn 0.4s ease;
}

.sandbox-modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 3rem;
  max-width: 900px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.sandbox-modal-card h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, white, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.role-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.role-card {
  background: linear-gradient(145deg, hsl(223, 47%, 9%), hsl(223, 47%, 6%));
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.75rem 1.25rem;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.role-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.role-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.role-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: white;
}

.role-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* --- Client Workspace Grid Layout --- */
.client-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
}

.client-left {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.code-area {
  width: 100%;
  background-color: hsl(223, 47%, 6%);
  border: 1px solid var(--border-color);
  color: #34d399; /* Light green code color */
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  padding: 12px;
  border-radius: 8px;
  resize: vertical;
  outline: none;
  margin-bottom: 1rem;
  transition: border-color var(--transition-speed);
}

.code-area:focus {
  border-color: var(--primary);
}

.uploader-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Upload Feedback Card */
.upload-feedback-card {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid;
  animation: fadeIn 0.3s ease;
}

.upload-feedback-card.valid {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: var(--success);
  color: var(--text-primary);
}

.upload-feedback-card.invalid {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  color: var(--text-primary);
}

.upload-feedback-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.feedback-details {
  font-size: 0.85rem;
  white-space: pre-wrap;
  font-family: var(--font-body);
  line-height: 1.5;
}

/* SSH Key Manager styling */
.ssh-manager {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ssh-key-display label, .ssh-key-input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}

.ssh-key-box {
  background-color: hsl(223, 47%, 7%);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: monospace;
  word-break: break-all;
  max-height: 80px;
  overflow-y: auto;
}

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

.ssh-key-input-group input {
  background-color: hsl(223, 47%, 8%);
  border: 1px solid var(--border-color);
  color: white;
  border-radius: 6px;
  padding: 10px;
  font-family: monospace;
  font-size: 0.85rem;
  outline: none;
  margin-bottom: 8px;
}

.ssh-key-input-group input:focus {
  border-color: var(--primary);
}

/* --- Operator Dashboard Layout --- */
.operator-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Health Cards Grid */
.health-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.health-card {
  background-color: hsl(223, 47%, 7%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: border-color var(--transition-speed);
}

.health-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: white;
}

.health-badge.port {
  background-color: var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  width: max-content;
  font-family: monospace;
}

.health-status-text {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 4px;
}

.health-card.online {
  border-color: rgba(16, 185, 129, 0.3);
}

.health-card.online .health-status-text {
  color: var(--success);
}

.health-card.offline {
  border-color: rgba(239, 68, 68, 0.3);
  animation: pulseOffline 2s infinite ease-in-out;
}

.health-card.offline .health-status-text {
  color: var(--danger);
}

@keyframes pulseOffline {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Operator Actions */
.operator-actions-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.op-action-item {
  background-color: hsl(223, 47%, 7%);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.op-action-desc h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: white;
  margin-bottom: 4px;
}

.op-action-desc p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.op-feedback-alert {
  margin-top: 1.25rem;
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--info);
  color: var(--text-primary);
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: monospace;
  white-space: pre-wrap;
  animation: fadeIn 0.3s ease;
}

/* QA Terminal and Simulation Styles */
.qa-controls-bar {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.console-box {
  background-color: hsl(222, 47%, 4%);
  border: 1px solid var(--border-color);
  font-family: 'Consolas', 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 1.25rem;
  border-radius: 10px;
  height: 250px;
  overflow-y: auto;
  color: hsl(120, 60%, 75%); /* retro console green */
  white-space: pre-wrap;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
}

.console-prompt {
  color: var(--primary);
  font-weight: bold;
}

.console-log-info {
  color: var(--text-primary);
}

.console-log-success {
  color: #10b981;
}

.console-log-error {
  color: #ef4444;
}

.console-log-warn {
  color: #f59e0b;
}

.badge-neutral {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.badge-success {
  background-color: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-info {
  background-color: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Form layouts helper */
.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}
.form-row .input-group {
  flex: 1;
}
.w-100 {
  width: 100%;
}
.form-select {
  width: 100%;
  padding: 0.65rem;
  background-color: hsl(222, 47%, 4%);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: white;
  font-family: var(--font-body);
}
