/* =============================================
   NETKEY.SHOP — HOME UI UPGRADE v4 (SAFE)
   Path: /mod/css/netkey-style.css
   Chỉ target đúng class — không đè layout gốc
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap');

/* ─── TOKENS ─── */
:root {
  --nk-font: 'Be Vietnam Pro', sans-serif;
  --nk-accent: #6366f1;
  --nk-accent-hover: #4f46e5;
  --nk-price: #ef4444;
  --nk-green: #10b981;
  --nk-orange: #f59e0b;
  --nk-radius-card: 14px;
  --nk-radius-pill: 999px;
  --nk-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --nk-shadow-hover: 0 8px 24px rgba(0,0,0,0.10);
  --nk-t: 160ms ease;
}

/* ─── FONT BASE ─── */
body { font-family: var(--nk-font) !important; }

/* ════════════════════════════════════════
   SECTION HEADER (tiêu đề + xem tất cả)
════════════════════════════════════════ */
.products-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.products-section-title {
  font-family: var(--nk-font) !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  color: var(--text-primary, #1e293b) !important;
  margin: 0 0 4px !important;
}

.products-section-subtitle {
  font-size: 13px !important;
  color: var(--text-muted, #64748b) !important;
  margin: 0 !important;
}

.btn-explore {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  background: var(--nk-accent) !important;
  color: #fff !important;
  font-family: var(--nk-font) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  padding: 9px 20px !important;
  border-radius: var(--nk-radius-pill) !important;
  text-decoration: none !important;
  white-space: nowrap;
  transition: all var(--nk-t) !important;
  flex-shrink: 0;
}
.btn-explore:hover {
  background: var(--nk-accent-hover) !important;
  color: #fff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(99,102,241,0.28) !important;
}

/* ════════════════════════════════════════
   PRODUCT CARD — chỉ target .product-item
   (class thực tế home.js render ra)
════════════════════════════════════════ */
.product-item {
  background: var(--bg-card, #fff) !important;
  border-radius: var(--nk-radius-card) !important;
  border: 1px solid var(--border-color, #e2e8f0) !important;
  box-shadow: var(--nk-shadow) !important;
  overflow: hidden !important;
  transition: transform var(--nk-t), box-shadow var(--nk-t), border-color var(--nk-t) !important;
}
.product-item:hover {
  transform: translateY(-4px) !important;
  box-shadow: var(--nk-shadow-hover) !important;
  border-color: #c7d2fe !important;
}

/* Ảnh trong card */
.product-item .product-thumbnail,
.product-item .product-img,
.product-item .card-img-top,
.product-item img {
  width: 100% !important;
  height: auto !important;           /* KHÔNG set aspect-ratio cứng */
  object-fit: cover !important;
  display: block !important;
  border-radius: 12px 12px 0 0 !important;
}

/* Tên sản phẩm */
.product-item .product-name,
.product-item .item-title {
  font-family: var(--nk-font) !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: var(--text-primary, #1e293b) !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  line-height: 1.4 !important;
  margin-bottom: 6px !important;
}

/* Giá */
.product-item .product-price,
.product-item .price-new {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: var(--nk-price) !important;
}
.product-item .price-old,
.product-item del {
  font-size: 11.5px !important;
  color: #94a3b8 !important;
  text-decoration: line-through !important;
}

/* Đã bán / giao ngay */
.product-item .item-sold {
  font-size: 11px !important;
  color: var(--text-muted, #64748b) !important;
}
.product-item .badge-instant,
.product-item .tag-instant {
  background: #d1fae5 !important;
  color: #059669 !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  padding: 2px 8px !important;
  border-radius: var(--nk-radius-pill) !important;
}

/* ════════════════════════════════════════
   SKELETON LOADING
════════════════════════════════════════ */
.product-card-skeleton {
  background: var(--bg-card, #fff);
  border-radius: var(--nk-radius-card);
  border: 1px solid var(--border-color, #e2e8f0);
  overflow: hidden;
}
.skeleton-image {
  width: 100%;
  padding-top: 62.5%; /* 16:10 ratio */
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: nk-shimmer 1.4s infinite;
}
.skeleton-content { padding: 10px 12px 14px; }
.skeleton-title, .skeleton-price {
  border-radius: 6px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: nk-shimmer 1.4s infinite;
  margin-bottom: 8px;
}
.skeleton-title { height: 13px; width: 85%; }
.skeleton-price { height: 15px; width: 45%; margin-bottom: 0; }

@keyframes nk-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ════════════════════════════════════════
   LOAD MORE BUTTON
════════════════════════════════════════ */
.products-load-more { text-align: center; margin-top: 24px; }
.btn-load-more {
  font-family: var(--nk-font) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: var(--nk-accent) !important;
  background: transparent !important;
  border: 2px solid var(--nk-accent) !important;
  border-radius: var(--nk-radius-pill) !important;
  padding: 10px 32px !important;
  cursor: pointer;
  transition: all var(--nk-t) !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-load-more:hover {
  background: var(--nk-accent) !important;
  color: #fff !important;
  transform: translateY(-1px) !important;
}

/* ════════════════════════════════════════
   CATEGORIES — filter buttons
════════════════════════════════════════ */
.home-categories-section {
  background: var(--bg-card, #fff);
  border-radius: 16px;
  padding: 18px 18px 14px;
  box-shadow: var(--nk-shadow);
  border: 1px solid var(--border-color, #e2e8f0);
  margin-bottom: 20px !important;
}
.btn-parent-category {
  font-family: var(--nk-font) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 14px !important;
  border-radius: var(--nk-radius-pill) !important;
  border: 1.5px solid var(--border-color, #e2e8f0) !important;
  background: var(--bg-card, #fff) !important;
  color: var(--text-secondary, #475569) !important;
  transition: all var(--nk-t) !important;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-parent-category:hover,
.btn-parent-category.active {
  background: var(--nk-accent) !important;
  border-color: var(--nk-accent) !important;
  color: #fff !important;
}

.category-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px;
  border-radius: 12px;
  background: var(--bg-tertiary, #f1f5f9);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--nk-t);
  min-width: 80px;
}
.category-card:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  transform: translateY(-2px);
}
.category-card-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.category-card-icon img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.category-icon-placeholder {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
}
.category-card-label {
  font-size: 11px !important; font-weight: 600 !important;
  color: var(--text-primary, #1e293b) !important;
  text-align: center; line-height: 1.3;
  max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.categories-carousel-nav {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-card, #fff);
  border: 1.5px solid var(--border-color, #e2e8f0);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-primary, #1e293b); font-size: 13px;
  transition: all var(--nk-t); flex-shrink: 0; z-index: 2;
}
.categories-carousel-nav:hover {
  background: var(--nk-accent); border-color: var(--nk-accent); color: #fff;
}

/* ════════════════════════════════════════
   ANNOUNCEMENT BAR
════════════════════════════════════════ */
.home-announcement-bar {
  background: linear-gradient(135deg, #eef2ff, #f0fdf4);
  border: 1px solid #c7d2fe; border-radius: 12px;
  padding: 12px 16px; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.announcement-icon { color: var(--nk-accent); font-size: 15px; flex-shrink: 0; }
.announcement-text { font-size: 13px; font-weight: 500; line-height: 1.5; }
.announcement-close {
  background: none; border: none; color: #64748b; cursor: pointer;
  padding: 4px; border-radius: 6px; transition: all var(--nk-t); flex-shrink: 0;
}
.announcement-close:hover { background: rgba(0,0,0,0.06); }

/* ════════════════════════════════════════
   DARK MODE
════════════════════════════════════════ */
[data-theme="dark"] .home-categories-section { border-color: var(--border-color, #334155); }
[data-theme="dark"] .category-card { background: var(--bg-tertiary, #334155); }
[data-theme="dark"] .category-card:hover { background: #312e81; border-color: #4f46e5; }
[data-theme="dark"] .btn-parent-category {
  background: var(--bg-card, #1e293b) !important;
  border-color: var(--border-color, #334155) !important;
  color: var(--text-secondary, #cbd5e1) !important;
}
[data-theme="dark"] .product-item {
  background: var(--bg-card, #1e293b) !important;
  border-color: var(--border-color, #334155) !important;
}
[data-theme="dark"] .product-item:hover { border-color: #4f46e5 !important; }
[data-theme="dark"] .home-announcement-bar {
  background: linear-gradient(135deg, #1e1b4b, #0f2d1e); border-color: #3730a3;
}
[data-theme="dark"] .skeleton-image,
[data-theme="dark"] .skeleton-title,
[data-theme="dark"] .skeleton-price {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
}

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 767px) {
  .products-section-header { flex-direction: column; align-items: flex-start; }
  .products-section-title { font-size: 17px !important; }
  .btn-explore { padding: 8px 16px !important; font-size: 12px !important; }
  .home-categories-section { padding: 14px 12px !important; }
}
@media (max-width: 480px) {
  .category-card { min-width: 64px; padding: 10px 6px; }
  .category-card-icon { width: 32px; height: 32px; }
  .category-card-icon img { width: 28px; height: 28px; }
  .category-card-label { font-size: 10px !important; max-width: 58px; }
}