body { background: #f8f9fa; }
.card-img-top { object-fit: cover; height: 160px; }
.content img { max-width: 100%; height: auto; }

/* admin dashboard */
.nk-sidebar { background:#0f2235; color:#d0e1f1; }
.nk-sidebar a{ color:#d0e1f1; }
.nk-sidebar a:hover{ color:#fff; }
.ratio-16x9{ aspect-ratio:16/9; }
.object-fit-cover{ width:100%; height:100%; object-fit:cover; }


/* --- Enhanced cards & grid --- */
.card {
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
}
.card .ratio-16x9 { display:block; width:100%; height:auto; aspect-ratio:16/9; }
.badge-soft {
  background: #eef2ff;
  color: #3949ab;
  border: 1px solid #cfd8ff;
}
.meta { font-size: .85rem; color: #6c757d; }


.line-clamp-2 { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.line-clamp-3 { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }





/* Category tabs (borderless) */
.cat-tabs-wrapper { border-bottom: 1px solid rgba(0,0,0,.08); }
.cat-tabs { gap:.5rem; }
.cat-tab {
  display:inline-block;
  padding:.35rem .25rem;
  text-decoration:none;
  background:transparent;
  color:#1f2937;
}
.cat-tab:hover { color:#111827; text-decoration: underline; }
.cat-tab.active {
  color:#111827;
  font-weight:600;
  text-decoration:none;
  border-bottom: 2px solid #111827;
}



/* ===== Two-row Header (No Bootstrap Navbar) ===== */
.site-header { position:relative; z-index: 20; }
.topbar { background:#2a2d31; color:#fff; padding:.75rem 0; }
.brand { font-weight:700; font-size:1.25rem; color:#fff; text-decoration:none; }
.brand:hover { color:#fff; text-decoration:none; }
.hamburger { background:transparent; border:0; color:#fff; font-size:1.5rem; line-height:1; display:inline-flex; align-items:center; }
.hamburger:focus { outline: 2px dashed rgba(255,255,255,.4); outline-offset:2px; }

.search { position:relative; max-width:520px; }
.search-input { width:100%; background:#3a3f45; color:#fff; border:1px solid #4b5056; border-radius:.4rem; padding:.35rem .75rem .35rem 2.2rem; font-size:.95rem; }
.search-input::placeholder { color:#cbd5e1; }
.search-btn { position:absolute; left:.5rem; top:50%; transform:translateY(-50%); background:transparent; border:0; color:#cbd5e1; font-size:1rem; }

.auth .btn-ghost, .auth .btn-solid { font-size:.95rem; padding:.4rem .75rem; border-radius:.5rem; text-decoration:none; }
.btn-ghost { color:#e5e7eb; background:transparent; border:1px solid rgba(255,255,255,.25); }
.btn-ghost:hover { background:rgba(255,255,255,.1); color:#fff; }
.btn-solid { color:#1f2937; background:#f3f4f6; border:1px solid #e5e7eb; }
.btn-solid:hover { background:#e5e7eb; color:#111827; }

.catbar { background:#1f2327; color:#e5e7eb; }
.cat-main-nav { display:flex; gap:1rem; overflow-x:auto; white-space:nowrap; padding:.5rem 0; scrollbar-width:thin; }
.maincat-link { color:#e5e7eb; text-decoration:none; padding:.35rem .25rem; border-bottom:2px solid transparent; }
.maincat-link:hover { color:#fff; }
.maincat-link.active { color:#fff; border-color:#fff; font-weight:600; }

/* Mobile: collapse catbar by default; toggled by hamburger */
@media (max-width: 991.98px) {
  .catbar { display:none; }
  .catbar.is-open { display:block; }
}

/* ===== Card styles (existing) ===== */
.card { border: 1px solid rgba(0,0,0,.06); box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.card .ratio-16x9 { display:block; width:100%; height:auto; aspect-ratio:16/9; }
.meta { font-size:.85rem; color:#6c757d; }

/* Line clamp helpers */
.line-clamp-2 { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.line-clamp-3 { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }


@media (max-width: 991.98px) {
  .search { position:relative; max-width:100%; }
}

.auth { margin-left:auto; }

/* Right-align auth group */
.auth { margin-left: auto; }


/* === Footer === */
.site-footer { background:#171a1d; }
.site-footer .footer-head { font-weight:700; margin-top:.25rem; }
.site-footer .footer-head a { color:#e5e7eb; text-decoration:none; }
.site-footer a { color:#b9c1c9; text-decoration:none; }
.site-footer a:hover { color:#fff; text-decoration:underline; }
.footer-col li { margin:.2rem 0; }
.footer-sep { border-color: rgba(255,255,255,.08); opacity:1; }

.footer-links a { color:#b9c1c9; }
.footer-links a:hover { color:#fff; }

.social-btn { display:inline-flex; align-items:center; gap:.4rem; background:#2a2f35; color:#e5e7eb; 
  border:1px solid #3b4147; border-radius:.5rem; padding:.35rem .6rem; text-decoration:none; }
.social-btn:hover { background:#353b41; color:#fff; }



/* Article content images */
.article .content img { max-width:100%; height:auto; }
.share-row .btn { min-width: 200px; }


.meta .bi-eye{ margin-left:.35rem; }

/* --- Dashboard --- */
.dash-card { background:#fff; border:1px solid rgba(0,0,0,.08); border-radius:.75rem; padding:1rem 1.25rem; box-shadow:0 1px 2px rgba(0,0,0,.04); }
.dash-num { font-size:1.75rem; font-weight:700; line-height:1; }
.dash-label { color:#6b7280; font-size:.95rem; }


/* ===== Admin Dashboard ===== */
.admin-layout { display:flex; gap:1rem; }
.admin-sidebar { width:260px; background:#1f2327; color:#e5e7eb; border-radius: .75rem; padding:1rem; position:sticky; top:1rem; height:fit-content; }
.admin-profile { padding:.5rem 0 1rem; }
.admin-avatar { width:84px; height:84px; border-radius:50%; object-fit:cover; box-shadow:0 2px 8px rgba(0,0,0,.25); }
.admin-name { font-weight:700; margin-top:.5rem; }
.admin-role { font-size:.85rem; color:#aab1b9; }
.admin-nav a { display:block; padding:.5rem .75rem; border-radius:.5rem; text-decoration:none; color:#e5e7eb; }
.admin-nav a:hover { background:#2a2f30; }
.admin-nav a.active { background:#111418; }

.admin-content { flex:1; }
.admin-top { background:#2a2d31; padding:.5rem; border-radius:.75rem; }
.admin-search { background:#3a3f45; border:1px solid #4b5056; color:#fff; }
.admin-search::placeholder { color:#cbd5e1; }
.admin-search-icon { position:absolute; right:.75rem; top:50%; transform:translateY(-50%); color:#cbd5e1; }

.stat-card { color:#fff; border-radius:.85rem; padding:1rem; box-shadow:0 6px 20px rgba(0,0,0,.08); position:relative; overflow:hidden; }
.stat-card .stat-label { font-size:.95rem; opacity:.95; }
.stat-card .stat-num { font-size:1.6rem; font-weight:800; line-height:1; margin-top:.25rem; }
.bg-teal { background:#1abc9c; }
.bg-purple { background:#8e44ad; }
.bg-indigo { background:#3f51b5; }

/* Responsive: collapse sidebar */
@media (max-width: 991.98px) {
  .admin-layout { display:block; }
  .admin-sidebar { position:static; width:100%; margin-bottom:1rem; display:none; }
  .admin-sidebar.open { display:block; }
}



/* ===== Admin Dashboard Refresh ===== */
.admin-sidebar { background:#111418; }
.admin-nav a { color:#d1d5db; }
.admin-nav a:hover { background:#1f2327; color:#fff; }
.admin-nav a.active { background:#0b0d10; color:#fff; }
.admin-top { background:#111418; border:1px solid #1f2327; }

.stat-card { border:0; box-shadow:0 4px 16px rgba(0,0,0,.12); }
.stat-card .stat-label { opacity:.9; }
.stat-card .stat-num { letter-spacing:.2px; }

.table > :not(caption) > * > * { background:transparent; }
.table-hover tbody tr:hover { background:rgba(0,0,0,.03); }



/* ===== Admin sidebar (enhanced) ===== */
.nk-sidebar {
  width: 264px;
  min-height: calc(100vh - 56px);
  background: linear-gradient(180deg, #0f2235 0%, #0b1a29 100%);
  position: sticky;
  top: 56px; /* height of header navbar (bootstrap default 56px) */
  align-self: start;
}
@media (max-width: 991.98px) {
  .nk-sidebar { position: static; width: 100%; min-height: auto; border-bottom: 1px solid rgba(255,255,255,.08); }
}

.nk-sidebar-inner { height: 100%; overflow-y: auto; }
.nk-sidebar-inner::-webkit-scrollbar { width: 10px; }
.nk-sidebar-inner::-webkit-scrollbar-track { background: transparent; }
.nk-sidebar-inner::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 6px; }

.menu { display: flex; flex-direction: column; gap: .25rem; }
.menu-group { display: flex; flex-direction: column; gap: .25rem; }
.menu-divider { height: 1px; background: rgba(255,255,255,.12); margin: .5rem 0  .75rem; }

.menu-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
  border-radius: .65rem;
  color: #d0e1f1;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, transform .08s ease;
}
.menu-link i { font-size: 1rem; opacity: .9; }
.menu-link:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(2px); }

.menu-link.is-active,
.menu-link.active { 
  background: rgba(53, 162, 235, .18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(53,162,235,.35);
}

.text-white-50 { color: rgba(255,255,255,.55) !important; }
.text-white-75 { color: rgba(255,255,255,.75) !important; }


/* ===== Dashboard content improvements ===== */
.admin-content { padding: 1rem; }
.stat-card {
  border-radius: 1rem;
  padding: 1rem;
  color: #fff;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0,0,0,.2);
}
.stat-label { font-size: .9rem; opacity: .9; }
.stat-num { font-weight: 700; font-size: 1.25rem; }

.admin-top {
  background: #fff;
  padding: .75rem 1rem;
  border-radius: .75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.admin-search { border-radius: .5rem; padding-left: 2rem; }
.admin-search-icon { position: absolute; top: 50%; left: .65rem; transform: translateY(-50%); color:#888; }

.table thead { background: #f1f3f5; }
.table-hover tbody tr:hover { background: #f9fafb; }


/* ===== Dashboard polish (v17) ===== */
.dashboard .stat-card {
  border: 0;
  color: #fff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(15,34,53,.15);
  transform: translateY(0);
  transition: transform .15s ease, box-shadow .15s ease, filter .2s ease;
}
.dashboard .stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(15,34,53,.2);
  filter: saturate(1.05);
}
.bg-primary  { background: linear-gradient(135deg, #007bff 0%, #5aa2ff 100%); }
.bg-secondary{ background: linear-gradient(135deg, #6c757d 0%, #97a0a8 100%); }
.bg-success  { background: linear-gradient(135deg, #28a745 0%, #58c06f 100%); }
.bg-warning  { background: linear-gradient(135deg, #ffc107 0%, #ffd76a 100%); color:#2b2b2b; }
.bg-danger   { background: linear-gradient(135deg, #dc3545 0%, #ff6b7a 100%); }
.bg-indigo   { background: linear-gradient(135deg, #6610f2 0%, #8a4dfc 100%); }
.bg-purple   { background: linear-gradient(135deg, #6f42c1 0%, #9b73f6 100%); }

/* Tables */
.table-card .table {
  --bs-table-bg: transparent;
}
.table-card .table thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  border-bottom: 2px solid rgba(0,0,0,.06);
}
.table-card .table tbody tr:hover {
  background: rgba(0,0,0,.03);
}

/* Buttons */
.btn {
  border-radius: 10px;
}

/* Card header */
.card .card-header {
  border-bottom: 1px solid rgba(0,0,0,.06);
}


/* ===== Responsive Admin Sidebar ===== */
.nk-hamburger {
  background: transparent;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: #fff;
  margin: .5rem;
}
@media (max-width: 991.98px) {
  .nk-sidebar {
    position: fixed;
    top: 0; left: -100%;
    width: 260px;
    height: 100%;
    z-index: 1050;
    transition: left .3s ease;
  }
  .nk-sidebar.open { left: 0; }
}


/* ===== Admin sidebar: mobile hamburger & off-canvas ===== */
.admin-hamburger{
  position: fixed;
  top: 70px;
  left: 12px;
  z-index: 1031;
  border: 0;
  background: #0f2235;
  color: #fff;
  width: 44px; height: 44px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
.admin-hamburger i{ font-size: 1.2rem; }

/* Mobile off-canvas */
@media (max-width: 991.98px){
  .nk-sidebar{
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 1032;
    box-shadow: 10px 0 30px rgba(0,0,0,.25);
  }
  body.admin-sidebar-open .nk-sidebar{
    transform: translateX(0);
  }
  .nk-sidebar-backdrop{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 1030;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body.admin-sidebar-open .nk-sidebar-backdrop{
    opacity: 1;
    pointer-events: auto;
  }
}


/* Lock scroll when sidebar open on mobile */
@media (max-width: 991.98px){
  body.admin-sidebar-open { overflow: hidden; }
}


/* ===== Admin Topbar (v21) ===== */
.admin-topbar {
  position: relative;
  z-index: 2;
}
.admin-topbar-inner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15,34,53,.08);
}
.admin-topbtn {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: #0f2235;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background-color .12s ease;
}
.admin-topbtn i { font-size: 28px; }
.admin-topbtn .label { display: flex; flex-direction: column; line-height: 1.2; }
.admin-topbtn small { color: #6c757d; }

.admin-topbtn:hover {
  transform: translateY(-2px);
  background: rgba(53,162,235,.06);
  border-color: rgba(53,162,235,.3);
  box-shadow: 0 10px 24px rgba(0,0,0,.1);
}

/* Responsive */
@media (max-width: 991.98px){
  .admin-topbar-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575.98px){
  .admin-topbar-inner { grid-template-columns: 1fr; }
}
/* Post content images */
.post-content img {
  max-width: 100%;   /* ให้รูปไม่กว้างเกินพื้นที่ที่อยู่ */
  height: auto;      /* ปรับอัตราส่วนภาพอัตโนมัติ */
  display: block;    /* กันบางธีมทำให้มี space ด้านล่าง */
  margin: 0 auto;    /* จัดกลางถ้ารูปเล็กกว่ากรอบ */
}
/* Table styles */
.table-container {
    width: 100%;
    overflow-x: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th {
    background-color: #f2f2f2;
    color: var(--text-color);
}

/* Blockquotes */
blockquote {
    border-left: 5px solid var(--primary-color);
    padding-left: 10px;
    color: var(--text-color);
    font-style: italic;
}
/* Dividers */
.divider {
    border-top: 1px solid transparent;
    background: linear-gradient(to right, var(--primary-color) 20%, #e9ecef 20%);
    height: 2px;
    margin: 1rem 0;
}
