/* ============================================================
   Lab Onboarding Portal  Theme
   Dark, terminal-inspired design with glass-morphism accents
   ============================================================ */

/* --- Reset & Base ----------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-deep:      #08080e;
  --bg-surface:   #0e0e18;
  --bg-card:      rgba(18, 18, 36, 0.75);
  --bg-card-hover:rgba(28, 28, 52, 0.85);
  --border:       rgba(60, 60, 100, 0.25);
  --border-focus: #66aaff;
  --text:         #d0d0e0;
  --text-dim:     #707090;
  --text-bright:  #f0f0ff;
  --accent:       #66aaff;
  --accent-glow:  rgba(102, 170, 255, 0.15);
  --success:      #4caf7f;
  --error:        #ff5555;
  --warning:      #f5b800;
  --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --radius:       12px;
  --radius-sm:    8px;
  --transition:   200ms cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Animated Background Image --------------------------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(8, 8, 14, 0.85), rgba(8, 8, 14, 0.90)),
    url('https://static1.bigstockphoto.com/5/3/3/large1500/335448619.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

/* --- Header ------------------------------------------------ */
header {
  padding: 0 40px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 8, 14, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

header h1::before {
  content: '>';
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 18px;
  opacity: 0.8;
}

header .user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

header .user-area .email {
  color: var(--text-dim);
}

header .user-area a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid rgba(102, 170, 255, 0.2);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

header .user-area a:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

/* --- Main Container --------------------------------------- */
main, .container {
  max-width: 840px;
  margin: 0 auto;
  padding: 48px 24px;
  min-height: calc(100vh - 128px);
}

/* --- Typography ------------------------------------------- */
h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 8px;
}

h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 32px;
  line-height: 1.6;
}

.subtitle strong {
  color: var(--text);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--accent);
  background: rgba(102, 170, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
}

/* --- Login Prompt ----------------------------------------- */
.login-prompt {
  text-align: center;
  padding: 100px 20px;
  max-width: 400px;
  margin: 0 auto;
}

.login-prompt .logo {
  font-size: 56px;
  margin-bottom: 24px;
  display: block;
}

.login-prompt h2 {
  font-size: 22px;
  margin-bottom: 12px;
}

.login-prompt p {
  color: var(--text-dim);
  margin-bottom: 36px;
  font-size: 14px;
  line-height: 1.6;
}

.btn-login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 40px;
  background: var(--accent);
  color: #000;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(102, 170, 255, 0.25);
}

.btn-login:hover {
  background: #5599ee;
  box-shadow: 0 6px 28px rgba(102, 170, 255, 0.35);
  transform: translateY(-1px);
}

.btn-login:active {
  transform: translateY(0);
}

/* --- Tabs -------------------------------------------------- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
}

.tab {
  flex: 1;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.tab.active {
  background: var(--accent);
  color: #000;
  font-weight: 600;
}

/* --- Admin User Table ----------------------------------- */
.user-header {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-card, #1e293b);
  border-bottom: 2px solid var(--accent, #3b82f6);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim, #94a3b8);
}

.user-header span {
  flex: 1;
}

.user-row {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  align-items: center;
  border-bottom: 1px solid var(--border, #334155);
}

.user-row span {
  flex: 1;
}

.vm-name {
  font-size: 0.85rem;
}

.vm-ip {
  font-size: 0.85rem;
  font-family: "Courier New", Courier, monospace;
}

.vm-status {
  font-size: 0.85rem;
}

/* --- Modal Overlay ─────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  margin-bottom: 16px;
}

.modal .field { margin-bottom: 12px; }
.modal .field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.modal .field input,
.modal .field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #475569;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.85rem;
}
.modal .field textarea { min-height: 50px; resize: vertical; }
.modal .field-row { display: flex; gap: 12px; align-items: end; }
.modal .section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 12px;
  margin-bottom: 6px;
}

.tag-list { display: flex; flex-direction: column; gap: 3px; }
.tag {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; background: #0f172a; border-radius: 5px;
  font-family: "Courier New", monospace; font-size: 0.8rem;
}
.tag .remove { margin-left: auto; color: #ef4444; cursor: default; font-size: 0.8rem; }
.tag-add { display: flex; gap: 4px; margin-top: 2px; }
.tag-add input {
  flex: 1; padding: 5px 8px; border-radius: 5px;
  border: 1px dashed #475569; background: transparent;
  color: #94a3b8; font-size: 0.8rem;
}
.tag-add .btn { padding: 3px 10px; font-size: 0.75rem; }

/* --- Flavors Grid ----------------------------------------- */
.flavors {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 36px;
}

.flavor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: block;
}

.flavor-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.flavor-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(102, 170, 255, 0.2), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.flavor-card:hover {
  border-color: rgba(102, 170, 255, 0.3);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.flavor-card:hover::before {
  opacity: 1;
}

.flavor-card.selected,
.flavor-card:has(input:checked) {
  border-color: var(--accent);
  background: rgba(102, 170, 255, 0.06);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 32px rgba(102, 170, 255, 0.08);
}

.flavor-card.selected::before,
.flavor-card:has(input:checked)::before {
  opacity: 1;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.flavor-card .check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: transparent;
  user-select: none;
  pointer-events: none;
  transition: all var(--transition);
}

.flavor-card.selected .check,
.flavor-card:has(input:checked) .check {
  border-color: var(--accent);
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 12px rgba(102, 170, 255, 0.3);
}

.flavor-card .icon {
  font-size: 32px;
  margin-bottom: 10px;
}

.flavor-card .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.flavor-card .desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* --- Form Elements ---------------------------------------- */
.form-group {
  margin-bottom: 24px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

textarea, input[type="text"], input[type="number"], input[type="email"], input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-mono);
  transition: all var(--transition);
  outline: none;
}

textarea:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

textarea::placeholder, input::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

.hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
  line-height: 1.5;
}

