/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-900: #0E8B32;
  --green-800: #16923C;
  --green-700: #1FA34A;
  --green-600: #2d7a52;
  --green-500: #38966a;
  --green-400: #4db882;
  --green-100: #EAF8EE;
  --green-50:  #f0faf4;

  --gold:   #F8AF34;
  --silver: #7a8fa6;
  --bronze: #a0663c;
  --kk:     #5c5c7a;

  --text:      #1a2a22;
  --text-muted:#5a7060;
  --border:    #d4e6da;
  --bg:        #f7faf8;
  --white:     #ffffff;

  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,60,30,0.09);
  --font: 'Segoe UI', 'Arial', sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--green-600); text-decoration: none; }
a:hover { color: var(--green-800); text-decoration: underline; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ===== Header ===== */
.site-header {
  background: var(--white);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  gap: 1rem;
}
.site-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-icon {
  width: 38px; height: 38px;
  background: var(--green-600);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.brand-name { font-size: 1rem; font-weight: 700; letter-spacing: 0.08em; color: var(--white); }
.brand-sub  { font-size: 0.7rem; color: rgba(255,255,255,0.6); letter-spacing: 0.05em; }
.site-nav { display: flex; align-items: center; gap: 0.25rem; }
.nav-link {
  color: #333;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  transition: all 0.15s;
  border: none; background: none; cursor: pointer; font-family: var(--font);
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.12); color: var(--green-800); text-decoration: none; }
.btn-logout { font-size: 0.88rem; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--green-800) 0%, var(--green-600) 100%);
  color: var(--white);
  padding: 3rem 0 2.5rem;
  text-align: center;
}
.hero-title { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 0.5rem; }
.hero-sub   { font-size: 1rem; opacity: 0.8; margin-bottom: 1.75rem; }
.search-form { max-width: 640px; margin: 0 auto; }
.search-box {
  display: flex;
  align-items: center;
  background: var(--white);
  border-radius: 50px;
  padding: 0.5rem 0.5rem 0.5rem 1.2rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}


.logo-container{    text-align:center;    padding:15px 0;}
.logo-container img{    width:100%;    max-width:300px;    height:auto;}
/* Tablet */@media (max-width:768px){    .logo-container img{        max-width:100px;    }}
/* Mobile */@media (max-width:576px){    .logo-container img{        max-width:200px;    }}
.search-icon { font-size: 1.1rem; color: var(--text-muted); flex-shrink: 0; margin-right: 0.5rem; }
.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
}
.search-btn {
  background: var(--green-700);
  color: var(--white);
  border: none;
  border-radius: 40px;
  padding: 0.5rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.search-btn:hover { background: var(--green-800); }

/* ===== Filter Bar (bên dưới search box trong hero) ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}
.filter-pill {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.35);
  color: var(--white);
  border-radius: 20px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.7)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 1.8rem;
}
.filter-pill option { color: var(--text); background: var(--white); }
.filter-pill:focus { border-color: rgba(255,255,255,0.7); }
.filter-clear {
  color: rgba(255,255,255,0.75);
  font-size: 0.83rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.filter-clear:hover { background: rgba(255,255,255,0.12); color: var(--white); text-decoration: none; }

/* ===== Welcome State (trước khi tìm) ===== */
.welcome-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}
.welcome-icon { font-size: 3.5rem; margin-bottom: 1rem; opacity: 0.5; }
.welcome-text { font-size: 1rem; }

/* ===== Results Container ===== */
.results-container {
  padding-top: 1.75rem;
  padding-bottom: 3rem;
}

/* ===== Main Layout (giữ để không lỗi nếu dùng ở nơi khác) ===== */
.main-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  padding-top: 1.75rem;
  padding-bottom: 3rem;
  align-items: start;
}
@media (max-width: 768px) {
  .main-layout { grid-template-columns: 1fr; }
}

