/* ── PDPTool Desktop-Exact Styles ─────────────────────────── */

:root {
  --bg: #ffffff;
  --bg-sidebar: #f3f3f3;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #e8e8e8;
  --bg-active: #d6ebff;
  --bg-code: #fafafa;
  --bg-badge: #e4e4e4;
  --bg-alt-row: #faf6ef;
  --bg-ai-bubble: #f0f6ff;
  --bg-user-bubble: #fff8ec;
  --bg-warn: #fff7e8;
  --fg: #1f1f1f;
  --fg-muted: #616161;
  --fg-faint: #9e9e9e;
  --fg-accent: #005fb8;
  --border: #e0e0e0;
  --border-input: #d9cfc1;
  --border-focus: #007acc;
  --border-warn: #ead7ad;
  --accent: #007acc;
  --accent-hover: #0062a3;
  --green: #388a34;
  --orange: #d18616;
  --purple: #8250df;
  --gold: #b08800;
  --red: #cd3131;
  --radius: 6px;
  --sidebar-width: 220px;
}

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

body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  min-height: 100vh;
}

/* ════════════════════════════════════════════════════════════
   SIDEBAR — exact match with desktop NavButton style
   ════════════════════════════════════════════════════════════ */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}

.sidebar .logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  padding: 8px 8px 16px 8px;
}

.sidebar .user-info {
  padding: 8px 12px 16px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sidebar .user-info .user-name {
  font-size: 14px; font-weight: 600; color: var(--fg);
}
.sidebar .user-info .user-no {
  font-size: 12px; color: var(--fg-muted); margin-top: 2px;
}

.sidebar nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar nav a {
  display: block;
  padding: 10px 16px;
  color: #616161;
  text-decoration: none;
  font-size: 14px;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}

.sidebar nav a:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

.sidebar nav a.active {
  background: var(--bg-active);
  color: var(--fg);
  font-weight: 700;
}

.sidebar .sidebar-footer {
  padding: 8px 12px 4px 12px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.sidebar .logout-btn {
  display: block;
  padding: 8px 16px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 13px;
  border-radius: 6px;
}
.sidebar .logout-btn:hover {
  background: var(--bg-hover);
  color: var(--red);
}

.sidebar .version {
  padding: 8px 8px 4px 8px;
  font-size: 11px;
  color: var(--fg-faint);
  text-align: center;
}

/* ════════════════════════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════════════════════════ */

.main {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--bg);
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 12px;
}

.welcome-text {
  font-size: 16px;
  color: var(--fg-muted);
  margin-bottom: 20px;
}

/* ════════════════════════════════════════════════════════════
   STAT CARDS — matches StatCard desktop widget
   ════════════════════════════════════════════════════════════ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  text-align: center;
  cursor: default;
  transition: box-shadow 0.15s;
}
.stat-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-card .stat-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--fg-muted);
  text-align: center;
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════════════ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 14px;
}

.card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}

.card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
}

/* ════════════════════════════════════════════════════════════
   CATEGORY CARDS — matches CategoryCard desktop widget
   ════════════════════════════════════════════════════════════ */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  cursor: pointer;
}
.category-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.category-card .cat-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.category-card .cat-sub {
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.progress-bar {
  height: 14px;
  background-color: #eee7dc;
  border-radius: 0;
  overflow: hidden;
  position: relative;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 0;
  transition: width 0.3s;
}

.progress-bar .progress-label {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--fg);
}

/* ════════════════════════════════════════════════════════════
   TABLES — matches RecordTable desktop style
   ════════════════════════════════════════════════════════════ */

.table-wrap {
  overflow-x: auto;
}

table.desktop {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

table.desktop thead th {
  background: var(--bg-sidebar);
  color: var(--fg);
  font-weight: 600;
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.desktop tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}

table.desktop tbody tr:nth-child(even) {
  background: var(--bg-alt-row);
}

table.desktop tbody tr:hover {
  background: #f8faff;
}

table.desktop tbody tr:last-child td {
  border-bottom: none;
}

/* ════════════════════════════════════════════════════════════
   BUTTONS — matches desktop button styles
   ════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--fg);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.12s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-hover);
}

.btn:disabled {
  color: var(--fg-faint);
  background: var(--bg-sidebar);
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-hover);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-primary:disabled {
  background: var(--bg-badge);
  border-color: var(--border);
  color: var(--fg-faint);
}

.btn-danger {
  color: var(--orange);
  border-color: var(--border);
}
.btn-danger:hover {
  color: var(--red);
  background: var(--bg-hover);
  border-color: var(--orange);
}

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
}

.btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ════════════════════════════════════════════════════════════
   FORM INPUTS
   ════════════════════════════════════════════════════════════ */

.desktop-input {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--fg);
  font-size: 13px;
  font-family: inherit;
}

.desktop-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.desktop-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--fg);
  font-size: 13px;
  font-family: inherit;
}

.desktop-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* ════════════════════════════════════════════════════════════
   TOOLBAR — matches desktop toolbar layout
   ════════════════════════════════════════════════════════════ */

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar .sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 4px;
}

