/* ==========================================================================
   Cân điện tử Thành Nhân — Theme chính
   ========================================================================== */

:root {
  --primary: #0d4c92;
  --primary-dark: #073763;
  --accent: #ff7a00;
  --accent-dark: #e56800;
  --text-dark: #1c2733;
  --text-muted: #667085;
  --bg-alt: #f5f8fb;
  --border-color: #e7ecf1;
  --radius: 14px;
  --shadow-sm: 0 2px 10px rgba(15, 40, 80, .06);
  --shadow-md: 0 10px 30px rgba(15, 40, 80, .12);
  --font-main: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-main);
  color: var(--text-dark);
  background: #fff;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: all .2s ease; }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }

.section { padding: 60px 0; }
.section.alt-bg { background: var(--bg-alt); }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
  text-align: center;
  flex-direction: column;
}
.section-title h2 {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary-dark);
  position: relative;
  padding-bottom: 14px;
  margin: 0;
}
.section-title h2::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  border-radius: 4px;
  background: var(--accent);
}
.section-title.text-start { align-items: flex-start; text-align: left; }
.section-title.text-start h2::after { left: 0; transform: none; }
.section-title .view-all {
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}
.section-title .view-all:hover { color: var(--accent); }

@media (min-width: 768px) {
  .section-title { flex-direction: row; text-align: left; align-items: flex-end; }
  .section-title h2::after { left: 0; transform: none; }
}

