/* ===== CSS เดิมคงไว้ทั้งหมด ===== */
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 เดิม แต่ปรับปรุงให้ทันสมัย ===== */
.site-header { 
  position: sticky; 
  top: 0; 
  z-index: 100; 
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
  backdrop-filter: blur(10px);
}

.topbar { 
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff; 
  padding: 0.875rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand { 
  font-weight: 800; 
  font-size: 1.75rem; 
  color: #fff; 
  text-decoration: none;
  background: linear-gradient(45deg, #60a5fa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  transition: all 0.3s ease;
}

.brand:hover { 
  color: #fff;
  text-decoration: none;
  transform: scale(1.05);
  filter: brightness(1.1);
}

.hamburger { 
  background: rgba(255,255,255,0.1); 
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #fff; 
  font-size: 1.25rem; 
  line-height: 1; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  width: 40px;
  height: 40px;
  transition: all 0.3s ease;
}

.hamburger:hover { 
  background: rgba(255,255,255,0.2);
  transform: scale(1.1);
}

.hamburger:focus { 
  outline: 2px dashed rgba(255,255,255,.4); 
  outline-offset: 2px; 
}

.search { 
  position: relative; 
  max-width: 520px;
}

.search-input { 
  width: 100%; 
  background: rgba(255,255,255,0.95);
  color: #1e293b; 
  border: 2px solid transparent;
  border-radius: 12px; 
  padding: 0.75rem 1rem 0.75rem 2.5rem; 
  font-size: 0.95rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-input:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.1);
  transform: translateY(-1px);
}

.search-input::placeholder { 
  color: #64748b; 
}

.search-btn { 
  position: absolute; 
  left: 0.75rem; 
  top: 50%; 
  transform: translateY(-50%); 
  background: transparent; 
  border: 0; 
  color: #64748b; 
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

.search-input:focus + .search-btn {
  color: #60a5fa;
}

.auth .btn-ghost, .auth .btn-solid { 
  font-size: 0.95rem; 
  padding: 0.5rem 1rem; 
  border-radius: 8px; 
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-ghost { 
  color: #e2e8f0; 
  background: rgba(255,255,255,0.1); 
  border: 1px solid rgba(255,255,255,0.2);
}

.btn-ghost:hover { 
  background: rgba(255,255,255,0.2); 
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-solid { 
  color: #1e293b; 
  background: linear-gradient(135deg, #60a5fa 0%, #34d399 100%);
  border: 1px solid transparent;
}

.btn-solid:hover { 
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(96, 165, 250, 0.3);
  filter: brightness(1.05);
  color: #1e293b;
}

.catbar { 
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #e5e7eb;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.cat-main-nav { 
  display: flex; 
  gap: 0.5rem; 
  overflow-x: auto; 
  white-space: nowrap; 
  padding: 1rem 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cat-main-nav::-webkit-scrollbar {
  display: none;
}

.maincat-link { 
  color: #94a3b8; 
  text-decoration: none; 
  padding: 0.75rem 1.25rem; 
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.3s ease;
  position: relative;
  border: 1px solid transparent;
}

.maincat-link:hover { 
  color: #fff;
  background: rgba(255,255,255,0.08);
  transform: translateY(-1px);
}

.maincat-link.active { 
  color: #fff; 
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2) 0%, rgba(52, 211, 153, 0.2) 100%);
  border-color: rgba(96, 165, 250, 0.3);
  font-weight: 600;
}

.maincat-link.home-link {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.2);
}

.maincat-link.home-link:hover {
  background: rgba(96, 165, 250, 0.25);
}

/* Mobile: collapse catbar by default; toggled by hamburger */
@media (max-width: 991.98px) {
  .catbar { 
    display: none; 
    background: #0f172a;
  }
  
  .catbar.is-open { 
    display: block;
    animation: slideDown 0.3s ease;
  }
  
  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  .cat-main-nav {
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 0;
  }
  
  .maincat-link {
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
  }
  
  .search { 
    position: relative; 
    max-width: 100%; 
  }
}

.auth { 
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hello {
  color: #e2e8f0;
  font-size: 0.9rem;
}

@media (max-width: 767.98px) {
  .hello {
    display: none;
  }
  
  .auth {
    gap: 0.5rem;
  }
  
  .btn-ghost, .btn-solid {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
  
  .brand { 
    font-size: 1.5rem; 
  }
}

@media (max-width: 575.98px) {
  .brand { 
    font-size: 1.25rem; 
  }
  
  .btn-ghost, .btn-solid {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
  }
}

/* ===== Footer เดิม แต่ปรับปรุงให้ทันสมัย ===== */
.site-footer { 
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-top: 1px solid rgba(255,255,255,0.1);
  position: relative;
  overflow: hidden;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(96, 165, 250, 0.5) 50%, transparent 100%);
}

.site-footer .footer-head { 
  font-weight: 700; 
  margin-top: 0.25rem;
  margin-bottom: 1rem;
  position: relative;
}

.site-footer .footer-head::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  width: 30px;
  height: 2px;
  background: linear-gradient(90deg, #60a5fa, #34d399);
  border-radius: 1px;
}

.site-footer .footer-head a { 
  color: #f1f5f9; 
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.site-footer .footer-head a:hover {
  color: #60a5fa;
  text-decoration: underline;
  transform: translateX(2px);
}

.site-footer a { 
  color: #94a3b8; 
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
}

.site-footer a:hover { 
  color: #60a5fa; 
  text-decoration: underline;
  transform: translateX(2px);
}

.footer-col li { 
  margin: 0.5rem 0; 
  transition: all 0.3s ease;
}

.footer-col li:hover {
  transform: translateX(4px);
}

.footer-sep { 
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(148, 163, 184, 0.3) 20%, rgba(148, 163, 184, 0.3) 80%, transparent 100%);
  opacity: 1;
  margin: 2.5rem 0;
}

.footer-links a { 
  color: #94a3b8;
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
}

.footer-links a:hover { 
  color: #60a5fa;
  border-bottom-color: #60a5fa;
  transform: none;
}

.social-btn { 
  display: inline-flex; 
  align-items: center; 
  gap: 0.5rem; 
  background: rgba(255,255,255,0.05);
  color: #94a3b8; 
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; 
  padding: 0.75rem 1rem; 
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.social-btn:hover { 
  background: rgba(96, 165, 250, 0.1);
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(96, 165, 250, 0.15);
}

.social-btn i {
  font-size: 1.1rem;
}

/* Bottom Footer Section */
.row.gy-3.align-items-center {
  padding-top: 1.5rem;
}

.text-secondary {
  color: #64748b !important;
  font-weight: 500;
}

/* Copyright year animation */
.text-secondary::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  background: #60a5fa;
  border-radius: 50%;
  margin-right: 0.5rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* reCAPTCHA notice */
.row.mt-3 .small {
  color: #64748b;
  text-align: center;
  font-size: 0.8rem;
  opacity: 0.8;
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin-top: 1.5rem;
}

/* ===== CSS เดิมส่วนที่เหลือทั้งหมด ===== */
/* 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;
  margin: 0 auto;
}

