/* ============================================================
   VulnLab — Cybersecurity Training Platform
   Dark Terminal Aesthetic · Professional
   ============================================================ */

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

:root {
  --bg:        #0b0e14;
  --surface:   #141820;
  --sidebar:   #090b10;
  --card:      #181d25;
  --border:    #1f2633;
  --border-hi: #2d3545;

  --text:      #dde2eb;
  --text-dim:  #8896a9;
  --text-fade: #5a677b;

  --accent:    #00c896;
  --accent-hi: #00e6ac;
  --blue:      #4d94ff;
  --red:       #f04343;
  --orange:    #f08c36;
  --yellow:    #e6b422;
  --green:     #2db55d;

  --mono:      'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --sans:      'Inter', 'PingFang SC', 'Microsoft YaHei', sans-serif;

  --radius:    6px;
  --radius-lg: 10px;
  --side-w:    248px;
}

html { font-size: 15px; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

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

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--side-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}

.sidebar-brand {
  padding: 1.4rem 1.3rem;
  display: flex; align-items: center; gap: 0.7rem;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-weight: 800; font-size: 0.85rem; color: #000;
  font-family: var(--mono);
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 700; font-size: 1rem; color: #fff; letter-spacing: -0.2px; }
.brand-sub {
  font-size: 0.66rem; color: var(--text-fade); margin-top: 1px;
  font-family: var(--mono); letter-spacing: 0.4px;
}

.sidebar-nav { flex: 1; padding: 0.8rem 0.7rem; overflow-y: auto; }
.nav-section {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 1.6px;
  color: var(--text-fade); padding: 1.1rem 0.7rem 0.3rem; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.5rem 0.7rem;
  border-radius: var(--radius); color: var(--text-dim); text-decoration: none;
  font-size: 0.88rem; transition: background 0.12s, color 0.12s; margin-bottom: 1px;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active {
  background: rgba(0,200,150,0.1); color: var(--accent); font-weight: 600;
  border: 1px solid rgba(0,200,150,0.2);
}
.nav-dot { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 0.9rem 1.2rem; border-top: 1px solid var(--border);
  font-size: 0.68rem; color: var(--text-fade);
  font-family: var(--mono);
}

/* ── Main ── */
.main-content { flex: 1; margin-left: var(--side-w); padding: 2.2rem 2.5rem; }

.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.35rem; font-weight: 700; color: #fff; margin-bottom: 0.25rem; }
.page-header p { color: var(--text-dim); font-size: 0.88rem; }

/* ── Card Grid ── */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }

.exp-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  text-decoration: none; display: block; position: relative;
  transition: border-color 0.18s, background 0.18s;
}
.exp-card:hover { border-color: var(--accent); background: #1a202a; }
.exp-card .exp-num {
  position: absolute; top: 14px; right: 18px;
  font-size: 1.9rem; font-weight: 800; color: rgba(0,200,150,0.06);
  font-family: var(--mono);
}
.exp-card .exp-tag {
  display: inline-block; font-size: 0.68rem; padding: 0.15rem 0.55rem;
  border-radius: 3px; font-weight: 600; letter-spacing: 0.3px;
  margin-bottom: 1rem;
}
.exp-card .exp-tag.tag-pwd { background: rgba(77,148,255,0.15); color: var(--blue); }
.exp-card .exp-tag.tag-sql { background: rgba(240,140,54,0.15); color: var(--orange); }
.exp-card .exp-tag.tag-upload { background: rgba(240,67,67,0.15); color: var(--red); }
.exp-card .exp-tag.tag-idor { background: rgba(230,180,34,0.15); color: var(--yellow); }
.exp-card .exp-tag.tag-lfi { background: rgba(160,120,255,0.15); color: #a078ff; }
.exp-card .exp-tag.tag-csrf { background: rgba(255,140,100,0.15); color: #ff8c64; }
.exp-card .exp-tag.tag-ssrf { background: rgba(0,200,150,0.15); color: var(--accent); }
.exp-card .exp-tag.tag-cmdi { background: rgba(240,67,67,0.15); color: var(--red); }
.exp-card .exp-tag.tag-xxe { background: rgba(77,180,255,0.15); color: #4db4ff; }

.exp-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.35rem; color: #fff; }
.exp-card p { color: var(--text-dim); font-size: 0.83rem; line-height: 1.5; margin-bottom: 1rem; }
.exp-card .exp-link {
  color: var(--accent); font-weight: 600; font-size: 0.83rem;
  display: inline-flex; align-items: center; gap: 0.3rem; transition: gap 0.15s;
}
.exp-card:hover .exp-link { gap: 0.5rem; }

/* ── Cards ── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2rem;
}
.card-lg { max-width: 820px; }
.card-header { margin-bottom: 1.5rem; }
.card-header h2 { font-size: 1.15rem; font-weight: 700; color: #fff; }
.card-header p { color: var(--text-dim); font-size: 0.84rem; margin-top: 0.2rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block; margin-bottom: 0.35rem; font-weight: 600;
  font-size: 0.82rem; color: var(--text-dim); letter-spacing: 0.2px;
}
.form-input, .form-control {
  width: 100%; padding: 0.62rem 0.85rem;
  background: var(--bg); border: 1px solid var(--border-hi);
  border-radius: var(--radius); font-size: 0.9rem; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.form-input:focus, .form-control:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,200,150,0.1);
}
.form-input::placeholder { color: var(--text-fade); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  width: 100%; padding: 0.65rem 1rem;
  background: var(--accent); color: #000; border: none;
  border-radius: var(--radius); cursor: pointer; font-size: 0.9rem; font-weight: 600;
  text-decoration: none; letter-spacing: 0.2px;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--accent-hi); }
.btn:active { transform: scale(0.98); }
.btn-sm { width: auto; padding: 0.35rem 0.85rem; font-size: 0.82rem; }
.btn-outline {
  background: transparent; color: var(--text-dim); border: 1px solid var(--border-hi);
}
.btn-outline:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #e55252; }
.btn-warn { background: var(--orange); color: #fff; }
.btn-warn:hover { background: #f49a4a; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #3ac46a; }
.btn-secondary { background: var(--border-hi); color: var(--text); }
.btn-secondary:hover { background: #3a4355; }

/* ── Alerts ── */
.alert {
  padding: 0.7rem 0.95rem; border-radius: var(--radius);
  margin-bottom: 1rem; font-size: 0.86rem; line-height: 1.5;
}
.alert-error {
  background: rgba(240,67,67,0.08); color: #f76c6c;
  border: 1px solid rgba(240,67,67,0.2);
}
.alert-success {
  background: rgba(45,181,93,0.08); color: #4cc97a;
  border: 1px solid rgba(45,181,93,0.2);
}
.alert-warn {
  background: rgba(240,140,54,0.08); color: #f5a55a;
  border: 1px solid rgba(240,140,54,0.2);
}
.error-msg {
  background: rgba(240,67,67,0.06); color: #f76c6c;
  padding: 0.65rem 0.9rem; border-radius: var(--radius);
  margin-bottom: 1rem; font-size: 0.85rem;
  border: 1px solid rgba(240,67,67,0.15);
}
.success-msg {
  background: rgba(45,181,93,0.06); color: #4cc97a;
  padding: 0.65rem 0.9rem; border-radius: var(--radius);
  margin-bottom: 1rem; font-size: 0.85rem;
  border: 1px solid rgba(45,181,93,0.15);
}

/* ── Info Grid ── */
.info-grid { margin: 1.2rem 0; }
.info-row {
  display: flex; align-items: center; padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-row .label { width: 86px; font-weight: 600; color: var(--text-fade); font-size: 0.82rem; flex-shrink: 0; }
.info-row .value { font-weight: 500; font-size: 0.9rem; color: var(--text); }

/* ── Leak ── */
.leak { color: var(--red) !important; font-weight: 700 !important; font-family: var(--mono); }

/* ── Badge ── */
.badge {
  display: inline-block; padding: 0.18rem 0.6rem;
  border-radius: 3px; font-size: 0.73rem; font-weight: 600;
}
.badge-admin { background: rgba(77,148,255,0.12); color: var(--blue); }
.badge-user { background: rgba(0,200,150,0.1); color: var(--accent); }

/* ── Data Table ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th {
  text-align: left; padding: 0.55rem 0.7rem;
  font-size: 0.72rem; font-weight: 700; color: var(--text-fade);
  text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 2px solid var(--border);
}
.data-table td { padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border); }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Source View ── */
.source-view {
  background: var(--sidebar); color: var(--text-dim); padding: 1.2rem;
  border-radius: var(--radius); font-family: var(--mono);
  font-size: 0.8rem; line-height: 1.7; overflow-x: auto;
  white-space: pre-wrap; word-break: break-all; max-height: 480px; overflow-y: auto;
  border: 1px solid var(--border);
}

/* ── Tip Box ── */
.tip-box {
  background: rgba(77,148,255,0.04); border: 1px solid rgba(77,148,255,0.15);
  padding: 0.85rem 1rem; border-radius: var(--radius);
  color: var(--text-dim); font-size: 0.86rem; line-height: 1.65;
  margin-bottom: 0.6rem;
}
.tip-box code, .tip-box kbd {
  background: rgba(77,148,255,0.1); padding: 1px 7px; border-radius: 3px;
  font-family: var(--mono); font-size: 0.82rem; color: var(--blue);
}
.tip-box strong { color: var(--text); }

/* ── Hint / Code Block ── */
.hint-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.2rem; margin-top: 1.2rem;
}
.hint-card h4 { color: var(--text-dim); margin-bottom: 0.5rem; font-size: 0.92rem; }
.hint-card p { font-size: 0.85rem; color: var(--text-dim); }
.code-block {
  background: #0c0f16; border: 1px solid var(--border);
  color: #b0c4d8; font-family: var(--mono);
  padding: 1rem; border-radius: var(--radius);
  font-size: 0.8rem; overflow-x: auto; line-height: 1.65; margin-top: 0.4rem;
}
.code-block code { background: none; padding: 0; color: var(--text); }
.code-block strong { color: var(--accent); }

/* ── Level Headers ── */
.level-header {
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.4rem; margin-bottom: 1.2rem; color: #fff;
}
.level-header.level-1 { background: #1a3a2a; border-left: 3px solid var(--green); }
.level-header.level-2 { background: #2e2410; border-left: 3px solid var(--orange); }
.level-header.level-3 { background: #2e1515; border-left: 3px solid var(--red); }
.level-header h2 { font-size: 1.15rem; margin: 0.3rem 0; }
.level-header p { opacity: 0.78; font-size: 0.85rem; }
.level-header code { background: rgba(0,0,0,0.3); padding: 0.1rem 0.4rem; border-radius: 3px; }
.level-badge {
  display: inline-block; background: rgba(0,0,0,0.4); color: #fff;
  padding: 0.15rem 0.5rem; border-radius: 3px; font-size: 0.7rem; font-weight: 700;
}

/* ── Level Cards ── */
.level-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.4rem;
  text-decoration: none; display: block; position: relative;
  transition: border-color 0.18s, background 0.18s; margin-bottom: 0.8rem;
  border-left: 3px solid var(--border);
}
.level-card:hover { border-color: var(--accent); background: #1a202a; }
.level-card.level-1 { border-left-color: var(--green); }
.level-card.level-2 { border-left-color: var(--orange); }
.level-card.level-3 { border-left-color: var(--red); }
.level-card h3 { color: #fff; margin: 0.3rem 0; font-size: 1.05rem; }
.level-card p { color: var(--text-dim); font-size: 0.85rem; line-height: 1.5; }
.level-difficulty {
  position: absolute; top: 1.4rem; right: 1.4rem;
  font-size: 0.75rem; color: var(--text-fade);
}
.level-arrow { display: inline-block; margin-top: 0.6rem; font-weight: 600; color: var(--accent); font-size: 0.85rem; }

/* ── Action Grid ── */
.action-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1rem; margin-bottom: 1.2rem;
}
.action-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.2rem;
  border-left: 3px solid var(--border);
}
.action-card.action-danger { border-left-color: var(--red); }
.action-card.action-success { border-left-color: var(--green); }
.action-card.action-warn { border-left-color: var(--orange); }
.action-card h4 { font-size: 0.92rem; margin-bottom: 0.65rem; display: flex; align-items: center; gap: 0.4rem; color: #fff; }
.tag {
  font-size: 0.65rem; padding: 0.1rem 0.4rem; border-radius: 3px;
  background: rgba(255,255,255,0.06); color: var(--text-dim); font-weight: 600;
}
.tag-adv { background: rgba(240,67,67,0.15); color: var(--red); }

/* ── Form Row ── */
.form-row { display: flex; gap: 0.65rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 110px; }
.form-group select {
  width: 100%; padding: 0.5rem 0.7rem;
  background: var(--bg); border: 1px solid var(--border-hi);
  border-radius: var(--radius); font-size: 0.88rem; color: var(--text);
  font-family: inherit;
}
.form-group select:focus { outline: none; border-color: var(--accent); }
.input-prefix {
  display: flex; align-items: center;
  border: 1px solid var(--border-hi); border-radius: var(--radius); overflow: hidden;
}
.input-prefix:focus-within { border-color: var(--accent); }
.input-prefix .prefix {
  background: var(--sidebar); padding: 0.45rem 0.55rem;
  font-weight: 600; color: var(--text-dim); border-right: 1px solid var(--border-hi);
}
.input-prefix input { border: none !important; box-shadow: none !important; flex: 1; background: transparent; }

/* ── Info Card / Table ── */
.info-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.2rem; margin-bottom: 1.2rem;
}
.info-card h3 {
  font-size: 0.95rem; margin-bottom: 0.8rem; padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border); color: #fff;
}
.info-table { width: 100%; border-collapse: collapse; }
.info-table tr { border-bottom: 1px solid var(--border); }
.info-table tr:last-child { border-bottom: none; }
.info-table td { padding: 0.5rem 0.65rem; font-size: 0.86rem; }
.info-table .label { width: 120px; color: var(--text-fade); font-weight: 600; }
.info-table .value { color: var(--text); }
.info-table .sensitive { color: var(--red); font-family: var(--mono); font-weight: 600; }
.info-table .mono { font-family: var(--mono); word-break: break-all; font-size: 0.78rem; }

/* ── Login ── */
.login-wrapper { display: flex; justify-content: center; align-items: center; min-height: 55vh; }
.login-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2.2rem;
  width: 100%; max-width: 390px;
}
.login-header { text-align: center; margin-bottom: 1.5rem; }
.login-header h2 { font-size: 1.25rem; color: #fff; }
.login-header p { color: var(--text-dim); margin-top: 0.2rem; font-size: 0.85rem; }
.login-form .form-group { margin-bottom: 0.9rem; }
.login-hint {
  text-align: center; margin-top: 1.2rem; padding-top: 1rem;
  border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--text-dim);
}
.login-hint code {
  background: rgba(0,200,150,0.08); padding: 0.1rem 0.4rem;
  border-radius: 3px; font-weight: 600; color: var(--accent);
}

/* ── Row Highlight ── */
.row-me { background: rgba(0,200,150,0.04) !important; }
.money { font-family: var(--mono); font-weight: 600; }

/* ── Result ── */
.result { display: inline-block; margin-left: 0.65rem; font-size: 0.82rem; font-weight: 500; }
.result.success { color: var(--green); }
.result.error { color: var(--red); }

/* ── Upload ── */
.upload-container { max-width: 600px; }
.upload-container .upload-form {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1rem;
}
.upload-success {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.2rem; margin-top: 1rem;
}
.upload-success img { border-radius: var(--radius); margin: 0.6rem 0; }
.file-input {
  width: 100%; padding: 0.5rem 0;
  font-size: 0.88rem; color: var(--text-dim);
}
.file-input::file-selector-button {
  background: var(--border-hi); color: var(--text); border: none;
  padding: 0.35rem 0.85rem; border-radius: var(--radius);
  margin-right: 0.8rem; cursor: pointer; font-family: inherit; font-size: 0.82rem;
}

/* ── Login Container ── */
.login-container {
  max-width: 400px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2rem;
}
.login-container .login-form .form-group { margin-bottom: 0.9rem; }

/* ── Search Row ── */
.search-row { display: flex; gap: 0.5rem; }
.search-row input { flex: 1; }
.search-row button { width: auto; padding: 0.6rem 1.4rem; }

/* ── Navbar (IDOR standalone) ── */
.navbar {
  background: var(--sidebar); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 1.5rem; color: #fff;
}
.navbar .nav-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1rem; }
.navbar .nav-brand .brand-dot {
  width: 10px; height: 10px; background: var(--accent);
  border-radius: 50%; display: inline-block;
}
.navbar .nav-links { display: flex; gap: 1rem; align-items: center; }
.navbar .nav-link { color: var(--text-dim); font-size: 0.85rem; }
.navbar .nav-link:hover { color: var(--accent); }
.navbar .nav-user { display: flex; align-items: center; gap: 0.7rem; font-size: 0.85rem; color: var(--text-dim); }

/* ── Responsive ── */
@media (max-width: 860px) {
  .card-grid { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sidebar { width: 100%; position: relative; height: auto; flex-direction: row; }
  .sidebar-brand, .sidebar-nav, .sidebar-footer { display: none; }
  .app { flex-direction: column; }
  .main-content { margin-left: 0; padding: 1.2rem; }
  .card { padding: 1.2rem; }
}
