@import url("https://fonts.googleapis.com/css2?family=Kantumruy+Pro:wght@400;500;600;700&family=Merriweather:wght@400;700;900&family=Inter:wght@400;500;600;700&display=swap");

:root {
  --brand-navy: #14213d;
  --brand-red: #b3122a;
  --brand-gold: #d9a441;
  --bg-soft: #f7f6f3;
}

body {
  font-family: "Inter", "Kantumruy Pro", sans-serif;
  background-color: var(--bg-soft);
  color: #1f2328;
}

/* Khmer text always gets the Khmer-capable stack layered on top, even when
   mixed into an otherwise-English page (e.g. an English UI showing a Khmer
   article title in a related-articles widget). */
:lang(km),
.khmer-text {
  font-family: "Kantumruy Pro", "Inter", sans-serif;
}

h1, h2, h3, h4, h5,
.font-serif {
  font-family: "Merriweather", "Kantumruy Pro", serif;
}

a {
  text-decoration: none;
}

/* Baseline safety net: no <img> should ever be able to force horizontal
   overflow on its own, regardless of its native pixel dimensions or
   whether a more specific rule happens to cover it. */
img {
  max-width: 100%;
  height: auto;
}

/* Bootstrap's .breadcrumb is display:flex, and a flex item's default
   min-width:auto stops text-truncate's ellipsis from ever kicking in — the
   item just grows to its full untruncated width and pushes the whole page
   wider on narrow screens. min-width:0 lets it actually shrink. */
.breadcrumb-current {
  min-width: 0;
  max-width: 100%;
}
@media (min-width: 576px) {
  .breadcrumb-current {
    max-width: 300px;
  }
}

/* ---------- Colorful icon chips ---------- */
/* A shared palette so every icon across the site — nav, sidebar widgets,
   admin panel, footer — reads as one system rather than one-off colors.
   Hover interactivity is driven by the nearest link/button, not the chip
   itself, so a chip sitting next to label text still reacts to the whole
   row being hovered. */
.icon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.55rem;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.icon-chip-sm {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 0.45rem;
  font-size: 0.85rem;
}
.icon-chip-lg {
  width: 3rem;
  height: 3rem;
  border-radius: 0.8rem;
  font-size: 1.3rem;
}

a:hover .icon-chip,
button:hover .icon-chip,
.icon-interactive:hover .icon-chip {
  transform: scale(1.14);
  filter: brightness(1.08);
  box-shadow: 0 0.35rem 0.65rem -0.25rem rgba(0, 0, 0, 0.35);
}

