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

:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-hover: #1a1a1a;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-dim: #888;
  --accent: #ffd700;
  --accent-dim: #b8960f;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 8px;
}

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

/* Login Page */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  color: var(--accent);
  font-size: 24px;
  margin-bottom: 8px;
}

.login-box p {
  color: var(--text-dim);
  margin-bottom: 24px;
  font-size: 14px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

textarea {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  resize: vertical;
  min-height: 200px;
  tab-size: 4;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-dim);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Layout */
.app {
  display: none;
}

.app.active {
  display: block;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.header h1 {
  font-size: 18px;
  color: var(--accent);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav {
  display: flex;
  gap: 4px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.nav-item {
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dim);
  transition: all 0.2s;
  border: none;
  background: none;
  font-family: inherit;
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--accent);
  background: var(--bg-hover);
}

.content {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Stats Cards */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card .label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 600;
}

.stat-card .value.running {
  color: var(--green);
}

.stat-card .value.stopped {
  color: var(--red);
}

/* Tables */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.table-header h2 {
  font-size: 16px;
  font-weight: 500;
}

.table-actions {
  display: flex;
  gap: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

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

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

/* Status indicators */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

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

.status-dot.green { background: var(--green); }
.status-dot.red { background: var(--red); }
.status-dot.yellow { background: var(--accent); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.badge-proxy {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
}

.badge-static {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.badge-network {
  background: rgba(255, 215, 0, 0.15);
  color: var(--accent);
  font-size: 11px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 18px;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* Logs */
.logs-container {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.8;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-dim);
}

/* Error / Alert */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--green);
}

.alert-info {
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: var(--accent);
}

/* Subdomain input group */
.input-group {
  display: flex;
  align-items: center;
}

.input-group input {
  border-radius: var(--radius) 0 0 var(--radius);
}

.input-group .suffix {
  padding: 10px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-dim);
  font-size: 14px;
  white-space: nowrap;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 200;
  animation: slideIn 0.3s ease;
}

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

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* Guide Page */
.guide {
  max-width: 800px;
  margin: 0 auto;
}

.guide-hero {
  text-align: center;
  padding: 32px 0 40px;
}

.guide-hero h2 {
  font-size: 24px;
  color: var(--accent);
  margin-bottom: 8px;
}

.guide-hero p {
  color: var(--text-dim);
  font-size: 15px;
}

.guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.guide-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.guide-section-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.guide-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 215, 0, 0.1);
  border-radius: 6px;
  color: var(--accent);
  font-size: 16px;
  flex-shrink: 0;
}

.guide-diagram {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.guide-diagram pre {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0;
}

.guide-note {
  background: rgba(255, 215, 0, 0.06);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 12px;
}

.guide-note strong {
  color: var(--accent);
}

/* Timeline */
.guide-timeline {
  position: relative;
  padding-left: 40px;
}

.guide-timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.guide-step {
  position: relative;
  margin-bottom: 32px;
}

.guide-step:last-child {
  margin-bottom: 0;
}

.step-number {
  position: absolute;
  left: -40px;
  top: 0;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  z-index: 1;
}

.step-content h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  padding-top: 4px;
}

.step-content p {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 12px;
}

.step-content code {
  background: rgba(255, 215, 0, 0.1);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* Guide Code Blocks */
.guide-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.code-header {
  background: var(--bg-hover);
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.guide-code pre {
  padding: 14px;
  margin: 0;
  overflow-x: auto;
}

.guide-code code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: none;
  padding: 0;
}

/* Guide Tabs (Dockerfile options) */
.guide-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.guide-tab-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.guide-tab-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.guide-tab-btn.active {
  background: rgba(255, 215, 0, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* Guide Tables */
.guide-table-wrap {
  overflow-x: auto;
  margin: 12px 0;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.guide-table th {
  background: var(--bg);
  padding: 8px 14px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}

.guide-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}

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

/* Checklist */
.guide-checklist {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}

.checklist-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
}

.checklist-item input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

.checklist-item span {
  flex: 1;
}

/* Option Cards (proxy vs static) */
.guide-option-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

.option-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.option-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.option-popular {
  font-size: 11px;
  color: var(--accent);
  background: rgba(255, 215, 0, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.option-card p {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.option-fields {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.option-fields code {
  color: var(--text);
}

/* Expandable section */
.guide-expand {
  margin-top: 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  user-select: none;
}

.guide-expand:hover {
  color: var(--accent);
}

.expand-icon {
  display: inline-block;
  transition: transform 0.2s;
  font-size: 10px;
  margin-right: 4px;
}

.guide-expand.open .expand-icon {
  transform: rotate(90deg);
}

.expand-content {
  display: none;
}

.guide-expand.open .expand-content {
  display: block;
}

/* Rules */
.guide-rules {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rule-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.rule-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}

.rule-card p {
  font-size: 13px;
  color: var(--text-dim);
}

.rule-card code {
  background: rgba(255, 215, 0, 0.1);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* Responsive */
@media (max-width: 768px) {
  .content { padding: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  td, th { padding: 10px 12px; }
  .guide-option-cards { grid-template-columns: 1fr; }
  .guide-timeline { padding-left: 32px; }
  .step-number { left: -32px; width: 26px; height: 26px; font-size: 12px; }
}
