/* Alpine 5G Web GUI – shared styles */

:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --danger: #f85149;
  --success: #3fb950;
  --radius: 8px;
  --font: system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
}

.login-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.login-card .sub {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

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

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

.form-group input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  padding: 0.6rem;
  margin-top: 0.5rem;
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  background: #3d4d66;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #ff6b6b;
}

.login-error {
  margin-top: 1rem;
  padding: 0.5rem 0.75rem;
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid var(--danger);
  border-radius: 6px;
  color: var(--danger);
  font-size: 0.875rem;
  display: none;
}
.login-error.visible {
  display: block;
}

/* Dashboard */
.dash {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.dash-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.user-badge {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.user-badge strong {
  color: var(--text);
}

.nav-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.nav-tabs button {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
}
.nav-tabs button:hover {
  color: var(--text);
  border-color: var(--text-muted);
}
.nav-tabs button.active {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent);
}

/* Nav links (per-page layout) */
.nav-links {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.nav-link {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  background: transparent;
  text-decoration: none;
}
.nav-link:hover {
  color: var(--text);
  border-color: var(--text-muted);
}
.nav-link.active {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent);
}

.page-content {
  margin-top: 0.5rem;
}

.panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.panel.active {
  display: block;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.status-item {
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.status-item label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.status-item .value {
  font-family: ui-monospace, monospace;
  font-size: 0.875rem;
  word-break: break-all;
}

.log-view {
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  max-height: 400px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.config-editor,
.firewall-editor {
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  width: 100%;
  min-height: 280px;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  resize: vertical;
}
.config-editor:focus,
.firewall-editor:focus {
  outline: none;
  border-color: var(--accent);
}

.config-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.config-form .form-group {
  margin-bottom: 0;
}

.actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.msg {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: none;
}
.msg.visible {
  display: block;
}
.msg.success {
  background: rgba(63, 185, 80, 0.15);
  border: 1px solid var(--success);
  color: var(--success);
}
.msg.error {
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-weight: 500;
}

.routes-list {
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  max-height: 300px;
  overflow: auto;
}

.routes-list div {
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}
.routes-list div:last-child {
  border-bottom: none;
}

.hidden {
  display: none !important;
}

.form-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.form-row input,
.form-row select {
  padding: 0.4rem 0.5rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-row input[type="number"] {
  width: 5rem;
}

.status-section {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 1.25rem 0 0.5rem;
}

.speedtest-result {
  font-family: ui-monospace, monospace;
  font-size: 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  min-height: 2rem;
  white-space: pre-wrap;
}
