/* ─── ProxBuilder – Global Styles ──────────────────────────────────────────── */
:root {
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #e0e7ff;
  --success:       #22c55e;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --bg:            #f1f5f9;
  --card-bg:       #ffffff;
  --text:          #1e293b;
  --muted:         #64748b;
  --border:        #e2e8f0;
  --sidebar-w:     300px;
}

* { box-sizing: border-box; }

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

/* ─── Topbar ─────────────────────────────────────────────────────────────────*/
.topbar {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e40af 100%);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,.3);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.5px;
  text-decoration: none;
}

.topbar-brand .brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.topbar-badge {
  background: rgba(255,255,255,.2);
  color: #c7d2fe;
  font-size: .65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ─── Layout ─────────────────────────────────────────────────────────────────*/
.builder-layout {
  display: flex;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  align-items: flex-start;
}

.builder-main  { flex: 1; min-width: 0; }
.builder-aside {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 80px;
}

/* ─── Step Indicator ─────────────────────────────────────────────────────────*/
.step-indicator {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  border: 1px solid var(--border);
}

.steps-track {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  position: relative;
}

.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(50% + 16px);
  right: calc(-50% + 16px);
  height: 2px;
  background: var(--border);
  z-index: 0;
  transition: background .3s;
}

.step-item.done:not(:last-child)::after  { background: var(--success); }
.step-item.active:not(:last-child)::after { background: var(--border); }

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  z-index: 1;
  transition: all .25s;
  flex-shrink: 0;
}

.step-item.active .step-dot {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px var(--primary-light);
}

.step-item.done .step-dot {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.step-label {
  font-size: .65rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70px;
}

.step-item.active .step-label { color: var(--primary); font-weight: 600; }
.step-item.done  .step-label  { color: var(--success); }

/* ─── Card ───────────────────────────────────────────────────────────────────*/
.card {
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
}

.card-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1rem;
  flex-shrink: 0;
}

.card-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.card-header p {
  margin: 2px 0 0;
  font-size: .82rem;
  color: var(--muted);
}

.card-body { padding: 1.5rem; }

/* ─── Step Panels ────────────────────────────────────────────────────────────*/
.step-panel { display: none; }
.step-panel.active { display: block; }

/* ─── Type Cards (Step 1) ───────────────────────────────────────────────────*/
.type-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.type-card {
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  cursor: pointer;
  transition: all .2s;
  background: var(--card-bg);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.type-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--primary-light);
  opacity: 0;
  transition: opacity .2s;
}

.type-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(99,102,241,.15); }
.type-card:hover::before { opacity: .3; }
.type-card.selected { border-color: var(--primary); background: #fafbff; box-shadow: 0 0 0 3px var(--primary-light); }
.type-card.selected::before { opacity: .5; }

.type-card .type-icon {
  width: 70px;
  height: 70px;
  border-radius: 20px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  position: relative;
  z-index: 1;
}

.type-card.lxc .type-icon { background: #dbeafe; color: #2563eb; }
.type-card.kvm .type-icon { background: #fce7f3; color: #db2777; }

.type-card h3 { font-size: 1.15rem; font-weight: 700; margin: 0 0 .4rem; position: relative; z-index: 1; }
.type-card p  { font-size: .83rem; color: var(--muted); margin: 0; position: relative; z-index: 1; line-height: 1.5; }

.type-card .type-badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  margin-bottom: .75rem;
  position: relative;
  z-index: 1;
}

.type-card.lxc .type-badge { background: #dbeafe; color: #1d4ed8; }
.type-card.kvm .type-badge { background: #fce7f3; color: #be185d; }

.type-card .check-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  z-index: 2;
}

.type-card.selected .check-badge { display: flex; }

/* ─── OS Grid ────────────────────────────────────────────────────────────────*/
.os-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .75rem;
  margin-bottom: 1.5rem;
}

.os-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem .75rem;
  cursor: pointer;
  transition: all .18s;
  text-align: center;
  background: var(--card-bg);
}

.os-card:hover  { border-color: var(--primary); background: #fafbff; }
.os-card.selected { border-color: var(--primary); background: var(--primary-light); }

.os-card .os-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  margin: 0 auto .6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: #f1f5f9;
}

.os-card h4 { font-size: .82rem; font-weight: 600; margin: 0; }
.os-card p  { font-size: .7rem; color: var(--muted); margin: 2px 0 0; }

/* ─── Form Controls ──────────────────────────────────────────────────────────*/
.form-label { font-weight: 600; font-size: .88rem; color: var(--text); margin-bottom: .4rem; }
.form-label small { font-weight: 400; color: var(--muted); }

.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem .85rem;
  font-size: .9rem;
  color: var(--text);
  background: var(--card-bg);
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-control { resize: vertical; min-height: 100px; font-family: 'Fira Code', 'Courier New', monospace; font-size: .85rem; }

.form-text { font-size: .76rem; color: var(--muted); margin-top: .3rem; }

/* ─── Resource Slider ────────────────────────────────────────────────────────*/
.resource-slider-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: .5rem;
}