/* ===== Sidebar ===== */
.sidebar {
  position: sticky;
  top: 70px;
}
.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--green-900);
  color: var(--white);
  padding: 0.7rem 1rem;
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 600;
  font-size: 0.9rem;
}
.clear-link { color: rgba(255,255,255,0.7); font-size: 0.8rem; font-weight: 400; }
.clear-link:hover { color: var(--white); text-decoration: none; }
.filter-group {
  background: var(--white);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1rem;
}
.filter-group:last-of-type { border-radius: 0 0 var(--radius) var(--radius); }
.filter-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.4rem; }
.filter-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  font-size: 0.88rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  cursor: pointer;
  outline: none;
}
.filter-select:focus { border-color: var(--green-500); }

/* Stats */
.stats-box {
  margin-top: 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.stats-title { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.06em; }
.stats-total { font-size: 1.6rem; font-weight: 800; color: var(--green-800); margin: 0.25rem 0 0.75rem; }
.stats-grid { display: flex; flex-direction: column; gap: 0.35rem; }
.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.85rem;
}
.stat-label { font-weight: 500; }
.stat-count { font-weight: 700; }

/* ===== Results Area ===== */
.results-area {}
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
  gap: 1rem;
}
.results-title { font-size: 1.1rem; font-weight: 700; color: var(--green-900); }
.results-count { font-size: 0.88rem; color: var(--text-muted); white-space: nowrap; }
.results-count strong { color: var(--green-700); }