.icon-indigo { background: rgba(99, 102, 241, 0.15); color: #4f46e5; }
.icon-blue { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.icon-cyan { background: rgba(6, 182, 212, 0.15); color: #0e7490; }
.icon-violet { background: rgba(139, 92, 246, 0.15); color: #7c3aed; }
.icon-teal { background: rgba(20, 184, 166, 0.15); color: #0d9488; }
.icon-orange { background: rgba(249, 115, 22, 0.16); color: #c2410c; }
.icon-pink { background: rgba(236, 72, 153, 0.15); color: #db2777; }
.icon-emerald { background: rgba(16, 185, 129, 0.15); color: #059669; }
.icon-amber { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.icon-rose { background: rgba(244, 63, 94, 0.15); color: #be123c; }
.icon-red { background: rgba(220, 38, 38, 0.14); color: #b91c1c; }
.icon-gold { background: rgba(217, 164, 65, 0.2); color: #9a6b1e; }
.icon-sky { background: rgba(14, 165, 233, 0.15); color: #0369a1; }

/* Nav links: icon chip + label, vertically centered, chip lifts on hover
   via the a:hover rule above. */
.icon-nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

/* ---------- Top utility bar + header ---------- */
.topbar {
  background: var(--brand-navy);
  color: #fff;
  font-size: 0.8rem;
}
.topbar a {
  color: #cbd5e1;
}
.topbar a:hover {
  color: #fff;
}

.site-header .brand-name {
  font-family: "Merriweather", serif;
  font-weight: 900;
  font-size: clamp(1.2rem, 4.5vw, 1.75rem);
  color: var(--brand-navy);
  letter-spacing: -0.02em;
}
.site-header .brand-tagline {
  font-size: 0.75rem;
  color: #6b7280;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- Sticky main nav ---------- */
.main-nav {
  background: #fff;
  border-top: 3px solid var(--brand-red);
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.main-nav .nav-link {
  color: var(--brand-navy);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.85rem 1rem;
}
.main-nav .nav-link.active,
.main-nav .nav-link:hover {
  color: var(--brand-red);
}
.main-nav .navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(179, 18, 42, 0.15);
}
/* Scoped to the same max-width Bootstrap itself uses for .navbar-expand-lg
   — an earlier unscoped `display: flex` here matched Bootstrap's own
   `.navbar-expand-lg .navbar-toggler { display: none }` in specificity, and
   because this stylesheet loads after bootstrap.min.css, it won permanently,
   leaving the hamburger button visible even on desktop. */
@media (max-width: 991.98px) {
  .main-nav .navbar-toggler {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: var(--brand-navy);
    padding: 0.4rem 0.75rem;
  }
  .main-nav .navbar-collapse {
    border-top: 1px solid #e5e7eb;
    padding: 0.5rem 0 0.75rem;
  }
  .main-nav .nav-item {
    width: 100%;
  }
  .main-nav .dropdown-menu {
    border: none;
    padding-left: 1rem;
    box-shadow: none;
  }
}

/* ---------- Article cards ---------- */
.article-card {
  background: #fff;
  border: 1px solid #e9e6df;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  height: 100%;
}
.article-card:hover {
  box-shadow: 0 0.5rem 1.25rem rgba(20, 33, 61, 0.1);
  transform: translateY(-2px);
}
/* Not scoped to .article-card: the same "thumbnail in a fixed-ratio box"
   pattern is reused unwrapped in Related Articles, and a scoped rule there
   let raw <img> tags render at their native pixel size — 800px seed
   placeholders blowing well past a 375px mobile viewport. */
.card-img-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #eee;
}
.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.category-badge {
  background: var(--brand-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.6rem;
  border-radius: 0.25rem;
  display: inline-block;
}
.article-card .card-title a {
  color: var(--brand-navy);
}
.article-card .card-title a:hover {
  color: var(--brand-red);
}
.article-meta {
  font-size: 0.78rem;
  color: #6b7280;
}

/* ---------- Sidebar ---------- */
.sidebar-widget {
  background: #fff;
  border: 1px solid #e9e6df;
  border-radius: 0.5rem;
  padding: 1.1rem;
  margin-bottom: 1.25rem;
}
.sidebar-widget h5 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--brand-red);
  padding-bottom: 0.5rem;
  margin-bottom: 0.85rem;
  color: var(--brand-navy);
}
.category-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px dashed #e5e7eb;
  color: var(--brand-navy);
  font-weight: 500;
}
.category-list-item:last-child {
  border-bottom: none;
}
.category-list-item:hover {
  color: var(--brand-red);
}
.category-list-item.active {
  color: var(--brand-red);
  font-weight: 700;
}
.category-count {
  background: #f1f0eb;
  color: #6b7280;
  border-radius: 1rem;
  font-size: 0.72rem;
  padding: 0.05rem 0.5rem;
}
.hotnews-item {
  display: flex;
  gap: 0.65rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f0efe9;
}
.hotnews-item:last-child {
  border-bottom: none;
}
.hotnews-thumb {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 0.3rem;
  flex-shrink: 0;
  background: #eee;
}
.hotnews-rank {
  font-family: "Merriweather", serif;
  font-weight: 900;
  color: var(--brand-gold);
  font-size: 1.1rem;
  width: 1.5rem;
  flex-shrink: 0;
}

/* ---------- Article detail page ---------- */
.article-featured-img {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: 0.5rem;
}
.article-content {
  font-size: 1.08rem;
  line-height: 1.85;
}
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.4rem;
}
.article-content table {
  width: 100%;
  border-collapse: collapse;
}
.article-content table td,
.article-content table th {
  border: 1px solid #dee2e6;
  padding: 0.5rem;
}

/* ---------- Footer ---------- */
footer.site-footer {
  background: var(--brand-navy);
  color: #cbd5e1;
}
footer.site-footer h6 {
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}
footer.site-footer a {
  color: #cbd5e1;
}
footer.site-footer a:hover {
  color: #fff;
}
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  margin-right: 0.4rem;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.social-icon:hover {
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 0.4rem 0.75rem -0.2rem rgba(0, 0, 0, 0.4);
}
/* Each platform keeps its own recognizable brand color on hover, rather
   than flattening every icon to the same site accent color. */
.social-facebook:hover { background: #1877f2; }
.social-x:hover { background: #000; }
.social-youtube:hover { background: #ff0000; }
.social-telegram:hover { background: #29a9eb; }

/* ---------- Admin panel ---------- */
/* Below lg, #adminSidebar is a Bootstrap offcanvas (fixed slide-in drawer);
   at lg+ it resets to a plain static block, per Bootstrap's own responsive
   offcanvas CSS. The navy background lives on this nested div rather than
   the offcanvas element itself, which Bootstrap forces transparent at lg+. */
.admin-sidebar-header {
  background: var(--brand-navy);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.admin-sidebar {
  background: var(--brand-navy);
  min-height: 100vh;
  width: 240px;
}
.admin-sidebar .nav-link {
  color: #cbd5e1;
  font-weight: 500;
  border-radius: 0.4rem;
  margin-bottom: 0.2rem;
}
.admin-sidebar .nav-link.active,
.admin-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.admin-sidebar .nav-link-logout {
  font-size: 1rem;
  padding: 0.5rem 1rem;
}
.admin-sidebar .nav-link-logout:hover {
  background: rgba(220, 38, 38, 0.18);
  color: #fecaca;
}
.admin-content {
  flex: 1;
  min-width: 0;
}
.stat-card {
  background: #fff;
  border-radius: 0.6rem;
  border: 1px solid #e9e6df;
  padding: 1.25rem;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand-navy);
}
.auth-card {
  max-width: 420px;
  margin: 4rem auto;
}
