:root {
  --pd-green: #06AC38;
  --pd-green-light: #0BD849;
  --pd-green-dark: #058A2D;
  --pd-green-subtle: rgba(6, 172, 56, 0.12);
  --pd-green-dim: rgba(6, 172, 56, 0.3);
  --bg-primary: #0D1117;
  --bg-card: rgba(22, 27, 34, 0.85);
  --bg-input: #161B22;
  --border: #30363D;
  --border-light: #484F58;
  --text-primary: #C9D1D9;
  --text-muted: #8B949E;
  --text-bright: #F0F6FC;
  --danger: #ff5555;
  --glow: 0 0 60px rgba(6, 172, 56, 0.1), 0 0 20px rgba(6, 172, 56, 0.06);
}

@font-face {
  font-family: 'MesloLGS NF';
  src: url('../fonts/MesloLGS_NF_Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MesloLGS NF';
  src: url('../fonts/MesloLGS_NF_Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ── Grid background pattern ── */

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background-image:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
  background-size: 40px 40px;
}

/* ── Login Card (glass effect) ── */

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(48, 54, 61, 0.6);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--glow);
  animation: fadeIn 0.4s ease-out;
}

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

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}

.login-header h1 span {
  color: var(--pd-green);
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

/* ── Form ── */

.form-group {
  margin-bottom: 1rem;
}

.form-row {
  display: flex;
  gap: 0.75rem;
}

.form-row .form-group {
  flex: 1;
}

.form-row .form-group.port {
  flex: 0 0 90px;
}

label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

input[type="text"],
input[type="number"],
input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: 'JetBrains Mono', 'MesloLGS NF', 'Menlo', 'Consolas', monospace;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  outline: none;
  border-color: var(--pd-green);
  box-shadow: 0 0 0 3px var(--pd-green-subtle);
}

input::placeholder {
  color: var(--border-light);
}

.hidden {
  display: none !important;
}

/* ── Connect Button ── */

.btn-connect {
  width: 100%;
  padding: 0.75rem;
  background: var(--pd-green);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  margin-top: 0.75rem;
  letter-spacing: 0.02em;
}

.btn-connect:hover {
  background: var(--pd-green-light);
  box-shadow: 0 0 20px rgba(6, 172, 56, 0.25);
}

.btn-connect:active {
  background: var(--pd-green-dark);
}

.btn-connect:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error-msg {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.75rem;
  text-align: center;
}

/* ── Terminal Page ── */

.terminal-container {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
}

#terminal {
  width: 100%;
  height: 100%;
}

/* Status bar */
.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: var(--bg-input);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', 'MesloLGS NF', monospace;
  color: var(--text-muted);
  z-index: 20;
  gap: 1rem;
}

.status-bar .status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pd-green);
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(6, 172, 56, 0.5);
}

.status-bar .status-indicator.disconnected {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(255, 85, 85, 0.5);
}

/* Banner overlay */
.banner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 2px solid var(--pd-green);
  padding: 1rem 1.5rem;
  font-family: 'MesloLGS NF', 'Menlo', 'Consolas', monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  color: var(--text-primary);
  max-height: 40vh;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

/* Reconnect overlay */
.reconnect-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.reconnect-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(48, 54, 61, 0.6);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  max-width: 360px;
  box-shadow: var(--glow);
  animation: fadeIn 0.3s ease-out;
}

.reconnect-card h2 {
  font-size: 1.1rem;
  color: var(--text-bright);
  margin-bottom: 0.5rem;
}

.reconnect-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.reconnect-card .btn-connect {
  width: auto;
  padding: 0.5rem 1.5rem;
  display: inline-block;
  margin: 0 0.25rem;
}

.btn-secondary {
  background: var(--border);
}

.btn-secondary:hover {
  background: var(--border-light);
  box-shadow: none;
}