/* ===== Table ===== */
.table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  overflow-x: auto;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.results-table thead th {
  background: var(--green-900);
  color: rgba(255,255,255,0.85);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.75rem 1rem;
  text-align: left;
  white-space: nowrap;
}
.results-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.results-table tbody tr:last-child { border-bottom: none; }
.results-table tbody tr:hover { background: var(--green-50); }
.results-table td { padding: 0.8rem 1rem; vertical-align: middle; }
.td-code { font-family: monospace; font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }
.td-name .name-link { font-weight: 600; color: var(--green-800); }
.td-name .name-link:hover { color: var(--green-600); text-decoration: none; }
.td-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.td-school { font-size: 0.88rem; }
.td-year { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }
.detail-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: var(--green-100);
  color: var(--green-700);
  border-radius: 50%;
  font-size: 1.2rem;
  transition: all 0.15s;
  text-decoration: none;
}
.detail-link:hover { background: var(--green-600); color: var(--white); text-decoration: none; }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-lg { font-size: 1rem; padding: 0.35rem 1rem; }
.badge-nhat, .stat-item.badge-nhat { background: #FFF7D6; color: #B7791F; }
.badge-nhi,  .stat-item.badge-nhi  { background: #EEF2F7; color: #475569; }
.badge-ba,   .stat-item.badge-ba   { background: #FDF0E7; color: #B45309; }
.badge-kk,   .stat-item.badge-kk   { background: #EAF8EE; color: #0E8B32; }
.badge-mm,   .stat-item.badge-mm   { background: #FDECEC; color: #B71C1C; }
/* ===== Pagination ===== */
.pagination { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 1.25rem; align-items: center; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 0.5rem;
  border-radius: 6px;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
}
.page-btn:hover { background: var(--green-100); border-color: var(--green-400); text-decoration: none; }
.page-btn.active { background: var(--green-700); border-color: var(--green-700); color: var(--white); }
.page-dots { color: var(--text-muted); padding: 0 0.25rem; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }

/* ===== Detail Card ===== */
.back-link { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text-muted); font-size: 0.88rem; margin-bottom: 1.5rem; }
.back-link:hover { color: var(--green-700); text-decoration: none; }
.detail-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.detail-header {
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
  color: var(--white);
  padding: 2rem 2rem 1.75rem;
}
.detail-badge-wrap { margin-bottom: 0.75rem; }
.detail-name { font-size: 2rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 0.5rem; }
.detail-meta { font-size: 0.88rem; opacity: 0.8; }
.detail-sections { padding: 1.5rem 2rem; display: grid; gap: 1.5rem; }
@media (min-width: 640px) { .detail-sections { grid-template-columns: 1fr 1fr; } }
.detail-section {}
.section-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--green-600); margin-bottom: 0.75rem; padding-bottom: 0.4rem; border-bottom: 2px solid var(--green-100); }
.detail-grid { display: grid; gap: 0.4rem; }
.detail-grid dt { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; margin-top: 0.3rem; }
.detail-grid dd { font-size: 0.92rem; }
.td-ituong { white-space: pre-line; line-height: 1.7; }

/* ===== Buttons ===== */
.btn-primary {
  display: inline-block;
  background: var(--green-700);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
  text-decoration: none;
}
.btn-primary:hover { background: var(--green-800); color: var(--white); text-decoration: none; }
.btn-primary.btn-block { width: 100%; text-align: center; }
.btn-outline {
  display: inline-block;
  border: 1px solid var(--green-600);
  color: var(--green-700);
  border-radius: var(--radius);
  padding: 0.5rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn-outline:hover { background: var(--green-50); text-decoration: none; }
.btn-danger-sm {
  background: #fee2e2; color: #991b1b; border: none;
  border-radius: 5px; padding: 0.25rem 0.6rem;
  font-size: 0.78rem; cursor: pointer; font-family: var(--font);
}
.btn-danger-sm:hover { background: #fca5a5; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.4rem; }
.form-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--green-500); }
.required { color: #dc2626; }

/* Drop Zone */
.drop-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg);
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--green-500); background: var(--green-50); }
.drop-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.drop-text { font-weight: 600; color: var(--text); }
.drop-sub  { font-size: 0.83rem; color: var(--text-muted); margin-top: 0.25rem; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-name-display { font-size: 0.83rem; color: var(--green-700); margin-top: 0.4rem; font-weight: 500; }
.hint-box {
  margin-top: 1.25rem;
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Alerts */
.alert {
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* ===== Admin ===== */
.admin-container { padding-top: 2rem; padding-bottom: 3rem; max-width: 960px; }
.admin-title { font-size: 1.5rem; font-weight: 800; color: var(--green-900); margin-bottom: 1.5rem; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 700px) { .admin-grid { grid-template-columns: 1fr; } }
.admin-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.card-title { font-size: 1.05rem; font-weight: 700; color: var(--green-900); margin-bottom: 0.5rem; }
.card-desc  { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 1.25rem; line-height: 1.6; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.admin-table th { text-align: left; padding: 0.5rem; background: var(--green-50); border-bottom: 1px solid var(--border); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; }
.admin-table td { padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); }
.admin-table tr:last-child td { border-bottom: none; }

/* Login */
.login-card { max-width: 380px; margin: 4rem auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; }
.login-title { font-size: 1.2rem; font-weight: 700; color: var(--green-900); margin-bottom: 1.25rem; text-align: center; }
.login-hint { font-size: 0.78rem; color: var(--text-muted); text-align: center; margin-top: 1rem; }
.login-hint code { background: var(--bg); padding: 0.1rem 0.4rem; border-radius: 4px; }

/* ===== Footer ===== */
.site-footer {
  background: var(--green-900);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 1.25rem;
  font-size: 0.82rem;
  margin-top: auto;
}

/* ===== Stats Section ===== */
.stats-section { margin-top: 2rem; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 700px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1rem; border-left: 4px solid transparent; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; margin-bottom: 0.4rem; }
.stat-card .stat-value { font-size: 2rem; font-weight: 900; line-height: 1; }

.stat-blue      { border-left-color: #60a5fa; } .stat-blue      .stat-value { color: #2563eb; }
.stat-blue-dark { border-left-color: #1d4ed8; } .stat-blue-dark .stat-value { color: #1d4ed8; }
.stat-green      { border-left-color: var(--green-400); } .stat-green      .stat-value { color: var(--green-600); }
.stat-green-dark { border-left-color: var(--green-700); } .stat-green-dark .stat-value { color: var(--green-700); }