/* --- SSH Key Input Area ----------------------------------- */
.key-input {
  position: relative;
}

.key-input textarea {
  margin-bottom: 8px;
}

.btn-generate {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 4px;
}

.btn-generate:hover:not(:disabled) {
  background: var(--accent-hover, #2563eb);
}

.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Hide the Blazor error UI unless there's actually an error */
#blazor-error-ui {
  display: none;
}

.file-input {
  display: none;
}

.btn-browse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  transition: all var(--transition);
}

.btn-browse:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

/* --- Buttons ---------------------------------------------- */
.btn-primary {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #66aaff, #5599ee);
  color: #000;
  transition: all var(--transition);
  font-family: var(--font);
  box-shadow: 0 4px 20px rgba(102, 170, 255, 0.2);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(102, 170, 255, 0.3);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  background: var(--border);
  color: var(--text-dim);
  cursor: not-allowed;
  box-shadow: none;
}

/* --- Error Message ---------------------------------------- */
.error {
  color: var(--error);
  font-size: 13px;
  margin: 12px 0;
  padding: 12px 16px;
  background: rgba(255, 85, 85, 0.06);
  border: 1px solid rgba(255, 85, 85, 0.15);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

/* --- Status / VM Info Box --------------------------------- */
.status-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 28px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 300ms ease-out;
}

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

.status-box h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-box p {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
  line-height: 1.6;
}

.cmd {
  background: #000;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 14px;
  margin: 12px 0;
  border: 1px solid rgba(76, 175, 127, 0.15);
  position: relative;
  overflow-x: auto;
  white-space: nowrap;
}

.cmd::before {
  content: '$ ';
  color: var(--text-dim);
}

.flavor-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(102, 170, 255, 0.1);
  border: 1px solid rgba(102, 170, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 6px;
}

.ip {
  color: var(--accent);
  font-weight: 600;
}

/* --- VPN Instructions ------------------------------------ */
.vpn-instructions {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.vpn-instructions summary {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: rgba(102, 170, 255, 0.05);
  user-select: none;
}

.vpn-instructions summary:hover {
  background: rgba(102, 170, 255, 0.08);
}

.vpn-steps {
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
}

.vpn-steps h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 12px 0 4px;
}

.vpn-steps ol {
  padding-left: 20px;
  margin: 4px 0;
}

.vpn-steps li {
  margin-bottom: 4px;
}

.vpn-steps code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent);
}

.vpn-steps a {
  color: var(--accent);
}

/* --- Publish Section -------------------------------------- */
.publish-section {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.publish-section h4 {
  display: flex;
  align-items: center;
  gap: 6px;
}

.publish-section > p {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.publish-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pub-input {
  flex: 1;
  min-width: 140px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  transition: all var(--transition);
  outline: none;
}

.pub-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.port-input {
  max-width: 110px;
}

.domain-suffix {
  font-size: 13px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.btn-publish {
  padding: 10px 20px;
  background: var(--bg-card);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  white-space: nowrap;
  transition: all var(--transition);
}

.btn-publish:hover:not(:disabled) {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.btn-publish:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.publish-msg {
  font-size: 13px;
  color: var(--accent);
  margin-top: 10px;
  animation: fadeIn 200ms ease-out;
}

/* --- Admin Requests --------------------------------------- */
.request-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.request-card:hover {
  border-color: rgba(102, 170, 255, 0.2);
}

.req-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.req-info strong {
  color: var(--text-bright);
  font-size: 14px;
  font-family: var(--font-mono);
}

.req-info span {
  font-size: 12px;
  color: var(--text-dim);
}

.req-time {
  font-size: 11px !important;
  font-family: var(--font-mono);
}

.req-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-approve, .btn-reject {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}

.btn-approve {
  background: rgba(76, 175, 127, 0.1);
  color: var(--success);
  border: 1px solid rgba(76, 175, 127, 0.2);
}

.btn-approve:hover {
  background: rgba(76, 175, 127, 0.2);
  border-color: var(--success);
}

.btn-reject {
  background: rgba(255, 85, 85, 0.1);
  color: var(--error);
  border: 1px solid rgba(255, 85, 85, 0.2);
}

.btn-reject:hover {
  background: rgba(255, 85, 85, 0.2);
  border-color: var(--error);
}

/* --- Footer ----------------------------------------------- */
footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  background: rgba(8, 8, 14, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* --- Scrollbar -------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* --- Selection -------------------------------------------- */
::selection {
  background: rgba(102, 170, 255, 0.2);
  color: var(--text-bright);
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 600px) {
  header { padding: 0 16px; }
  main, .container { padding: 24px 16px; }
  .flavors { grid-template-columns: 1fr; }
  .request-card { flex-direction: column; align-items: stretch; }
  .req-actions { justify-content: flex-end; }
  .publish-form { flex-direction: column; }
  .pub-input { min-width: 100%; }
  .port-input { max-width: 100%; }
  .login-prompt { padding: 60px 16px; }
}

/* --- Flavor Test Status Badges ---------------------------- */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-ok {
  background: rgba(76, 175, 127, 0.15);
  color: var(--success);
  border: 1px solid rgba(76, 175, 127, 0.3);
}
.status-fail {
  background: rgba(255, 85, 85, 0.15);
  color: var(--error);
  border: 1px solid rgba(255, 85, 85, 0.3);
}
.status-warn {
  background: rgba(245, 184, 0, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 184, 0, 0.3);
}
