/* =============================================================================
   Admin — Bootstrap 5.3 + brand red + modern layout
   Giao diện admin của site (Bootstrap 5.3, màu chủ đạo đỏ).
   ============================================================================= */

:root {
  /* Brand */
  --bs-primary:        #df1529;
  --bs-primary-rgb:    223, 21, 41;
  --bs-secondary:      #596d80;
  --bs-secondary-rgb:  89, 109, 128;

  --bs-success:        #16a34a;
  --bs-success-rgb:    22, 163, 74;
  --bs-danger:         #dc2626;
  --bs-danger-rgb:     220, 38, 38;
  --bs-warning:        #f59e0b;
  --bs-warning-rgb:    245, 158, 11;
  --bs-info:           #0ea5e9;
  --bs-info-rgb:       14, 165, 233;

  /* Surfaces */
  --bs-body-bg:        #f8fafc;
  --bs-body-color:     #1e293b;
  --bs-body-color-rgb: 30, 41, 59;
  --bs-border-color:   #e2e8f0;
  --bs-border-radius:       0.5rem;
  --bs-border-radius-sm:    0.375rem;
  --bs-border-radius-lg:    0.75rem;
  --bs-border-radius-xl:    1rem;

  --bs-body-font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-size:   0.875rem;
  --bs-body-line-height: 1.55;

  /* Layout */
  --admin-sidebar-width:  230px;
  --admin-topbar-height:  52px;
  --admin-sidebar-bg:     #ffffff;
  --admin-sidebar-border: #e2e8f0;
}

body {
  font-family: var(--bs-body-font-family);
  font-size:   var(--bs-body-font-size);
  background:  var(--bs-body-bg);
  color:       var(--bs-body-color);
  min-height:  100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Subtle gradient blob backgrounds in main area for depth */
.admin-main {
  position: relative;
  isolation: isolate;
}

.admin-main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle 600px at 0% 0%, rgba(var(--bs-primary-rgb), 0.025), transparent 70%),
    radial-gradient(circle 500px at 100% 0%, rgba(14, 165, 233, 0.03), transparent 70%);
}

/* Fix TinyMCE fullscreen bị che: khi editor fullscreen, gỡ stacking context
   của .admin-main để lớp fullscreen (position:fixed; z-index 1200) nổi trên
   sidebar (1020) và topbar (1030). Class do admin.js toggle qua FullscreenStateChanged. */
body.tinymce-fullscreen-active .admin-main {
  isolation: auto;
}
body.tinymce-fullscreen-active .tox.tox-tinymce.tox-fullscreen {
  z-index: 2000;
}
/* Hộp thoại / menu nổi của TinyMCE phải nằm trên sidebar, topbar, modal Bootstrap và chế độ fullscreen */
.tox-tinymce-aux {
  z-index: 2100;
}
/* TinyMCE 8 dựng header bằng CSS grid (menubar cột 1 + nút Upgrade cột 2). Ẩn nút Upgrade xong thì thanh công cụ bị
   đẩy sang cột 2 hẹp và xếp dọc: đổi header về block để menubar nằm trên, thanh công cụ nằm dưới, tràn hết chiều ngang. */
.tox .tox-promotion { display: none; }
.tox.tox-tinymce .tox-editor-header { display: block !important; }

/* =============================================================================
   Shell layout — sidebar trái (có header riêng) + main area (topbar + content)
   ============================================================================= */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar (left column, fixed) */
