/* =====================================================================
   AAuJob Events – admin stylesheet
   Cùng bảng màu với site.css, nền xám nhạt, mật độ thông tin cao.
   ===================================================================== */
:root {
  --navy: #12335A;
  --navy-deep: #0B2240;
  --accent: #B62226;
  --accent-deep: #8E181C;
  --accent-soft: #F9E1E1;
  --paper: #F5F6F8;
  --ink: #1B2431;
  --muted: #66707C;
  --line: #E1E4EA;
  --line-strong: #C9CFD8;
  --white: #FFFFFF;
  --ok: #1F8A5B;
  --ok-soft: #DDF3E7;
  --danger: #B42318;
  --danger-soft: #FEE4E2;
  --radius: 6px;
  --radius-lg: 8px;
  --sidebar-w: 230px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--accent-deep); }
h1, h2, h3 { margin: 0 0 .5em; font-weight: 800; line-height: 1.25; color: var(--navy-deep); overflow-wrap: anywhere; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }

/* ---------- Layout ---------- */
.admin { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.admin > * { min-width: 0; }
.sidebar { background: var(--navy-deep); color: var(--white); padding: 1.25rem 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: .5rem; padding: 0 1.25rem 1.25rem; }
.sidebar .brand img { height: 22px; width: auto; background: var(--white); border-radius: 4px; padding: 3px 6px; }
.sidebar .brand em { font-style: normal; color: var(--accent); font-weight: 500; font-size: .8em; }
.sidebar nav a { display: block; padding: .6rem 1.25rem; color: rgba(255, 255, 255, .75); font-weight: 500; border-left: 3px solid transparent; transition: background .15s, color .15s, border-color .15s; }
.sidebar nav a:hover, .sidebar nav a.is-active { color: var(--white); background: rgba(255, 255, 255, .06); border-left-color: var(--accent); }
.sidebar .sep { margin: .75rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .12); }
.main { padding: 1.5rem 2rem 3rem; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.topbar h1 { margin: 0; }
.topbar > div { display: flex; align-items: center; gap: .5rem; }
.topbar form { display: inline; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem 1rem; border-radius: var(--radius); font-weight: 600; font-size: .875rem; line-height: 1.2; white-space: nowrap; border: 1px solid transparent; cursor: pointer; background: var(--navy); color: var(--white); transition: background .15s, color .15s, border-color .15s; }
.btn:hover { background: var(--navy-deep); color: var(--white); }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-ghost { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: var(--white); color: var(--navy); border-color: var(--navy); }
.btn-danger { background: var(--white); color: var(--danger); border-color: #FDA29B; }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-xs { padding: .25rem .55rem; font-size: .78rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Cards & stats ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.25rem; min-width: 0; }
.card > h2 { margin-bottom: .9rem; }
.card > table { border-radius: inherit; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem 1.25rem; }
.stat b { display: block; font-size: 1.8rem; font-weight: 800; color: var(--navy-deep); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .82rem; }
.stat.accent b { color: var(--accent-deep); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; background: var(--white); }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; color: var(--muted); font-weight: 600; background: #FAFBFC; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FAFBFC; }
td .muted { color: var(--muted); font-size: .8rem; }
td .tag + .tag { margin-left: .2rem; }
.thumb { width: 56px; height: 40px; object-fit: cover; border-radius: 4px; background: var(--line); }
.card[style*="padding:0"] { overflow-x: auto; }

/* ---------- Tags ---------- */
.tag { display: inline-block; font-size: .72rem; font-weight: 600; line-height: 1.5; padding: .1rem .5rem; border-radius: 999px; background: var(--line); color: var(--ink); white-space: nowrap; font-family: inherit; }
.tag-hot { background: var(--accent); color: var(--white); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-off { background: var(--danger-soft); color: var(--danger); }
.tag-navy { background: var(--navy); color: var(--white); }
.switch { cursor: pointer; }
.switch:hover { outline: 2px solid var(--line-strong); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters input, .filters select { padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); font-size: .875rem; background: var(--white); min-width: 0; }
.filters input[type="search"] { min-width: 200px; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Forms ---------- */
.field { margin-bottom: 1rem; min-width: 0; }
.field label { display: block; font-weight: 600; font-size: .82rem; margin-bottom: .3rem; }
.field input, .field select, .field textarea { display: block; width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); font-size: .9rem; background: var(--white); transition: border-color .15s, box-shadow .15s; }
.field input[type="file"] { padding: .4rem; font-size: .82rem; }
.field input[type="checkbox"], .field input[type="radio"] { width: auto; display: inline-block; }
.field textarea { min-height: 100px; resize: vertical; }
.field textarea.tall { min-height: 320px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85rem; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.field-error { display: block; color: var(--danger); font-size: .78rem; margin-top: .25rem; }
.field-error:empty { display: none; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin-bottom: .5rem; cursor: pointer; }
.check input { width: auto; margin: 0; accent-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.grid-cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.grid-2 > *, .grid-cols-2 > * { min-width: 0; }

/* ---------- Alerts ---------- */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .875rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-success { background: var(--ok-soft); color: #0E6B41; border: 1px solid #A6E3C4; }
.alert-error { background: var(--danger-soft); color: #912018; border: 1px solid #FDA29B; }

/* ---------- Pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: 1rem; }
.pagination a, .pagination span { padding: .35rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.pagination a:hover { border-color: var(--navy); }
.pagination .is-active { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* ---------- Gallery ---------- */
.gallery-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.gallery-admin figure { margin: 0; min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.gallery-admin img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--line); }
.gallery-admin figcaption { padding: .5rem .7rem .7rem; font-size: .8rem; }
.gallery-admin figcaption strong { display: block; overflow-wrap: anywhere; }

/* ---------- Dashboard bar chart ---------- */
.bar { display: flex; align-items: center; gap: .6rem; font-size: .82rem; margin-bottom: .4rem; min-width: 0; }
.bar > span:first-child { display: inline-block; flex-shrink: 0; height: 10px; background: var(--accent); border-radius: 3px; }
.bar b { flex-shrink: 0; }
.bar > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--navy-deep); background-image: radial-gradient(55% 70% at 88% 8%, rgba(242, 107, 29, .35), transparent 70%); }
.login-box { background: var(--white); border-radius: 10px; padding: 2rem; width: min(380px, 100%); box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .admin { grid-template-columns: minmax(0, 1fr); }
  .sidebar { height: auto; position: static; padding: .75rem 0; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 0 .25rem; padding: 0 .75rem; }
  .sidebar nav a { padding: .45rem .7rem; border-left: 0; border-bottom: 2px solid transparent; border-radius: 4px; }
  .sidebar nav a:hover, .sidebar nav a.is-active { border-bottom-color: var(--accent); }
  .sidebar .sep { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-cols-2 { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 1rem; }
  .filters input[type="search"] { min-width: 0; flex: 1 1 160px; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .topbar h1 { font-size: 1.25rem; }
}
