/* ZIT Platform - Professional Design System */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --navy-950: #050c18;
  --navy-900: #0a1628;
  --navy-800: #0f2040;
  --navy-700: #162b55;
  --navy-600: #1e3a6e;
  --navy-500: #2551a3;
  --navy-400: #3b6fd4;
  --navy-300: #6b9fe8;
  --navy-200: #a8c8f5;
  --navy-100: #ddeaff;
  --navy-50:  #f0f5ff;

  --accent:   #4f7ef8;
  --accent-h: #3b6de0;
  --green:    #22c55e;
  --amber:    #f59e0b;
  --red:      #ef4444;
  --purple:   #8b5cf6;

  --surface:  #ffffff;
  --surface-2:#f8fafc;
  --surface-3:#f1f5f9;
  --border:   #e2e8f0;
  --border-2: #cbd5e1;
  --text-1:   #0f172a;
  --text-2:   #475569;
  --text-3:   #94a3b8;

  --sidebar-w: 256px;
  --topbar-h:  56px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --transition: 160ms cubic-bezier(.4,0,.2,1);
}

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

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--surface-2);
  color: var(--text-1);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

/* ── TOPBAR ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--navy-900);
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: .95rem; color: #fff;
  text-decoration: none;
}
.brand-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff; flex-shrink: 0;
}
.topbar-subtitle { font-size: .75rem; color: rgba(255,255,255,.4); font-weight: 400; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: none; background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.7); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: var(--transition); position: relative;
  text-decoration: none;
}
.topbar-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--navy-900);
}
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.07); cursor: pointer;
  color: rgba(255,255,255,.85); text-decoration: none;
  font-size: .825rem; font-weight: 500; transition: var(--transition);
}
.topbar-user:hover { background: rgba(255,255,255,.14); color: #fff; }
.avatar-sm {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.topbar-mobile-toggle {
  display: none; background: none; border: none;
  color: rgba(255,255,255,.7); cursor: pointer; font-size: 20px;
  padding: 4px; border-radius: var(--radius-sm);
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--navy-900);
  border-right: 1px solid rgba(255,255,255,.06);
  overflow-y: auto; z-index: 90;
  display: flex; flex-direction: column;
  transition: transform var(--transition);
}
.sidebar-inner { padding: 16px 12px 24px; flex: 1; }

/* Intern badge in sidebar */
.sidebar-badge {
  background: linear-gradient(135deg, rgba(79,126,248,.25), rgba(124,58,237,.25));
  border: 1px solid rgba(79,126,248,.3);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 20px;
}
.sidebar-badge-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.4); font-weight: 600; }
.sidebar-badge-id { font-family: 'DM Mono', monospace; font-size: .875rem; color: #fff; font-weight: 500; margin-top: 2px; }
.sidebar-badge-sub { font-size: .7rem; color: rgba(255,255,255,.35); margin-top: 2px; }

.sidebar-section-label {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255,255,255,.3); font-weight: 600;
  padding: 0 8px; margin: 20px 0 6px;
}
.sidebar-section-label:first-child { margin-top: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.55); font-size: .85rem; font-weight: 500;
  text-decoration: none; cursor: pointer; border: none; background: none;
  width: 100%; transition: var(--transition);
  position: relative;
}
.nav-item:hover { color: rgba(255,255,255,.9); background: rgba(255,255,255,.07); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(79,126,248,.25), rgba(79,126,248,.1));
  border-left: 3px solid var(--accent);
  padding-left: 7px;
}
.nav-item i { font-size: 16px; width: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--red);
  color: #fff; font-size: .65rem; font-weight: 700;
  padding: 1px 6px; border-radius: 99px; min-width: 18px; text-align: center;
}

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 89;
}

