/* ===== Quản lý CV tuyển dụng — giao diện hiện đại ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-darker: #1e40af;
  --primary-light: #eff6ff;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .14);
}

* { box-sizing: border-box; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  padding: 0 24px;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -.01em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-darker));
  color: #fff;
  font-weight: 800;
  font-size: .8rem;
  box-shadow: 0 2px 6px rgba(37, 99, 235, .35);
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.navlink {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: .92rem;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background .15s, color .15s;
}

.navlink:hover { background: var(--primary-light); color: var(--primary-dark); }
.navlink.active { background: var(--primary); color: #fff; }

.userchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
  padding: 5px 6px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-darker));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.who { font-size: .85rem; color: var(--text); font-weight: 600; }
.who small { color: var(--muted); font-weight: 500; }

.linklike {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
}
.linklike:hover { background: var(--danger-bg); }

/* ---------- Layout ---------- */
.container { max-width: 1120px; margin: 28px auto 60px; padding: 0 20px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-head h2 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }

.count-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: .8rem;
  padding: 2px 10px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 8px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}

.narrow { max-width: 480px; }

.section-title {
  margin: 30px 0 6px;
  font-size: 1.1rem;
  letter-spacing: -.01em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
}

/* ---------- Typography helpers ---------- */
h2 { margin-top: 0; letter-spacing: -.02em; }
h3 { margin-top: 28px; letter-spacing: -.01em; }
.muted, small.muted { color: var(--muted); }
.error { color: var(--danger); font-weight: 600; }
.ok { color: var(--success); font-weight: 600; }
.warn { color: var(--warning); }
code {
  background: var(--primary-light);
  color: var(--primary-darker);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: .88em;
  word-break: break-all;
}

/* ---------- Alerts ---------- */
.alert {
  border-radius: 10px;
  padding: 12px 16px;
  margin: 14px 0;
  font-size: .93rem;
  border: 1px solid transparent;
}
.alert-warn { background: var(--warning-bg); border-color: #fde68a; color: #92400e; }
.alert-error { background: var(--danger-bg); border-color: #fecaca; color: #991b1b; }
.alert-ok { background: var(--success-bg); border-color: #bbf7d0; color: #166534; }
.alert a { color: inherit; font-weight: 700; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-ok { background: #dcfce7; color: #166534; }
.badge-err { background: #fee2e2; color: #991b1b; }
.badge-muted { background: #f1f5f9; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  transition: transform .05s, box-shadow .15s, background .15s;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
.btn:hover { box-shadow: 0 3px 8px rgba(15, 23, 42, .1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.primary:disabled { background: var(--primary); }

.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #b91c1c; }

.btn.small { padding: 6px 12px; font-size: .83rem; border-radius: 7px; }

/* ---------- Forms ---------- */
label { display: block; margin: 12px 0; font-weight: 600; font-size: .93rem; }
label small { font-weight: 400; }

input[type=text], input[type=password], select, textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: .95rem;
  font-family: inherit;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus, input[type=password]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 16px;
}

fieldset.cols {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px 14px;
  margin: 16px 0;
  background: #f8fafc;
}
fieldset.cols legend { font-weight: 700; padding: 0 8px; font-size: .93rem; }
.cols-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0 14px;
}
input.colinput { max-width: 90px; text-align: center; text-transform: uppercase; font-weight: 700; }

label.checkline {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 600;
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
label.checkline input[type=checkbox] { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--primary); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--card); margin: 14px 0; }
.tbl { width: 100%; border-collapse: collapse; background: var(--card); min-width: 760px; }
.tbl th, .tbl td { padding: 12px 14px; text-align: left; vertical-align: middle; }
.tbl th {
  background: #f8fafc;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.tbl td { border-bottom: 1px solid var(--border); font-size: .93rem; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl input[type=text] { width: 100%; min-width: 130px; padding: 8px 10px; margin-top: 0; }
.tbl a.rowlink { color: var(--primary-dark); font-weight: 600; text-decoration: none; }
.tbl a.rowlink:hover { text-decoration: underline; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline-block; margin-left: 6px; }
td.actions .btn, td.actions a.btn { margin-left: 6px; }

.empty-state { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-state .big { font-size: 2.2rem; margin-bottom: 8px; }

/* ---------- Search ---------- */
.searchbar { display: flex; gap: 8px; margin: 16px 0; }
.searchbar input { flex: 1; margin-top: 0; }
.searchbar .btn { white-space: nowrap; }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2.5px dashed #c7d7f8;
  border-radius: 16px;
  padding: 52px 24px;
  text-align: center;
  background: linear-gradient(180deg, #fbfdff, #f4f8ff);
  margin: 16px 0;
  transition: border-color .15s, background .15s, transform .15s;
  cursor: pointer;
}
.dropzone:hover { border-color: var(--primary); }
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.01);
}
.dropzone .dz-icon { font-size: 3rem; margin-bottom: 6px; }
.dropzone .dz-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 4px; }
.dropzone .dz-sub { color: var(--muted); font-size: .9rem; margin: 0 0 14px; }

.filelist { list-style: none; padding: 0; text-align: left; max-width: 640px; margin: 16px auto 0; }
.filelist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .9rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.filelist .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.filelist .fsize { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.filelist .frm {
  border: none; background: var(--danger-bg); color: var(--danger);
  border-radius: 7px; padding: 4px 10px; cursor: pointer; font-weight: 700; font-size: .8rem;
}
.filelist .frm:hover { background: #fee2e2; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; margin: 18px 0; flex-wrap: wrap; align-items: center; justify-content: center; }
.btn.small.current { background: var(--primary); border-color: var(--primary); color: #fff; cursor: default; box-shadow: none; }
.page-info { text-align: center; color: var(--muted); font-size: .88rem; }

/* ---------- Login page ---------- */
body.login-page {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.login-page .topbar { background: rgba(255, 255, 255, .96); }
body.login-page .container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px;
}
.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 36px 34px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-card .brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-card .brand-row .brand-mark { width: 44px; height: 44px; font-size: 1rem; border-radius: 12px; }
.login-card h2 { margin: 0 0 4px; font-size: 1.4rem; }
.login-card .sub { color: var(--muted); font-size: .9rem; margin: 0 0 8px; }
.login-card .btn.primary { width: 100%; margin-top: 8px; padding: 12px; font-size: 1rem; }

/* ---------- Users page ---------- */
.role-pill { font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.role-admin { background: #ede9fe; color: #5b21b6; }
.role-member { background: #e0f2fe; color: #075985; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .topbar { padding: 0 14px; }
  .topbar nav { width: 100%; padding: 0 0 10px; }
  .container { margin-top: 18px; padding: 0 14px; }
  .card { padding: 16px; }
  .searchbar { flex-direction: column; }
  .searchbar .btn { width: 100%; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn { width: 100%; }
  .dropzone { padding: 36px 16px; }
  td.actions { text-align: left; }
}
