/* GamadCode — shared styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d1117;
  --bg2:       #161b22;
  --bg3:       #21262d;
  --border:    #30363d;
  --text:      #c9d1d9;
  --muted:     #8b949e;
  --accent:    #58a6ff;
  --green:     #3fb950;
  --green-bg:  #238636;
  --green-dim: #196c2e;
  --red:       #f85149;
  --yellow:    #d29922;
  --orange:    #e3b341;
  --purple:    #bc8cff;
  --radius:    8px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12px; color: #7ee787; background: rgba(110,118,129,.1); padding: 2px 6px; border-radius: 4px; }

/* ── Layout ── */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 0;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo h2 { color: var(--accent); font-size: 1.1rem; letter-spacing: 1px; }
.sidebar-logo small { color: var(--muted); font-size: 11px; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  border-left: 3px solid transparent;
  text-decoration: none;
  font-size: 13px;
}
.nav-item:hover { color: var(--text); background: var(--bg3); text-decoration: none; }
.nav-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(88,166,255,.07); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-user {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user img { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); }
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 11px; color: var(--muted); }
.sidebar-user a { color: var(--muted); font-size: 11px; }

.main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.topbar {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 1.1rem; font-weight: 600; }
.topbar .breadcrumb { color: var(--muted); font-size: 12px; margin-top: 2px; }
.content { padding: 28px; flex: 1; }

/* ── Cards / Grid ── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title { font-weight: 600; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.card-value { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.card-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── Progress bar ── */
.progress { height: 6px; background: var(--bg3); border-radius: 3px; margin-top: 12px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 3px; transition: width .5s ease; background: var(--accent); }
.progress-bar.warn { background: var(--yellow); }
.progress-bar.danger { background: var(--red); }

/* ── Status badge ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 500;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active  { color: var(--green);  background: rgba(63,185,80,.12); }
.badge.inactive{ color: var(--red);    background: rgba(248,81,73,.12); }
.badge.installed { color: var(--green); background: rgba(63,185,80,.12); }
.badge.pending   { color: var(--yellow); background: rgba(210,153,34,.12); }

/* ── Table ── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 500; }
.table tbody tr:hover { background: var(--bg3); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
  font-family: inherit;
}
.btn-primary  { background: var(--green-bg); color: #fff; border-color: var(--green-dim); }
.btn-primary:hover  { background: #2ea043; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg3); }
.btn-danger   { background: transparent; color: var(--red); border-color: rgba(248,81,73,.4); }
.btn-danger:hover { background: rgba(248,81,73,.08); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ── Logs ── */
.log-container {
  background: #010409;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 12px;
  height: 480px;
  overflow-y: auto;
  padding: 16px;
  color: #c9d1d9;
}
.log-line { line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.log-line.ok     { color: #3fb950; }
.log-line.error  { color: #f85149; }
.log-line.warn   { color: #d29922; }
.log-line.info   { color: #79c0ff; }
.log-line.step   { color: #c9d1d9; }
.log-line.section { color: #bc8cff; font-weight: bold; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.form-input {
  width: 100%; padding: 8px 12px;
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: inherit;
  transition: border-color .15s;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── Toggle ── */
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--bg3); border-radius: 20px;
  border: 1px solid var(--border); transition: .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; left: 2px; bottom: 2px;
  background: var(--muted); border-radius: 50%; transition: .2s;
}
.toggle input:checked + .toggle-slider { background: var(--green-bg); border-color: var(--green-dim); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); background: #fff; }

/* ── Alert / Banner ── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13px; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-info    { background: rgba(88,166,255,.1);  border: 1px solid rgba(88,166,255,.3);  color: var(--accent); }
.alert-success { background: rgba(63,185,80,.1);   border: 1px solid rgba(63,185,80,.3);   color: var(--green); }
.alert-warn    { background: rgba(210,153,34,.1);  border: 1px solid rgba(210,153,34,.3);  color: var(--yellow); }
.alert-danger  { background: rgba(248,81,73,.1);   border: 1px solid rgba(248,81,73,.3);   color: var(--red); }

/* ── Loading spinner ── */
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Setup wizard ── */
.wizard { max-width: 640px; margin: 0 auto; padding: 40px 20px; }
.wizard-steps { display: flex; gap: 0; margin-bottom: 40px; }
.step-item { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
.step-item:not(:last-child)::after {
  content: ''; position: absolute; top: 14px; left: 50%; width: 100%;
  height: 2px; background: var(--border); z-index: 0;
}
.step-item.done::after { background: var(--green); }
.step-num {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--bg2); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; z-index: 1; position: relative;
}
.step-item.active .step-num { border-color: var(--accent); color: var(--accent); }
.step-item.done   .step-num { border-color: var(--green); background: var(--green); color: #fff; }
.step-label { font-size: 11px; color: var(--muted); margin-top: 6px; text-align: center; }
.step-item.active .step-label { color: var(--text); }
.step-panel { display: none; }
.step-panel.active { display: block; }
.wizard-nav { display: flex; justify-content: space-between; margin-top: 32px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { padding: 16px; }
}