.admin-sidebar {
  width: var(--admin-sidebar-width);
  background: var(--admin-sidebar-bg);
  border-right: 1px solid var(--admin-sidebar-border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1020;
}

/* Sidebar header (brand) — matches topbar height */
.sidebar-header {
  height: var(--admin-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.5rem 0 0.85rem;
  background: linear-gradient(135deg, #df1529 0%, #b81224 100%);
  border-bottom: 1px solid var(--admin-sidebar-border);
  flex-shrink: 0;
  gap: 0.5rem;
}

.sidebar-collapse-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-collapse-toggle:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.sidebar-collapse-toggle:active {
  background: rgba(255, 255, 255, 0.38);
}

.sidebar-collapse-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform 0.25s ease;
}

/* Trạng thái collapsed — sidebar thu gọn thành icon-only (desktop ≥ 992px) */
@media (min-width: 992px) {
  .admin-shell.sidebar-collapsed {
    --admin-sidebar-width: 64px;
  }

  .admin-shell.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 0;
  }

  .admin-shell.sidebar-collapsed .admin-sidebar .brand { display: none; }
  .admin-shell.sidebar-collapsed .admin-sidebar .brand img { display: none; }
  .admin-shell.sidebar-collapsed .admin-sidebar .nav-link span,
  .admin-shell.sidebar-collapsed .admin-sidebar .sidebar-section-toggle span,
  .admin-shell.sidebar-collapsed .admin-sidebar .sidebar-section-arrow {
    display: none;
  }

  .admin-shell.sidebar-collapsed .admin-sidebar .nav-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .admin-shell.sidebar-collapsed .admin-sidebar .sidebar-section-toggle {
    justify-content: center;
    padding: 0.35rem 0;
    min-height: 2px;
  }

  .admin-shell.sidebar-collapsed .admin-sidebar .sidebar-section {
    border-top: 1px solid rgba(226, 232, 240, 0.6);
    margin-top: 0.4rem;
    padding-top: 0.4rem;
  }

  .admin-shell.sidebar-collapsed .admin-sidebar .sidebar-section > .collapse {
    display: block !important;
    height: auto !important;
  }

  /* Quay icon nút collapse khi đang thu gọn */
  .admin-shell.sidebar-collapsed .sidebar-collapse-toggle svg {
    transform: rotate(180deg);
  }

  /* Tooltip hiển thị tên menu khi hover icon */
  .admin-shell.sidebar-collapsed .admin-sidebar .nav-link {
    position: relative;
  }

  .admin-shell.sidebar-collapsed .admin-sidebar .nav-link:hover::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #fff;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1100;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
  }
}

.sidebar-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: #fff;
}

.sidebar-header .brand img {
  height: 22px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

/* Sidebar scrollable nav area */
.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem 0.5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar-body::-webkit-scrollbar { width: 0; display: none; }

/* Main column = topbar + content */
.admin-main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar — glassmorphism, blur background under */
.admin-topbar {
  height: var(--admin-topbar-height);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.75rem;
}

/* Fallback for browsers without backdrop-filter support */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .admin-topbar { background: #ffffff; }
}

.admin-topbar .topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-topbar .topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--bs-body-color);
  margin: 0;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.admin-topbar .topbar-title:empty {
  display: none;
}

.btn-icon {
  background: transparent;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: background-color 0.15s ease;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: var(--bs-body-color);
}

.user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.6rem 0.3rem 0.35rem;
  background: transparent;
  border: 1px solid var(--bs-border-color);
  border-radius: 999px;
  color: var(--bs-body-color);
}

.user-trigger:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(var(--bs-primary-rgb), 0.12);
  color: var(--bs-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
}

.sidebar-toggle { display: none; }

@media (max-width: 991.98px) {
  .sidebar-toggle { display: inline-flex; }
  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  }
  .admin-sidebar.show { transform: translateX(0); }
}

.admin-sidebar::-webkit-scrollbar { width: 0; display: none; }

