/* ── Phosphor Icons ─────────────────────────────────────────────── */
@import url('https://unpkg.com/@phosphor-icons/web@2.1.1/src/regular/style.css');
@import url('https://unpkg.com/@phosphor-icons/web@2.1.1/src/bold/style.css');
@import url('https://unpkg.com/@phosphor-icons/web@2.1.1/src/fill/style.css');

/* ── CyberLearn Design System — Cyberpunk Edition ──────────────── */
:root {
  --bg-base:      #050505;
  --bg-surface:   #0d0d0d;
  --bg-elevated:  #141414;
  --bg-hover:     #1a1a1a;
  --border:       rgba(0,245,255,0.12);
  --border-focus: #00f5ff;

  --text-primary:   #e0fbff;
  --text-secondary: #8ba4ad;
  --text-muted:     #4a6370;

  --accent:       #00f5ff;
  --accent-hover: #00c8d4;
  --accent-glow:  rgba(0,245,255,0.25);

  --success:  #39ff14;
  --warning:  #ffb700;
  --danger:   #ff003c;
  --info:     #00aaff;

  /* neon category colors */
  --cat-web:       #00f5ff;
  --cat-crypto:    #bf5fff;
  --cat-forensics: #ffb700;
  --cat-pwn:       #ff003c;
  --cat-reversing: #39ff14;
  --cat-misc:      #4a6370;

  --diff-easy:   #39ff14;
  --diff-medium: #ffb700;
  --diff-hard:   #ff003c;

  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans: 'Inter', system-ui, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.6);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 20px rgba(0,245,255,0.3), 0 0 40px rgba(0,245,255,0.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* scanline overlay — subtle CRT feel */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 2px,
    rgba(0,0,0,0.04) 2px, rgba(0,0,0,0.04) 4px
  );
}

/* ── Typography ─────────────────────────────────────────────────���─ */
h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

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