.resource-value {
  min-width: 90px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: .9rem;
  border-radius: 10px;
  padding: .45rem .75rem;
  text-align: center;
  flex-shrink: 0;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
  height: 6px;
  cursor: pointer;
}

/* ─── Toggle Switches ────────────────────────────────────────────────────────*/
.toggle-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1rem;
  cursor: pointer;
  transition: border-color .2s;
}

.toggle-item:hover { border-color: var(--primary); }
.toggle-item.active { border-color: var(--primary); background: var(--primary-light); }

.toggle-label { font-size: .85rem; font-weight: 500; }
.toggle-sublabel { font-size: .72rem; color: var(--muted); margin-top: 1px; }

.toggle-switch {
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle-item.active .toggle-switch { background: var(--primary); }
.toggle-item.active .toggle-switch::after { transform: translateX(18px); }

/* ─── Radio Group ─────────────────────────────────────────────────────────── */
.radio-group { display: flex; gap: .6rem; flex-wrap: wrap; }

.radio-btn {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: .55rem 1rem;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
  background: var(--card-bg);
  user-select: none;
}

.radio-btn:hover  { border-color: var(--primary); background: #fafbff; }
.radio-btn.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }

/* ─── Summary Sidebar ────────────────────────────────────────────────────────*/
.summary-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.summary-header {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  padding: 1rem 1.25rem;
  color: #fff;
}

.summary-header h3 { margin: 0; font-size: .95rem; font-weight: 700; }
.summary-header p  { margin: 2px 0 0; font-size: .75rem; color: #c7d2fe; }

.summary-body { padding: 1rem 1.25rem; }

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  gap: .5rem;
}

.summary-row:last-child { border-bottom: none; }

.summary-key {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  flex-shrink: 0;
}

.summary-val {
  font-size: .82rem;
  font-weight: 500;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.summary-val.empty { color: var(--muted); font-style: italic; }

/* ─── Navigation Buttons ─────────────────────────────────────────────────────*/
.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.4rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .18s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,.35); }

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

.btn-success {
  background: var(--success);
  color: #fff;
  font-size: 1rem;
  padding: .75rem 2rem;
}
.btn-success:hover { background: #16a34a; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(34,197,94,.35); }

.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-lg { font-size: 1rem; padding: .8rem 2rem; }

/* ─── Output / Preview ───────────────────────────────────────────────────────*/
.output-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }

.output-tab {
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--muted);
  transition: all .18s;
}

.output-tab.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }

.code-block {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: .78rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
  max-height: 480px;
  overflow-y: auto;
  border: 1px solid #1e293b;
}

.code-block .sh-comment  { color: #64748b; }
.code-block .sh-keyword  { color: #818cf8; }
.code-block .sh-string   { color: #34d399; }
.code-block .sh-var      { color: #fbbf24; }

/* ─── Success Screen ─────────────────────────────────────────────────────────*/
.success-screen {
  text-align: center;
  padding: 3rem 2rem;
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #dcfce7;
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.5rem;
}

/* ─── Section Divider ────────────────────────────────────────────────────────*/
.section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  margin: 1.5rem 0 .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Alerts ─────────────────────────────────────────────────────────────────*/
.alert {
  border-radius: 10px;
  padding: .85rem 1rem;
  font-size: .88rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
}

.alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ─── Progress bar ───────────────────────────────────────────────────────────*/
.progress-bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 1rem;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 2px;
  transition: width .4s ease;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────*/
@media (max-width: 900px) {
  .builder-layout { flex-direction: column; padding: 1rem; }
  .builder-aside  { width: 100%; position: static; }
  .type-cards     { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .type-cards { grid-template-columns: 1fr; }
  .os-grid    { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .toggle-group { grid-template-columns: 1fr; }
  .topbar       { padding: 0 1rem; }
}

/* ─── Admin styles ───────────────────────────────────────────────────────────*/
.admin-table th { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.admin-table td { font-size: .88rem; vertical-align: middle; }
.config-badge   { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.config-badge.lxc { background: #dbeafe; color: #1d4ed8; }
.config-badge.kvm { background: #fce7f3; color: #be185d; }

/* ─── 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(--muted); }

/* ─── Textarea code ──────────────────────────────────────────────────────────*/
.code-textarea {
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: .83rem;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #1e293b;
  border-radius: 10px;
  min-height: 160px;
  padding: 1rem;
  resize: vertical;
}

.code-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  outline: none;
}