.admin-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.38rem 0.6rem;
  margin-bottom: 0.05rem;
  color: var(--bs-body-color);
  border-radius: var(--bs-border-radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.admin-sidebar .nav-link:not(.active):hover {
  transform: translateX(2px);
}

.admin-sidebar .nav-link i {
  font-size: 0.95rem;
  width: 1.1rem;
  text-align: center;
  color: var(--bs-secondary-color, #64748b);
  flex-shrink: 0;
}

.admin-sidebar .nav-link:hover {
  background: #f1f5f9;
  color: var(--bs-body-color);
}

.admin-sidebar .nav-link.active {
  background: rgba(var(--bs-primary-rgb), 0.1);
  color: var(--bs-primary);
}

.admin-sidebar .nav-link.active i {
  color: var(--bs-primary);
}

/* Collapsible section headers */
.sidebar-section {
  margin-top: 0.5rem;
}

.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.6rem 0.25rem;
  color: #94a3b8;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: 0;
  width: 100%;
}

.sidebar-section-toggle:hover {
  color: var(--bs-primary);
}

.sidebar-section-arrow {
  font-size: 0.65rem;
  transition: transform 0.2s ease;
}

.sidebar-section-toggle[aria-expanded="false"] .sidebar-section-arrow {
  transform: rotate(-90deg);
}

/* Logout block — softer */

/* Main content area (inside admin-main-col, below topbar) */
.admin-main {
  flex: 1;
  padding: 1.25rem 1.5rem;
  min-width: 0;
  background: var(--bs-body-bg);
}

@media (max-width: 991.98px) {
  .admin-main { padding: 1rem; }
}

/* =============================================================================
   Components
   ============================================================================= */

.btn {
  font-weight: 500;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary,
.btn-outline-primary,
.btn-success,
.btn-danger {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* Icon trong button luôn căn giữa theo dòng text */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  line-height: 1.2;
}

.btn > svg {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* Btn-icon (vuông 30-32px) không có text → bỏ gap */
.btn-icon {
  gap: 0;
}

.btn-primary:hover,
.btn-success:hover,
.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(var(--bs-primary-rgb), 0.18);
}

.btn-primary:active,
.btn-success:active,
.btn-danger:active {
  transform: translateY(0);
}

.btn-primary {
  --bs-btn-bg:                   #df1529;
  --bs-btn-border-color:         #df1529;
  --bs-btn-hover-bg:             #be1224;
  --bs-btn-hover-border-color:   #be1224;
  --bs-btn-active-bg:            #9d0f1e;
  --bs-btn-active-border-color:  #9d0f1e;
  --bs-btn-disabled-bg:          #df1529;
  --bs-btn-disabled-border-color:#df1529;
}

.btn-outline-primary {
  --bs-btn-color:                #df1529;
  --bs-btn-border-color:         #df1529;
  --bs-btn-hover-bg:             #df1529;
  --bs-btn-hover-border-color:   #df1529;
  --bs-btn-active-bg:            #be1224;
  --bs-btn-active-border-color:  #be1224;
}

.form-control, .form-select {
  border-color: var(--bs-border-color);
  padding: 0.5rem 0.75rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.12);
  outline: 0;
}

label, .form-label {
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.4rem;
}

/* =============================================================================
   Micro-polish: shadows, transitions, hover micro-interactions
   ============================================================================= */
.card {
  border-radius: var(--bs-border-radius-lg);
  border-color: var(--bs-border-color);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.03),
    0 2px 6px rgba(15, 23, 42, 0.04),
    0 4px 12px rgba(15, 23, 42, 0.03);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* Opt-in: cards with .card-hover lift on hover */

.card-header {
  background: transparent;
  border-bottom-color: var(--bs-border-color);
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.card-body { padding: 1.25rem 1.5rem; }

.table > :not(caption) > * > * {
  padding: 0.85rem 1rem;
  border-bottom-color: var(--bs-border-color);
}

.table > thead {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.table > thead th {
  font-weight: 600;
  background: transparent;
  border-bottom: 1px solid var(--bs-border-color);
}

.table-hover > tbody > tr:hover > * {
  background: rgba(var(--bs-primary-rgb), 0.04);
}

.modal-content {
  border-radius: var(--bs-border-radius-lg);
  border: 1px solid rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  box-shadow:
    0 10px 25px rgba(15, 23, 42, 0.12),
    0 20px 60px rgba(15, 23, 42, 0.1);
}

.modal-backdrop.show { opacity: 0.45; backdrop-filter: blur(2px); }

/* =============================================================================
   Pagination — căn giữa, viền mềm, nút active màu brand
   ============================================================================= */
nav[role="navigation"]:has(> .pagination),
nav > .pagination {
  display: flex;
  justify-content: center;
}

.pagination {
  justify-content: center;
  margin: 1.25rem 0 0;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.pagination .page-item .page-link,
.pagination .page-link {
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: #fff;
  color: var(--bs-body-color);
  border-radius: 8px;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.6rem;
  font-weight: 500;
  font-size: 0.85rem;
  margin: 0;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.pagination .page-link:hover {
  background: rgba(var(--bs-primary-rgb), 0.06);
  color: var(--bs-primary);
  border-color: rgba(var(--bs-primary-rgb), 0.25);
  z-index: 1;
}

.pagination .page-item.active .page-link,
.pagination .page-item .page-link.active {
  background: var(--bs-primary);
  border-color: var(--bs-primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(var(--bs-primary-rgb), 0.25);
}

.pagination .page-item.disabled .page-link {
  background: #f8fafc;
  color: #94a3b8;
  border-color: rgba(226, 232, 240, 0.7);
  opacity: 1;
}

.dropdown-menu {
  border-radius: var(--bs-border-radius-lg);
  border-color: rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  box-shadow:
    0 4px 12px rgba(15, 23, 42, 0.08),
    0 12px 32px rgba(15, 23, 42, 0.08);
  padding: 0.4rem;
  animation: dropdown-fade-in 0.15s ease-out;
}

@keyframes dropdown-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .dropdown-menu { background: #ffffff; }
}

.dropdown-item {
  border-radius: var(--bs-border-radius-sm);
  padding: 0.45rem 0.75rem;
}

.dropdown-item:hover {
  background: rgba(var(--bs-primary-rgb), 0.08);
  color: var(--bs-primary);
}

.page-link { color: var(--bs-primary); }
.page-item.active .page-link {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.alert { border-radius: var(--bs-border-radius); }

/* =============================================================================
   #1 Toast notifications (Linear/Vercel style)
   ============================================================================= */
.toast-container { z-index: 1090; }

.app-toast {
  min-width: 280px;
  max-width: 380px;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background: #fff;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.1), 0 4px 6px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.app-toast .toast-body {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.85rem;
  font-size: 0.85rem;
}

.app-toast .toast-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.app-toast.toast-success .toast-icon { background: rgba(22,163,74,0.15); color: #15803d; }
.app-toast.toast-error   .toast-icon { background: rgba(220,38,38,0.15); color: #b91c1c; }
.app-toast.toast-warning .toast-icon { background: rgba(245,158,11,0.18); color: #b45309; }
.app-toast.toast-info    .toast-icon { background: rgba(14,165,233,0.15); color: #0369a1; }

.app-toast .toast-content { flex: 1; min-width: 0; }
.app-toast .toast-title { font-weight: 600; margin-bottom: 0.1rem; line-height: 1.3; }
.app-toast .toast-message { color: #475569; line-height: 1.4; word-wrap: break-word; }

.app-toast .toast-close {
  background: none;
  border: 0;
  padding: 0;
  color: #94a3b8;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}
.app-toast .toast-close:hover { color: #1e293b; }

/* =============================================================================
   #2 Form polish — loading button + error display
   ============================================================================= */
.btn-loading {
  pointer-events: none;
  opacity: 0.85;
  position: relative;
}

.btn-loading .btn-spinner {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 0.4em;
  vertical-align: -0.1em;
}

@keyframes spin { to { transform: rotate(360deg); } }

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--bs-danger);
  background-image: none;
  padding-right: 0.75rem;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
  border-color: var(--bs-danger);
  box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.15);
}

.invalid-feedback {
  font-size: 0.78rem;
  color: var(--bs-danger);
  margin-top: 0.3rem;
}

/* Required marker */
.form-label.required::after,
label.required::after {
  content: " *";
  color: var(--bs-danger);
}

/* Helper text under inputs */
.form-text {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* =============================================================================
   #3 Table polish — sticky header, action buttons, status badges
   ============================================================================= */

/* Action icon buttons (edit/delete/preview) */
.btn-action {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  color: #64748b;
  transition: all 0.15s ease;
}

.btn-action:hover {
  background: #f1f5f9;
  color: var(--bs-body-color);
}

/* Status badge utilities (pill shaped) */

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
}

.empty-state h5 {
  color: #475569;
  margin-bottom: 0.35rem;
}

.empty-state p {
  font-size: 0.85rem;
  margin: 0;
}

a { color: var(--bs-primary); }
a:hover { color: #9d0f1e; }

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #1e293b;
}

/* Compact heading sizes for admin */
.h1, h1 { font-size: 1.5rem; }
.h2, h2 { font-size: 1.3rem; }
.h3, h3 { font-size: 1.15rem; }
.h4, h4 { font-size: 1.05rem; }
.h5, h5 { font-size: 0.95rem; }
.h6, h6 { font-size: 0.85rem; }

/* Page header pattern */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-header .page-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.page-header .breadcrumb {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  --bs-breadcrumb-divider: "›";
}

/* =============================================================================
   Image uploader widget
   ============================================================================= */

/* =============================================================================
   Select2 — sync với Bootstrap form-control mới
   ============================================================================= */


/* Select2 overrides — bump specificity via body prefix (select2.min.css loaded after admin.css) */

/* =============================================================================
   SEO Analyzer — bảng chấm điểm SEO on-page trong editor bài viết
   ============================================================================= */

/* =============================================================================
   Dashboard (/admin) — thẻ KPI, nhãn nhóm, biểu đồ, hoạt động gần đây, lối tắt
   ============================================================================= */
.kpi-card { border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius-lg); background: #fff; padding: 1rem 1.25rem; height: 100%; }
.kpi-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; font-weight: 600; margin: 0 0 0.4rem; }
.kpi-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.kpi-meta { font-size: 0.74rem; color: #64748b; margin-top: 0.3rem; }
.kpi-icon { width: 38px; height: 38px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; }
.delta-up { color: var(--bs-success); font-weight: 600; }
.delta-down { color: var(--bs-danger); font-weight: 600; }
.section-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: #334155; font-weight: 700; margin: 0.25rem 0 0.6rem; display: flex; align-items: center; gap: 0.4rem; }
.section-label-note { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 0.72rem; color: #94a3b8; }
.min-w-0 { min-width: 0; }
.dash-chart { position: relative; height: 260px; }

.top-viewed-rank { width: 1.9rem; flex-shrink: 0; }
.top-viewed-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bs-body-color); }
.top-viewed-title:hover { color: var(--bs-primary); }
.top-viewed-hits { font-weight: 600; color: #475569; flex-shrink: 0; }

.quick-action { display: flex; align-items: center; gap: 0.65rem; padding: 0.7rem 0.9rem; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); background: #fff; text-decoration: none; color: var(--bs-body-color); font-size: 0.875rem; font-weight: 500; transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; }
.quick-action:hover { border-color: var(--bs-primary); color: var(--bs-primary); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(223, 21, 41, 0.08); }
.quick-action i { font-size: 1.2rem; color: var(--bs-primary); }

.activity-list { list-style: none; padding: 0.5rem 0; margin: 0; overflow-y: auto; max-height: 440px; }
.activity-item { display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.55rem 1rem; transition: background-color 0.15s ease; }
.activity-item:hover { background: #f8fafc; }
.activity-dot { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.85rem; }
.activity-dot.is-created { background: rgba(22, 163, 74, 0.12); color: #15803d; }
.activity-dot.is-updated { background: rgba(14, 165, 233, 0.12); color: #0369a1; }
.activity-body { flex: 1; min-width: 0; }
.activity-text { display: flex; align-items: center; gap: 0.4rem; line-height: 1.2; margin-bottom: 0.1rem; }
.activity-title { display: block; font-size: 0.85rem; font-weight: 500; color: var(--bs-body-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-title:hover { color: var(--bs-primary); }
.activity-time { font-size: 0.72rem; white-space: nowrap; flex-shrink: 0; align-self: center; }
.badge-action { font-size: 0.62rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.02em; }
.badge-created { background: rgba(22, 163, 74, 0.15); color: #15803d; }
.badge-updated { background: rgba(14, 165, 233, 0.15); color: #0369a1; }

@media (max-width: 575.98px) {
  .activity-item { flex-wrap: wrap; padding: 0.6rem 0.85rem; gap: 0.55rem; }
  .activity-dot { width: 28px; height: 28px; font-size: 0.78rem; }
  .activity-body { flex: 1 1 calc(100% - 40px); }
  .activity-time { margin-left: 38px; }
}

/* =============================================================================
   Polish (1.0.4) — thương hiệu của site này, tab/công tắc/liên kết theo màu chủ đạo, bảng và cây trên màn hình nhỏ
   ============================================================================= */

/* Màu liên kết / tab mặc định của Bootstrap là xanh dương: đưa về màu chủ đạo của admin */
:root {
  --bs-link-color: #df1529;
  --bs-link-color-rgb: 223, 21, 41;
  --bs-link-hover-color: #b81224;
  --bs-link-hover-color-rgb: 184, 18, 36;
}

.nav-tabs { --bs-nav-tabs-link-active-color: #0f172a; }
.nav-tabs .nav-link { color: #64748b; font-weight: 500; }
.nav-tabs .nav-link:hover { color: var(--bs-primary); }
.nav-tabs .nav-link.active { color: var(--bs-primary); font-weight: 600; }

/* Công tắc / checkbox / radio khi bật */
.form-check-input:checked {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}
.form-check-input:focus {
  border-color: rgba(var(--bs-primary-rgb), 0.55);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}
.form-switch .form-check-input:focus:not(:checked) {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23e8a0a8'/%3e%3c/svg%3e");
}

/* Logo chữ trong header sidebar (thay ảnh logo tối màu, khó đọc trên nền đỏ) */
.sidebar-header .brand { min-width: 0; }
.sidebar-header .brand .brand-icon { font-size: 1.25rem; line-height: 1; flex-shrink: 0; }
.sidebar-header .brand .brand-text {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Thụt lề cây (menu...): mỗi cấp một bước, kèm mũi tên nhỏ */
.tree-indent {
  display: inline-block;
  padding-left: calc((var(--depth, 1) - 1) * 1.35rem);
  margin-right: 0.35rem;
  color: #94a3b8;
}

/* Ảnh lỗi (file upload chưa có trên máy này hoặc đã bị xóa) được admin.js thay bằng ô giữ chỗ */
.admin-img-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  vertical-align: middle;
}

/* Bảng danh sách trên màn hình nhỏ: giữ bề rộng tối thiểu để cột tên không bị bóp thành từng chữ, cho cuộn ngang trong thẻ */
@media (max-width: 767.98px) {
  .table-responsive > .table { min-width: 680px; }
  .admin-page-header { flex-direction: column; align-items: flex-start !important; }
}

/* Thanh Lưu/Hủy dính đáy: chừa chỗ để không che nội dung cuối trang */
.admin-main > form { padding-bottom: 0.5rem; }

/* Mobile: sidebar mở ra phải nằm trên thanh topbar (kính mờ, z-index 1030) để thấy logo và nút thu gọn */
@media (max-width: 991.98px) {
  .admin-sidebar { z-index: 1045; }
}

/* =============================================================================
   Trang đăng nhập admin (layouts/dashboard-guest): bố cục chia đôi, khối thương hiệu bên trái, form bên phải
   ============================================================================= */
.auth-body { background: #f8fafc; min-height: 100vh; margin: 0; -webkit-font-smoothing: antialiased; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-shell { grid-template-columns: 1.05fr 1fr; } }

.auth-brand {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.12), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08), transparent 50%),
    linear-gradient(135deg, #df1529 0%, #b81224 100%);
}
.auth-brand::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -120px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.auth-brand::after {
  content: "";
  position: absolute;
  bottom: -160px;
  left: -160px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  pointer-events: none;
}
.auth-brand-top { position: relative; z-index: 1; display: flex; align-items: center; gap: 0.6rem; }
.auth-brand-top i { font-size: 1.6rem; line-height: 1; }
.auth-brand-top span { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.auth-brand-top small { margin-left: 0.15rem; padding: 0.1rem 0.45rem; border-radius: 6px; background: rgba(255, 255, 255, 0.2); font-weight: 600; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }

.auth-brand-content { position: relative; z-index: 1; max-width: 420px; }
.auth-brand-content h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 1rem; color: #fff; }
.auth-brand-content p { font-size: 1rem; line-height: 1.6; color: rgba(255, 255, 255, 0.88); margin: 0 0 2rem; }
.auth-brand-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.auth-brand-features li { display: flex; align-items: center; gap: 0.65rem; font-size: 0.92rem; color: rgba(255, 255, 255, 0.95); }
.auth-brand-features li i { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); font-size: 0.85rem; }
.auth-brand-footer { position: relative; z-index: 1; font-size: 0.78rem; color: rgba(255, 255, 255, 0.7); }

/* Màn hình nhỏ: khối thương hiệu thu thành dải trên cùng */
@media (max-width: 991.98px) {
  .auth-shell { grid-template-rows: auto 1fr; }
  .auth-brand { padding: 1.1rem 1.5rem; }
  .auth-brand-content, .auth-brand-footer { display: none; }
}

.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
@media (min-width: 768px) { .auth-form-wrap { padding: 3rem 2.5rem; } }
.auth-form-card { width: 100%; max-width: 420px; }

.auth-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 0.35rem; color: #0f172a; }
.auth-subtitle { margin: 0; font-size: 0.95rem; color: #64748b; }
.auth-label { font-size: 0.875rem; font-weight: 600; color: #0f172a; margin-bottom: 0.25rem; }

.auth-field { position: relative; }
.auth-field-icon { position: absolute; left: 0.95rem; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 1rem; pointer-events: none; }
.auth-input { padding: 0.7rem 1rem 0.7rem 2.65rem; border-radius: 10px; border: 1px solid #e2e8f0; font-size: 0.95rem; height: auto; background: #fff; }
.auth-input-password { padding-right: 2.65rem; }
.auth-input:focus { border-color: rgba(223, 21, 41, 0.55); box-shadow: 0 0 0 0.2rem rgba(223, 21, 41, 0.12); }
.auth-field-toggle { position: absolute; right: 0.7rem; top: 50%; transform: translateY(-50%); background: transparent; border: 0; color: #94a3b8; padding: 0.25rem; cursor: pointer; }
.auth-field-toggle:hover { color: #475569; }

.auth-submit {
  background: linear-gradient(135deg, #df1529, #b81224);
  color: #fff;
  border: 0;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(223, 21, 41, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.auth-submit:hover, .auth-submit:focus { color: #fff; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(223, 21, 41, 0.35); }

.auth-help { text-align: center; margin: 1.5rem 0 0; font-size: 0.825rem; color: #94a3b8; }

.auth-alert { display: flex; gap: 0.5rem; align-items: flex-start; margin-bottom: 1rem; padding: 0.75rem 1rem; border-radius: 12px; font-size: 0.9rem; }
.auth-alert i { margin-top: 0.15rem; }
.auth-alert-error { background: rgba(220, 38, 38, 0.08); border: 1px solid rgba(220, 38, 38, 0.2); color: #991b1b; }
.auth-alert-success { background: rgba(22, 163, 74, 0.08); border: 1px solid rgba(22, 163, 74, 0.2); color: #15803d; }