/* ---------- Buttons ---------- */
.btn-order {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 12px 26px;
  border-radius: 999px;
  border: none;
  box-shadow: var(--shadow-sm);
}
.btn-order:hover { background: var(--accent-dark); color: #fff; transform: translateY(-2px); }
.btn-order.btn-lg { padding: 14px 30px; font-size: 17px; margin: 18px 0; }
.btn-order-light { background: #fff; color: var(--primary-dark); }
.btn-order-light:hover { background: #f1f1f1; color: var(--primary-dark); }

/* ---------- Topbar ---------- */
.topbar { background: var(--primary-dark); color: #cfe0f5; font-size: 13px; padding: 7px 0; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.topbar-left span { margin-right: 20px; }
.topbar-left i, .topbar-right i { margin-right: 4px; }
.topbar-right a { color: #cfe0f5; margin-left: 14px; }
.topbar-right a:hover { color: var(--accent); }

/* ---------- Header ---------- */
.site-header { background: #fff; box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 1000; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo img { height: 46px; width: auto; }
.logo-text { font-weight: 800; font-size: 19px; color: var(--primary-dark); line-height: 1.15; }

.main-nav ul { display: flex; gap: 26px; }
.main-nav a { font-weight: 600; color: var(--text-dark); font-size: 15px; padding: 6px 0; position: relative; }
.main-nav a:hover { color: var(--primary); }
.nav-close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 22px; color: var(--text-dark); display: none; }

.header-actions { display: flex; align-items: center; gap: 16px; }
.search-form { position: relative; }
.search-form input {
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 9px 40px 9px 16px;
  width: 220px;
  font-size: 14px;
  background: var(--bg-alt);
}
.search-form button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: var(--primary); color: #fff; border: none; width: 30px; height: 30px; border-radius: 50%; }

.hotline { display: flex; align-items: center; gap: 10px; color: var(--primary-dark); white-space: nowrap; }
.hotline i { font-size: 26px; color: var(--accent); }
.hotline small { display: block; font-size: 11px; color: var(--text-muted); }
.hotline strong { font-size: 16px; }

.nav-toggle { background: none; border: none; font-size: 28px; color: var(--primary-dark); }
.nav-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 998; }

@media (max-width: 991.98px) {
  .main-nav {
    position: fixed;
    top: 0; right: -300px;
    width: 280px; height: 100%;
    background: #fff;
    z-index: 999;
    padding: 60px 20px 20px;
    box-shadow: -6px 0 20px rgba(0,0,0,.15);
    transition: right .3s ease;
    overflow-y: auto;
  }
  .main-nav.open { right: 0; }
  .main-nav ul { flex-direction: column; gap: 4px; }
  .main-nav a { display: block; padding: 10px 0; border-bottom: 1px solid var(--border-color); }
  .nav-close { display: block; }
  .nav-overlay.open { display: block; }
}

/* ---------- Hero Slider ---------- */
.hero-slider { background: var(--bg-alt); }
.hero-slider img { width: 100%; height: clamp(220px, 42vw, 460px); object-fit: cover; }
.hero-slider .carousel-caption { text-align: left; left: 6%; right: auto; bottom: auto; top: 18%; max-width: 480px; }
.hero-slider .carousel-caption h2 { font-size: clamp(20px, 3vw, 38px); font-weight: 800; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.hero-slider .carousel-caption p { font-size: clamp(13px, 1.4vw, 18px); text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.hero-slider .carousel-indicators [data-bs-target] { background-color: var(--accent); }

/* ---------- Features strip ---------- */
.features-strip { padding: 26px 0; border-bottom: 1px solid var(--border-color); }
.feature-item { display: flex; align-items: center; gap: 12px; justify-content: center; text-align: left; }
.feature-item i { font-size: 30px; color: var(--accent); }
.feature-item span { font-weight: 700; font-size: 14px; color: var(--primary-dark); }

/* ---------- Product cards ---------- */
.product-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease, box-shadow .25s ease;
}
.product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: transparent; }
.product-thumb { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; background: var(--bg-alt); }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.product-card:hover .product-thumb img { transform: scale(1.08); }
.badge-sale {
  position: absolute; top: 10px; left: 10px;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
}
.product-body { padding: 14px 16px 18px; flex: 1; display: flex; flex-direction: column; }
.product-name { font-size: 15px; font-weight: 600; margin: 0 0 8px; min-height: 40px; }
.product-name a:hover { color: var(--primary); }
.product-price { margin-top: auto; margin-bottom: 12px; }
.price-sale { color: var(--accent); font-weight: 800; font-size: 17px; }
.price-old { color: var(--text-muted); text-decoration: line-through; font-size: 13px; margin-left: 8px; }
.btn-buy {
  display: block; text-align: center;
  background: var(--primary); color: #fff;
  font-weight: 700; padding: 9px; border-radius: 999px; font-size: 14px;
}
.btn-buy:hover { background: var(--primary-dark); color: #fff; }

/* ---------- Why choose ---------- */
.why-list { margin: 20px 0; }
.why-list li { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; font-size: 15.5px; }
.why-list i { color: var(--accent); font-size: 18px; margin-top: 2px; }

/* ---------- News cards ---------- */
.news-card { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border-color); display: block; height: 100%; transition: box-shadow .25s ease, transform .25s ease; }
.news-card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }
.news-thumb { aspect-ratio: 16/10; overflow: hidden; background: var(--bg-alt); }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-body { padding: 16px; }
.news-date { font-size: 12px; color: var(--text-muted); }
.news-body h3 { font-size: 16px; font-weight: 700; margin: 8px 0; color: var(--text-dark); }
.news-body p { font-size: 13.5px; color: var(--text-muted); margin: 0; }
.news-card-lg { display: flex; flex-direction: row; }
.news-card-lg .news-thumb { width: 42%; aspect-ratio: auto; }
.news-card-lg .news-body { width: 58%; }

/* ---------- Testimonials ---------- */
.testimonial-card { background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius); padding: 24px; height: 100%; }
.stars { color: #ffb400; margin-bottom: 10px; }
.testimonial-card p { font-style: italic; color: var(--text-dark); min-height: 70px; }
.testimonial-author { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.testimonial-author img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.testimonial-author span { font-weight: 700; }

/* ---------- CTA agent ---------- */
.cta-agent { background: linear-gradient(120deg, var(--primary) 0%, var(--primary-dark) 100%); padding: 46px 0; color: #fff; }
.cta-agent-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.cta-agent h2 { font-weight: 800; margin: 0 0 6px; }
.cta-agent p { margin: 0; color: #d9e6f6; }

/* ---------- Breadcrumb ---------- */
.breadcrumb-bar { background: var(--bg-alt); padding: 14px 0; border-bottom: 1px solid var(--border-color); }
.breadcrumb-item a { color: var(--primary); font-weight: 600; }
.breadcrumb-item.active { color: var(--text-muted); }

/* ---------- Sidebar ---------- */
.sidebar-box { background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.sidebar-box h4 { font-size: 16px; font-weight: 700; margin-bottom: 14px; color: var(--primary-dark); }
.category-list li a { display: block; padding: 9px 0; border-bottom: 1px dashed var(--border-color); font-weight: 500; }
.category-list li:last-child a { border-bottom: none; }
.category-list li.active a, .category-list li a:hover { color: var(--accent); font-weight: 700; }
.sidebar-contact { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; text-align: center; }
.sidebar-contact h4 { color: #fff; }
.sidebar-contact p { color: #d9e6f6; font-size: 14px; }
.hotline-box { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); padding: 10px 18px; border-radius: 999px; font-weight: 700; color: #fff; margin-top: 8px; }

/* ---------- Product detail ---------- */
.product-gallery .main-image { border: 1px solid var(--border-color); border-radius: var(--radius); overflow: hidden; aspect-ratio: 1/1; background: var(--bg-alt); }
.product-gallery .main-image img { width: 100%; height: 100%; object-fit: cover; }
.thumb-list { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.thumb-list img { width: 68px; height: 68px; object-fit: cover; border-radius: 8px; border: 2px solid var(--border-color); cursor: pointer; }
.thumb-list img.active, .thumb-list img:hover { border-color: var(--accent); }
.product-title { font-size: 26px; font-weight: 800; color: var(--primary-dark); }
.product-sku { color: var(--text-muted); font-size: 14px; }
.product-price-detail { margin: 14px 0; }
.product-price-detail .price-sale { font-size: 28px; }
.product-short-desc { color: var(--text-muted); }
.quick-order-box { background: var(--bg-alt); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 22px; margin-top: 20px; }
.quick-order-box h4 { font-size: 17px; font-weight: 700; margin-bottom: 14px; color: var(--primary-dark); }
.product-full-desc { margin-top: 50px; }
.product-full-desc h3 { font-weight: 800; color: var(--primary-dark); margin-bottom: 16px; }
.content-html { line-height: 1.8; color: #33404d; }
.content-html img { border-radius: 10px; margin: 10px 0; }

/* ---------- Post detail ---------- */
.post-title { font-size: 27px; font-weight: 800; color: var(--primary-dark); }
.post-meta { display: flex; gap: 20px; flex-wrap: wrap; color: var(--text-muted); font-size: 13.5px; margin: 10px 0 20px; }
.post-thumb { width: 100%; border-radius: var(--radius); margin-bottom: 20px; }
.related-post-list li { display: block; padding: 10px 0; border-bottom: 1px dashed var(--border-color); }
.related-post-list li:last-child { border-bottom: none; }
.related-post-list a { display: flex; gap: 10px; align-items: center; }
.related-post-list img { width: 60px; height: 46px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.related-post-list span { font-size: 13.5px; font-weight: 600; }

/* ---------- Guide list ---------- */
.guide-list { display: flex; flex-direction: column; gap: 10px; }
.guide-item { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--border-color); border-radius: 12px; padding: 16px 20px; font-weight: 600; }
.guide-item:hover { border-color: var(--accent); color: var(--accent); }
.guide-item i:first-child { color: var(--primary); font-size: 18px; }

/* ---------- Contact ---------- */
.contact-info-list li { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; font-size: 15px; }
.contact-info-list i { color: var(--accent); margin-top: 3px; }
.map-frame { margin-top: 20px; }

/* ---------- Forms ---------- */
.form-control { border-radius: 10px; border: 1px solid var(--border-color); padding: 11px 14px; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(13,76,146,.12); }

/* ---------- Footer ---------- */
.site-footer { background: var(--primary-dark); color: #cbdaf0; padding: 56px 0 0; margin-top: 20px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; padding-bottom: 40px; }
.footer-logo { height: 44px; margin-bottom: 14px; filter: brightness(0) invert(1); }
.footer-about p { font-size: 14px; line-height: 1.7; margin: 6px 0; }
.footer-col h5 { color: #fff; font-weight: 700; margin-bottom: 16px; font-size: 16px; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col a { font-size: 14px; color: #cbdaf0; }
.footer-col a:hover { color: var(--accent); }
.footer-social { display: flex; gap: 10px; }
.footer-social a { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; }
.footer-social a:hover { background: var(--accent); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding: 18px 0; text-align: center; font-size: 13px; }

@media (max-width: 767.98px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 575.98px) {
  .footer-grid { grid-template-columns: 1fr; }
  .news-card-lg { flex-direction: column; }
  .news-card-lg .news-thumb, .news-card-lg .news-body { width: 100%; }
}

/* ---------- Floating actions ---------- */
.floating-actions { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 12px; z-index: 900; }
.fab { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; box-shadow: var(--shadow-md); animation: pulse 2.2s infinite; }
.fab-call { background: var(--accent); }
.fab-zalo { background: #0068ff; animation-delay: .3s; }
.fab-fb { background: #1877f2; animation-delay: .6s; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,122,0,.5); }
  70% { box-shadow: 0 0 0 14px rgba(255,122,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,122,0,0); }
}

/* ---------- Mobile bottom nav ---------- */
.mobile-bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 950;
  background: #fff;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  box-shadow: 0 -4px 18px rgba(15,40,80,.12);
  padding-bottom: env(safe-area-inset-bottom, 0);
  border-top: 1px solid var(--border-color);
}
.mobile-bottom-nav a,
.mobile-bottom-nav button {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 2px 7px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}
.mobile-bottom-nav i { font-size: 19px; }
.mobile-bottom-nav a.active,
.mobile-bottom-nav a:active,
.mobile-bottom-nav button:active { color: var(--primary); }
.mobile-bottom-nav a.active i { color: var(--primary); }
.mobile-bottom-nav-cta {
  position: relative;
  margin-top: -18px;
}
.mobile-bottom-nav-cta i {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 19px;
  box-shadow: 0 6px 14px rgba(255,122,0,.45);
}
.mobile-bottom-nav-cta span { color: var(--accent); font-weight: 700; }

@media (max-width: 991.98px) {
  body { padding-bottom: 62px; }
}
@media (min-width: 992px) {
  .mobile-bottom-nav { display: none !important; }
}

/* ---------- Error 404 ---------- */
.error-404 { padding: 90px 0; }
.error-404 h1 { font-size: 90px; font-weight: 900; color: var(--primary); margin: 20px 0; }

/* ---------- Pagination ---------- */
.pagination .page-link { color: var(--primary); border-radius: 8px !important; margin: 0 3px; border: 1px solid var(--border-color); }
.pagination .page-item.active .page-link { background: var(--accent); border-color: var(--accent); }

/* ---------- Fade-in animation ---------- */
.section, .product-card, .news-card { animation: fadeInUp .5s ease both; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Admin quick styles moved to admin.css ---------- */