code, pre {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
code { padding: 0.1em 0.4em; color: var(--accent); }
pre  { padding: 1rem; overflow-x: auto; border-left: 2px solid var(--accent); }

/* ── Layout ─────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.page-content { padding: 2rem 0; }

.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.main-content { flex: 1; min-width: 0; padding: 2rem; }

/* ── Navbar ─────────────────────────────────────────────────────── */
.navbar {
  background: rgba(5,5,5,0.9);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
}
.navbar-brand {
  font-family: var(--font-mono);
  font-size: 1.1rem; font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(0,245,255,0.5);
}
.navbar-brand span { color: var(--text-primary); }
.navbar-links { display: flex; gap: 1.5rem; align-items: center; }
.navbar-links a { color: var(--text-secondary); font-size: 0.9rem; transition: color 0.15s; }
.navbar-links a:hover,
.navbar-links a.active { color: var(--accent); text-shadow: 0 0 8px rgba(0,245,255,0.4); }

/* ── Sidebar nav ────────────────────────────────────────────────── */
.sidebar-logo {
  padding: 1.25rem 1.5rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(0,245,255,0.4);
}
.sidebar-nav { padding: 0.75rem 0; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  color: var(--text-primary);
  background: rgba(0,245,255,0.04);
}
.sidebar-nav a.active {
  color: var(--accent);
  background: rgba(0,245,255,0.06);
  border-left-color: var(--accent);
  text-shadow: 0 0 8px rgba(0,245,255,0.3);
}
.sidebar-nav .nav-icon,
.sidebar-nav i[class*="ph"] {
  font-size: 1.1rem;
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}
/* general icon sizing utilities */
.icon-sm  { font-size: 0.9rem;  line-height: 1; }
.icon-md  { font-size: 1.1rem;  line-height: 1; }
.icon-lg  { font-size: 1.35rem; line-height: 1; }
.icon-xl  { font-size: 1.75rem; line-height: 1; }
i[class*="ph"] { vertical-align: middle; }
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover {
  border-color: rgba(0,245,255,0.3);
  box-shadow: 0 0 20px rgba(0,245,255,0.06);
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.card-title { font-size: 1rem; font-weight: 600; }

/* ── Stats cards ────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--accent);
  padding: 1.25rem;
  text-align: center;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.stat-card:hover {
  box-shadow: 0 0 20px rgba(0,245,255,0.1), inset 0 0 20px rgba(0,245,255,0.02);
  border-color: rgba(0,245,255,0.3);
}
.stat-value {
  font-size: 2rem; font-weight: 700;
  color: var(--accent); font-family: var(--font-mono);
  text-shadow: 0 0 12px rgba(0,245,255,0.4);
}
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.25rem; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn-primary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: inset 0 0 0 0 var(--accent);
  transition: all 0.2s;
}
.btn-primary:hover {
  background: var(--accent);
  color: #000;
  box-shadow: var(--shadow-glow);
  text-shadow: none;
}
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 10px rgba(0,245,255,0.1);
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 0 15px rgba(255,0,60,0.3);
}
.btn-success {
  background: transparent;
  color: var(--success);
  border: 1px solid var(--success);
}
.btn-success:hover {
  background: var(--success);
  color: #000;
  box-shadow: 0 0 15px rgba(57,255,20,0.3);
}
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block; margin-bottom: 0.4rem;
  font-size: 0.85rem; color: var(--text-secondary); font-weight: 500;
  font-family: var(--font-mono); letter-spacing: 0.03em;
}
.form-control {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.875rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,245,255,0.2), 0 0 15px rgba(0,245,255,0.08);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { cursor: pointer; }

/* ── Badges / Tags ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2em 0.65em;
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-active {
  background: rgba(57,255,20,0.1);
  color: var(--success);
  border: 1px solid rgba(57,255,20,0.3);
  box-shadow: 0 0 8px rgba(57,255,20,0.15);
  animation: pulse-glow-green 2s ease-in-out infinite;
}
@keyframes pulse-glow-green {
  0%,100% { box-shadow: 0 0 4px rgba(57,255,20,0.15); }
  50%      { box-shadow: 0 0 12px rgba(57,255,20,0.35); }
}
.badge-upcoming { background: rgba(0,170,255,0.1); color: var(--info);    border: 1px solid rgba(0,170,255,0.3); }
.badge-ended    { background: rgba(74,99,112,0.1);  color: var(--text-muted); border: 1px solid var(--border); }
.badge-draft    { background: rgba(255,183,0,0.1);  color: var(--warning); border: 1px solid rgba(255,183,0,0.3); }

.cat-badge {
  display: inline-flex; align-items: center;
  padding: 0.2em 0.65em;
  border-radius: var(--radius-sm);
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.cat-web       { background: rgba(0,245,255,0.1);  color: var(--cat-web);       border: 1px solid rgba(0,245,255,0.2); }
.cat-crypto    { background: rgba(191,95,255,0.1); color: var(--cat-crypto);    border: 1px solid rgba(191,95,255,0.2); }
.cat-forensics { background: rgba(255,183,0,0.1);  color: var(--cat-forensics); border: 1px solid rgba(255,183,0,0.2); }
.cat-pwn       { background: rgba(255,0,60,0.1);   color: var(--cat-pwn);       border: 1px solid rgba(255,0,60,0.2); }
.cat-reversing { background: rgba(57,255,20,0.1);  color: var(--cat-reversing); border: 1px solid rgba(57,255,20,0.2); }
.cat-misc      { background: rgba(74,99,112,0.1);  color: var(--cat-misc);      border: 1px solid rgba(74,99,112,0.2); }

.diff-stars { color: var(--text-muted); font-size: 0.8rem; }
.diff-easy   .diff-star { color: var(--diff-easy); }
.diff-medium .diff-star { color: var(--diff-medium); }
.diff-hard   .diff-star { color: var(--diff-hard); }

/* ── Tables ─────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  background: var(--bg-elevated);
  color: var(--accent);
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.75rem 1rem; text-align: left;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
}
tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:hover { background: rgba(0,245,255,0.03); }
tbody tr:last-child td { border-bottom: none; }

/* ── Modals ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-surface);
  border: 1px solid rgba(0,245,255,0.2);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(16px); transition: transform 0.2s;
  box-shadow: 0 0 40px rgba(0,245,255,0.08);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem;
}
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.25rem; cursor: pointer; }
.modal-close:hover { color: var(--accent); }
.modal-footer { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ── Alerts ─────────────────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border: 1px solid;
  border-left-width: 3px;
  margin-bottom: 1rem;
}
.alert-success { background: rgba(57,255,20,0.05);  border-color: rgba(57,255,20,0.3);  color: var(--success); }
.alert-error   { background: rgba(255,0,60,0.05);   border-color: rgba(255,0,60,0.3);   color: var(--danger); }
.alert-info    { background: rgba(0,170,255,0.05);  border-color: rgba(0,170,255,0.3);  color: var(--info); }
.alert-warning { background: rgba(255,183,0,0.05);  border-color: rgba(255,183,0,0.3);  color: var(--warning); }

/* ── Toast notifications ────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.2s ease;
  max-width: 340px;
}
.toast.success { border-left: 3px solid var(--success); box-shadow: 0 0 15px rgba(57,255,20,0.1); }
.toast.error   { border-left: 3px solid var(--danger);  box-shadow: 0 0 15px rgba(255,0,60,0.1); }
.toast.info    { border-left: 3px solid var(--accent);  box-shadow: 0 0 15px rgba(0,245,255,0.1); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Tabs ───────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
  padding: 0.65rem 1.25rem;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-shadow: 0 0 8px rgba(0,245,255,0.3);
}

/* ── Loading / Skeleton ─────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  box-shadow: 0 0 8px rgba(0,245,255,0.2);
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,5,5,0.8);
  z-index: 50;
}

/* skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg, #141414 25%, #1c1c1c 50%, #141414 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.6s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-wave {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-row { height: 44px; margin-bottom: 2px; border-radius: 0; }
.skeleton-card { height: 120px; border-radius: var(--radius-lg); margin-bottom: 1rem; }

/* ── Neon glow utilities ────────────────────────────────────────── */
.glow-cyan  { text-shadow: 0 0 8px #00f5ff, 0 0 20px rgba(0,245,255,0.4); color: var(--accent); }
.glow-green { text-shadow: 0 0 8px #39ff14, 0 0 20px rgba(57,255,20,0.4); color: var(--success); }
.glow-red   { text-shadow: 0 0 8px #ff003c, 0 0 20px rgba(255,0,60,0.4);  color: var(--danger); }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.6; }
.empty-state p { font-size: 0.9rem; }

/* ── Utilities ──────────────────────────────────────────────────── */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1  { gap: 0.5rem; }
.gap-2  { gap: 1rem; }
.gap-3  { gap: 1.5rem; }
.mt-1   { margin-top: 0.5rem; }
.mt-2   { margin-top: 1rem; }
.mt-3   { margin-top: 1.5rem; }
.mb-1   { margin-bottom: 0.5rem; }
.mb-2   { margin-bottom: 1rem; }
.mb-3   { margin-bottom: 1.5rem; }
.text-sm      { font-size: 0.8rem; }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-accent  { color: var(--accent); }
.font-mono    { font-family: var(--font-mono); }
.w-full       { width: 100%; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ── Custom scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,245,255,0.2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,245,255,0.5); }