/* ════════════════════════════════════════════════════════════
   EMPTY HINT
   ════════════════════════════════════════════════════════════ */

.empty-hint {
  color: var(--fg-muted);
  font-size: 14px;
  background: var(--bg-warn);
  border: 1px solid var(--border-warn);
  border-radius: 8px;
  padding: 32px 20px;
  margin: 20px 0;
  text-align: center;
}

/* ════════════════════════════════════════════════════════════
   SUMMARY CARD — matches Internship SummaryCard
   ════════════════════════════════════════════════════════════ */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
}

.summary-card .sc-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.summary-card .sc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-top: 2px;
}

.summary-card .sc-caption {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
}

/* ════════════════════════════════════════════════════════════
   GPA HERO
   ════════════════════════════════════════════════════════════ */

.gpa-hero {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
}

.gpa-stat {
  text-align: center;
  min-width: 100px;
}

.gpa-stat .gs-value {
  font-size: 28px;
  font-weight: 700;
}

.gpa-stat .gs-label {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
}

/* ════════════════════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════════════════════ */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: #dcfce7; color: #166534; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #fff7ed; color: #9a3412; }
.badge-red { background: #fef2f2; color: #991b1b; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }

/* ════════════════════════════════════════════════════════════
   INSIGHT BOX
   ════════════════════════════════════════════════════════════ */

.insight-box {
  font-size: 13px;
  color: var(--fg);
  background: var(--bg-ai-bubble);
  border: 1px solid var(--accent);
  padding: 14px;
  border-radius: 6px;
  margin-top: 12px;
  line-height: 1.7;
}

.insight-box.warn {
  background: var(--bg-warn);
  border-color: var(--border-warn);
}

/* ════════════════════════════════════════════════════════════
   CHAT — AI panel style
   ════════════════════════════════════════════════════════════ */

.chat-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  min-height: 400px;
  max-height: 600px;
  overflow-y: auto;
  padding: 12px;
  margin-bottom: 12px;
}

.chat-msg {
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  max-width: 85%;
  font-size: 13px;
  line-height: 1.7;
}

.chat-msg.ai {
  background: var(--bg-ai-bubble);
  margin-right: auto;
}

.chat-msg.user {
  background: var(--bg-user-bubble);
  margin-left: auto;
}

.chat-msg .sender {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 4px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

.chat-input-row textarea {
  flex: 1;
  min-height: 40px;
  max-height: 80px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}

.chat-input-row textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* ════════════════════════════════════════════════════════════
   AUTH PAGES
   ════════════════════════════════════════════════════════════ */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: #f5f5f5;
}

.auth-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.auth-box .auth-logo {
  font-size: 28px; font-weight: 700; text-align: center;
  margin-bottom: 8px; color: var(--fg);
}

.auth-box .auth-sub {
  text-align: center; color: var(--fg-muted);
  font-size: 14px; margin-bottom: 28px;
}

.auth-box .field {
  margin-bottom: 16px;
}

.auth-box .field label {
  display: block; font-size: 13px;
  color: var(--fg-muted); margin-bottom: 4px;
}

.auth-box .field input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 15px; outline: none;
  box-sizing: border-box;
}

.auth-box .field input:focus {
  border-color: var(--border-focus);
}

.auth-box .btn-primary {
  width: 100%; padding: 11px; font-size: 15px; margin-top: 8px;
}

.auth-box .error {
  background: var(--bg-warn); border: 1px solid var(--border-warn);
  border-radius: 6px; padding: 10px 14px; font-size: 13px;
  color: #9a3412; margin-bottom: 16px;
}

.auth-box .success {
  background: #dcfce7; border: 1px solid #bbf7d0;
  border-radius: 6px; padding: 10px 14px; font-size: 13px;
  color: #166534; margin-bottom: 16px;
}

.auth-box .footer {
  text-align: center; margin-top: 20px; font-size: 13px; color: var(--fg-muted);
}

.auth-box .footer a {
  color: var(--accent); text-decoration: none;
}

.auth-box .footer a:hover { text-decoration: underline; }

/* ════════════════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}

.modal-box {
  background: white; border-radius: 10px; max-width: 700px; width: 90%;
  max-height: 80vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.modal-box .modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}

.modal-box .modal-body { padding: 20px; font-size: 14px; line-height: 1.8; white-space: pre-wrap; }

/* ════════════════════════════════════════════════════════════
   TABS — matches QTabWidget desktop style
   ════════════════════════════════════════════════════════════ */

.tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.tab-btn {
  padding: 8px 18px; font-size: 13px; color: var(--fg-muted);
  background: transparent; border: none; cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: inherit;
}

.tab-btn:hover { color: var(--fg); }

.tab-btn.active {
  color: var(--fg); font-weight: 600;
  border-bottom-color: var(--accent);
}

/* ════════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════════ */

.text-muted { color: var(--fg-muted); }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.text-purple { color: var(--purple); }
.text-red { color: var(--red); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }

.summary-text {
  font-size: 13px; color: var(--fg-muted);
  padding: 4px; margin-top: 4px;
}