/* ── MAIN LAYOUT ── */
.page-wrapper {
  margin-top: var(--topbar-h);
  margin-left: var(--sidebar-w);
  min-height: calc(100vh - var(--topbar-h));
  padding: 24px;
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-title { font-size: 1.375rem; font-weight: 700; color: var(--text-1); line-height: 1.3; }
.page-subtitle { font-size: .825rem; color: var(--text-3); margin-top: 3px; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: .9rem; font-weight: 600; color: var(--text-1);
}
.card-title-icon {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.card-body { padding: 20px; }
.card-link { font-size: .78rem; color: var(--accent); font-weight: 500; text-decoration: none; }
.card-link:hover { text-decoration: underline; }

/* ── STAT CARDS ── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  text-decoration: none; display: block;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.stat-icon {
  width: 40px; height: 40px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.stat-number { font-size: 1.75rem; font-weight: 700; color: var(--text-1); line-height: 1; }
.stat-label { font-size: .78rem; color: var(--text-3); margin-top: 4px; }
.stat-trend { display: flex; align-items: center; gap: 4px; font-size: .75rem; margin-top: 8px; }

/* Colored icon variants */
.icon-blue   { background: #eff6ff; color: #3b82f6; }
.icon-green  { background: #f0fdf4; color: #22c55e; }
.icon-amber  { background: #fffbeb; color: #f59e0b; }
.icon-purple { background: #f5f3ff; color: #8b5cf6; }
.icon-red    { background: #fef2f2; color: #ef4444; }
.icon-indigo { background: #eef2ff; color: #6366f1; }
.icon-teal   { background: #f0fdfa; color: #14b8a6; }

/* ── TABLES ── */
.table-wrapper { overflow-x: auto; }
.zit-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.zit-table thead th {
  background: var(--surface-2); padding: 10px 16px;
  text-align: left; font-size: .72rem; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .07em;
  white-space: nowrap; border-bottom: 1px solid var(--border);
}
.zit-table tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
.zit-table tbody tr:last-child { border-bottom: none; }
.zit-table tbody tr:hover { background: var(--surface-2); }
.zit-table tbody td { padding: 12px 16px; vertical-align: middle; }

/* ── BADGES/PILLS ── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px; font-size: .72rem; font-weight: 600;
}
.pill-blue   { background: #eff6ff; color: #1d4ed8; }
.pill-green  { background: #f0fdf4; color: #15803d; }
.pill-amber  { background: #fffbeb; color: #b45309; }
.pill-red    { background: #fef2f2; color: #b91c1c; }
.pill-purple { background: #f5f3ff; color: #6d28d9; }
.pill-gray   { background: var(--surface-3); color: var(--text-2); }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: .85rem; font-weight: 600; cursor: pointer;
  border: none; transition: var(--transition); text-decoration: none;
  white-space: nowrap; font-family: inherit;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--navy-700); color: #fff; }
.btn-primary:hover { background: var(--navy-600); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-h); }
.btn-ghost { background: var(--surface); color: var(--text-1); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.btn-success:hover { background: #dcfce7; }
.btn-sm { padding: 6px 12px; font-size: .78rem; border-radius: var(--radius-sm); }
.btn-xs { padding: 4px 9px; font-size: .72rem; border-radius: var(--radius-sm); }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); min-width: 34px; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--text-1); margin-bottom: 6px;
}
.form-label span { color: var(--red); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: .875rem; color: var(--text-1); font-family: inherit;
  background: var(--surface); transition: var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,126,248,.12);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-3); }
.form-hint { font-size: .75rem; color: var(--text-3); margin-top: 5px; }
.form-mono { font-family: 'DM Mono', monospace; font-size: .825rem; }

/* ── ALERTS ── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: .85rem; margin-bottom: 16px;
}
.alert i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #b45309; }
.alert-info    { background: var(--navy-50); border: 1px solid var(--navy-200); color: var(--navy-700); }

/* ── INTERN AVATAR ── */
.intern-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-400), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0;
}
.intern-avatar-lg {
  width: 56px; height: 56px; font-size: 20px;
  border-radius: 50%; background: linear-gradient(135deg, var(--navy-400), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
}

/* ── PROFILE CARD ── */
.profile-hero {
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-600) 100%);
  border-radius: var(--radius-lg); padding: 28px 24px;
  color: #fff; position: relative; overflow: hidden;
}
.profile-hero::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255,255,255,.05);
}

/* ── PROGRESS ── */
.progress-bar-wrap { background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  transition: width 1s ease;
}

/* ── EDITOR ── */
.editor-shell {
  background: #0d1117; border-radius: var(--radius-lg);
  overflow: hidden; border: 1px solid #30363d;
}
.editor-topbar {
  background: #161b22; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #30363d;
}
.editor-tabs { display: flex; gap: 2px; }
.editor-tab {
  padding: 5px 14px; border-radius: var(--radius-sm); font-size: .78rem;
  font-weight: 600; cursor: pointer; color: rgba(255,255,255,.45);
  border: none; background: none; transition: var(--transition);
}
.editor-tab.active { background: #1f2937; color: #fff; }
.editor-tab.html.active  { color: #fb923c; }
.editor-tab.css.active   { color: #60a5fa; }
.editor-tab.js.active    { color: #facc15; }
.editor-actions { display: flex; gap: 6px; }
.editor-btn {
  padding: 5px 13px; border-radius: var(--radius-sm); border: none;
  font-size: .78rem; font-weight: 600; cursor: pointer; transition: var(--transition);
  display: inline-flex; align-items: center; gap: 5px;
}
.editor-btn-run   { background: #22c55e; color: #fff; }
.editor-btn-run:hover { background: #16a34a; }
.editor-btn-reset { background: #374151; color: rgba(255,255,255,.7); }
.editor-btn-reset:hover { background: #4b5563; }
.editor-btn-save  { background: #3b5fdb; color: #fff; }
.editor-btn-save:hover { background: #2d4ec8; }
.editor-pane textarea {
  width: 100%; background: #0d1117; color: #e6edf3;
  border: none; outline: none; padding: 16px;
  font-family: 'DM Mono', 'Fira Code', monospace;
  font-size: .825rem; line-height: 1.7; resize: vertical;
  tab-size: 2; min-height: 160px;
}
.editor-output { background: #fff; }
.editor-output-bar {
  background: #161b22; border-top: 1px solid #30363d;
  padding: 7px 16px; display: flex; align-items: center; justify-content: space-between;
}
.editor-output-bar span { font-size: .72rem; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .08em; }

/* ── CHAT ── */
.chat-bubble-me {
  background: var(--navy-700); color: #fff;
  border-radius: 14px 14px 4px 14px; padding: 10px 14px;
  max-width: 68%; font-size: .875rem; line-height: 1.5;
}
.chat-bubble-them {
  background: var(--surface); color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px; padding: 10px 14px;
  max-width: 68%; font-size: .875rem; line-height: 1.5;
  box-shadow: var(--shadow-sm);
}
.chat-meta { font-size: .72rem; color: var(--text-3); margin-top: 4px; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-800) 50%, var(--navy-700) 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  position: relative; overflow: hidden;
}
.login-bg-orb {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: .12;
  pointer-events: none;
}
.login-card {
  background: rgba(255,255,255,.97);
  border-radius: var(--radius-xl); padding: 36px;
  width: 100%; max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.2);
  position: relative;
}

/* ── CERTIFICATE ── */
.cert-paper {
  background: #fff;
  border: 2px solid var(--navy-200);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.cert-paper::before {
  content: ''; position: absolute; inset: 8px;
  border: 1px solid var(--navy-100); border-radius: 12px; pointer-events: none;
}
.cert-watermark {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 12rem; font-weight: 800; color: var(--navy-50);
  opacity: .5; pointer-events: none; user-select: none; z-index: 0;
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  .page-wrapper { margin-left: 0; padding: 16px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .topbar-mobile-toggle { display: flex; }
  .hide-mobile { display: none !important; }
}

/* ── UTILITY ── */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-mono { font-family: 'DM Mono', monospace; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media(max-width:900px){.grid-4{grid-template-columns:repeat(2,1fr);}}
@media(max-width:600px){.grid-4,.grid-3,.grid-2{grid-template-columns:1fr;}}
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; gap: 10px; }
.mt-1 { margin-top: 4px; }  .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.text-sm  { font-size: .825rem; }
.text-xs  { font-size: .75rem; }
.text-muted { color: var(--text-3); }
.text-secondary { color: var(--text-2); }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.w-full { width: 100%; }
