/* ============================================
   Giao diện quản trị Sơn LIONS
   ============================================ */
:root {
  --brand: #e67e22;
  --brand-d: #d35400;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f1f5f9;
  --side: #1e293b;
  --side-2: #0f172a;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
a { text-decoration: none; color: inherit; }
.muted { color: var(--muted); }
.ta-r { text-align: right; }

/* ---- Nút ---- */
.btn-admin {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand); color: #fff; border: none;
  border-radius: 10px; padding: 11px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .18s, transform .18s, box-shadow .18s;
  white-space: nowrap;
}
.btn-admin:hover { background: var(--brand-d); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(230,126,34,.3); }
.btn-ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); box-shadow: none; }
.btn-ghost:hover { background: #fff7ef; color: var(--brand-d); box-shadow: none; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn-danger { background: #ef4444; }
.btn-danger:hover { background: #dc2626; box-shadow: 0 6px 16px rgba(239,68,68,.3); }
.btn-block { width: 100%; justify-content: center; }

/* ---- Alert ---- */
.alert { padding: 13px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.alert-ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-error ul { margin-left: 18px; }

/* ---- Đăng nhập ---- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e67e22, #1e293b); padding: 20px;
}
.login-box {
  background: #fff; width: 100%; max-width: 390px; padding: 40px 32px;
  border-radius: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.login-box h1 { font-size: 23px; text-align: center; }
.login-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 6px 0 24px; }
.login-box label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 15px; }
.login-box input {
  width: 100%; margin-top: 6px; padding: 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; font-family: inherit;
}
.login-box input:focus { outline: 2px solid #e67e2255; border-color: var(--brand); }
.back-home { display: block; text-align: center; margin-top: 18px; color: var(--muted); font-size: 13px; }

/* ---- Bố cục sidebar ---- */
.sidebar {
  position: fixed; top: 0; left: 0; width: 250px; height: 100vh;
  background: linear-gradient(180deg, var(--side), var(--side-2));
  color: #cbd5e1; display: flex; flex-direction: column; z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 22px; font-size: 19px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand b { color: var(--brand); }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px rgba(230,126,34,.25); }
.sidebar-nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 10px; font-size: 14.5px; font-weight: 500; color: #cbd5e1;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(230,126,34,.35); }
.sidebar-nav .ico { font-size: 17px; width: 22px; text-align: center; }
.sidebar-nav .lbl { flex: 1; }
.sidebar-nav .pill {
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-nav a.active .pill { background: rgba(255,255,255,.3); }
.sidebar-foot { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,.07); display: flex; flex-direction: column; gap: 2px; }
.side-link { padding: 10px 14px; border-radius: 8px; font-size: 13.5px; color: #94a3b8; transition: background .15s, color .15s; }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }

/* ---- Shell + topbar ---- */
.admin-shell { margin-left: 250px; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 14px 26px;
}
.topbar-title { font-size: 19px; font-weight: 700; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--brand);
  color: #fff; font-weight: 700; display: grid; place-items: center;
}
.uname { font-size: 14px; font-weight: 600; }
.burger { display: none; font-size: 22px; cursor: pointer; line-height: 1; }
.content { padding: 26px; max-width: 1120px; }

/* ---- Đầu nội dung ---- */
.content-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-tabs { display: flex; gap: 6px; background: #fff; padding: 5px; border-radius: 12px; box-shadow: var(--shadow); flex-wrap: wrap; }
.filter-tabs a { padding: 8px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s; }
.filter-tabs a:hover { color: var(--ink); }
.filter-tabs a.active { background: var(--brand); color: #fff; }

/* ---- Thẻ thống kê ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px; transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(15,23,42,.1); }
.stat-card.accent { background: linear-gradient(135deg, var(--brand), var(--brand-d)); color: #fff; }
.stat-ico { width: 52px; height: 52px; border-radius: 13px; display: grid; place-items: center; font-size: 24px; flex-shrink: 0; }
.stat-ico.blue { background: #e0f2fe; }
.stat-ico.orange { background: #ffedd5; }
.stat-ico.green { background: #dcfce7; }
.stat-ico.light { background: rgba(255,255,255,.25); }
.stat-num { font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat-lbl { font-size: 13px; color: var(--muted); }
.stat-card.accent .stat-lbl { color: rgba(255,255,255,.85); }

/* ---- Panels ---- */
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { font-size: 16px; }
.link-more { font-size: 13px; color: var(--brand); font-weight: 600; }

/* ---- Biểu đồ thanh danh mục ---- */
.cat-bars { display: flex; flex-direction: column; gap: 14px; }
.cat-bar-row { display: flex; align-items: center; gap: 12px; }
.cat-bar-lbl { width: 90px; font-size: 13px; color: var(--muted); }
.cat-bar-track { flex: 1; height: 10px; background: #f1f5f9; border-radius: 20px; overflow: hidden; }
.cat-bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), #f6a04a); border-radius: 20px; transition: width .5s; }
.cat-bar-num { width: 26px; text-align: right; font-weight: 700; font-size: 14px; }

/* ---- Danh sách gần đây ---- */
.recent-list { list-style: none; display: flex; flex-direction: column; }
.recent-list li { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.recent-list li:last-child { border-bottom: none; }
.rc-main { display: flex; flex-direction: column; }
.rc-phone { font-size: 12.5px; color: var(--muted); }
.rc-meta { display: flex; align-items: center; gap: 10px; }
.rc-date { font-size: 12.5px; color: var(--muted); }

/* ---- Bảng ---- */
.table-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.admin-table th, .admin-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th { background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr { transition: background .12s; }
.admin-table tbody tr:hover { background: #fafbfc; }
.thumb-sm { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; display: inline-block; vertical-align: middle; }
.thumb-sm.dot { border: 1px solid var(--line); }
.row-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.mini-badge { background: #ffedd5; color: #b9770e; font-size: 11px; padding: 2px 9px; border-radius: 20px; margin-left: 6px; font-weight: 600; }
.cat-chip { background: #eef2ff; color: #4338ca; font-size: 12.5px; padding: 4px 11px; border-radius: 20px; font-weight: 600; }
.star { color: #f59e0b; font-size: 18px; }
.actions { display: flex; gap: 7px; justify-content: flex-end; }
.actions form { display: inline; }
.empty { text-align: center; color: var(--muted); padding: 34px; }

/* ---- Form sản phẩm ---- */
.form-card { background: #fff; border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.form-cols { display: grid; grid-template-columns: 1fr 300px; gap: 24px; }
.fld { display: block; font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.fld input[type=text], .fld textarea, .fld select {
  width: 100%; margin-top: 6px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff;
}
.fld input:focus, .fld textarea:focus, .fld select:focus { outline: 2px solid #e67e2255; border-color: var(--brand); }
.fld textarea { resize: vertical; }
.form-row { display: flex; gap: 16px; }
.form-row .fld { flex: 1; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.form-side { display: flex; flex-direction: column; gap: 16px; }
.side-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.side-title { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 12px; }
.img-preview { width: 100%; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: #fff; border: 1px dashed var(--line); display: grid; place-items: center; margin-bottom: 12px; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-ph { color: #cbd5e1; font-size: 13px; }
.hint { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
input[type=color] { width: 100%; height: 44px; margin-top: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; }
input[type=file] { width: 100%; font-size: 13px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }

/* ---- Thẻ yêu cầu tư vấn ---- */
.contact-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.contact-item { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border-left: 4px solid transparent; }
.contact-item.is-new { border-left-color: var(--brand); }
.ci-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ci-top h3 { font-size: 16.5px; display: flex; align-items: center; gap: 8px; }
.ci-contact { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 5px; }
.ci-contact a { font-size: 13px; color: var(--muted); }
.ci-contact a:hover { color: var(--brand); }
.ci-date { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.badge-new { background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; }
.ci-tag { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.ci-tag b { color: var(--ink); }
.ci-msg { font-size: 14px; background: #f8fafc; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; color: #334155; }
.ci-actions { display: flex; gap: 8px; }
.ci-actions form { display: inline; }
.empty-state { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 60px 20px; text-align: center; color: var(--muted); }
.empty-ico { font-size: 46px; margin-bottom: 10px; }

/* ---- Backdrop mobile ---- */
.sidebar-backdrop { display: none; }

/* ---- Responsive ---- */
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
  .form-cols { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  #sidebarToggle:checked ~ .sidebar { transform: translateX(0); }
  #sidebarToggle:checked ~ .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .admin-shell { margin-left: 0; }
  .burger { display: block; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .contact-cards { grid-template-columns: 1fr; }
}
