/* =============================================================================
   Testing Platform Installer — Styles
   ============================================================================= */

:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --border: #475569;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 8px;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* --- Layout --- */

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar-brand h1 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}

.sidebar-brand small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.sidebar nav { flex: 1; }

.sidebar a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.sidebar a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.sidebar a.active { color: var(--primary); background: rgba(59,130,246,0.1); border-right: 3px solid var(--primary); }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.main {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.main h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

/* --- Cards --- */

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.card-header h3 { font-size: 0.95rem; font-weight: 600; }

/* --- Status badges --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-muted { background: rgba(148,163,184,0.15); color: var(--text-muted); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-success { background: var(--success); }
.dot-danger { background: var(--danger); }
.dot-warning { background: var(--warning); }

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  color: white;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-danger { background: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-success { background: var(--success); }
.btn-success:hover:not(:disabled) { background: #16a34a; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) { background: rgba(255,255,255,0.05); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* --- Forms --- */

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus { border-color: var(--primary); }
.form-input::placeholder { color: var(--text-muted); }

select.form-input { cursor: pointer; }

textarea.form-input { resize: vertical; min-height: 80px; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.8rem; }

/* --- Tables --- */

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

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { text-align: left; padding: 0.75rem 1rem; background: var(--bg-input); color: var(--text-muted); font-weight: 600; }
td { padding: 0.75rem 1rem; border-top: 1px solid var(--border); }
tr:hover td { background: rgba(255,255,255,0.02); }

/* --- Alerts --- */

.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: var(--success); }
.alert-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--danger); }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: var(--warning); }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: var(--primary); }

/* --- Login / Setup page --- */

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-box h1 {
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.auth-box p {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.auth-box .btn { width: 100%; justify-content: center; padding: 0.75rem; }

.qr-container { text-align: center; margin: 1.5rem 0; }
.qr-container img { border-radius: var(--radius); background: white; padding: 8px; }
.manual-key {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  background: var(--bg-input);
  padding: 0.5rem;
  border-radius: var(--radius);
  word-break: break-all;
  text-align: center;
  margin-top: 0.75rem;
  color: var(--text-muted);
}

/* --- Misc --- */

.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.8rem; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Responsive --- */

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-brand h1, .sidebar-brand small, .sidebar a span { display: none; }
  .sidebar a { justify-content: center; padding: 0.75rem; }
  .main { padding: 1rem; }
}
