/* News Categories Grid - 4 columns */
.news-categories-grid {
  margin-bottom: 40px !important;
  padding-top: 40px !important;
  display: block !important;
  visibility: visible !important;
  position: relative !important;
  z-index: 1 !important;
}

.news-categories-grid .section-title {
  font-size: 24px !important;
  font-weight: 700 !important;
  color: #000 !important;
  text-transform: uppercase !important;
  margin-bottom: 30px !important;
  text-align: center !important;
  padding: 0 20px !important;
  height: 50px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 10px 0px 0px 0px !important;
  background: linear-gradient(60deg, #faaf40 320px, #f8f8f8 320px) !important;
  visibility: visible !important;
}

.categories-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  grid-gap: 20px !important;
  visibility: visible !important;
  position: relative !important;
}

.categories-grid .category-item {
  background: #fff !important;
  border: 1px solid #ddd !important;
  border-radius: 8px !important;
  padding: 20px !important;
  text-align: center !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
  display: block !important;
  visibility: visible !important;
  position: relative !important;
  z-index: 2 !important;
}

.categories-grid .category-item:hover {
  transform: translateY(-5px) !important;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
  border-color: #faaf40 !important;
}

.categories-grid .category-item a {
  text-decoration: none !important;
  color: inherit !important;
  display: block !important;
  visibility: visible !important;
}

.categories-grid .category-content .category-name {
  font-size: 16px !important;
  font-weight: 600 !important;
  color: #333 !important;
  margin: 0 !important;
  transition: color 0.3s ease !important;
  display: block !important;
  visibility: visible !important;
}

.categories-grid .category-item:hover .category-name {
  color: #faaf40;
}

/* News Content Section */
.news-content-section {
  margin-top: 20px;
}

/* Sidebar styles - DEPRECATED - Will be removed */
.news-categories-menu {
  display: none !important;
}

.sidebar-title {
  display: none !important;
}

.categories-list {
  display: none !important;
}

/* Override old category-item styles that might conflict */
.category-item:not(.categories-grid .category-item) {
  display: none !important;
}

.products-new-block {
  display: none !important;
}

/* Force display for new category items */
.categories-grid .category-item {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.products-new-block .sidebar-title {
  border-bottom: 2px solid #28a745;
}

/* Style cho block sản phẩm trong sidebar */
.products-new-block .danh-sach-san-pham,
.products-new-block .danh-sach-san-pham-1 {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.products-new-block .item {
  padding: 10px;
  background: white;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  width: 100% !important;
}

.products-new-block .item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.products-new-block .item img {
  width: 100% !important;
  height: 120px !important;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 8px !important;
}

.products-new-block .item .p-name {
  font-size: 14px !important;
  line-height: 1.3;
  margin-bottom: 5px !important;
  height: auto !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.products-new-block .item .code-product {
  font-size: 12px !important;
  margin-bottom: 0 !important;
}

/* Products New Block Styles */
.products-new-block {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.products-new-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.product-new-item {
  display: flex;
  align-items: flex-start;
  background: #fff;
  border-radius: 6px;
  padding: 12px;
  border: 1px solid #e0e6ed;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.product-new-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #007bff;
}

.product-image {
  width: 70px;
  height: 70px;
  overflow: hidden;
  border-radius: 6px;
  flex-shrink: 0;
  margin-right: 12px;
  margin-top: 2px;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-new-item:hover .product-image img {
  transform: scale(1.05);
}

.product-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 70px;
}

.product-name {
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
  font-weight: 500;
  padding-top: 2px;
}

.product-name a {
  color: #333;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.3s ease;
  line-height: 1.3;
}

.product-name a:hover {
  color: #007bff;
}

.no-products {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 20px;
  margin: 0;
}

/* News Sort Bar - Updated for new layout */
.news-sort-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding: 20px;
  background: #f8f8f8;
  border-radius: 8px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: #000;
  text-transform: uppercase;
  margin: 0;
}

.sort-options {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-options label {
  font-weight: 600;
  color: #333;
}

.sort-options select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #fff;
  font-size: 14px;
  outline: none;
}

.sort-options select:focus {
  border-color: #faaf40;
  box-shadow: 0 0 5px rgba(250, 175, 64, 0.3);
}

/* News Grid - 2 columns layout */
.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-gap: 30px;
}

.news-grid .news-item {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: row;
}

.news-grid .news-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: #faaf40;
}

.news-grid .news-image {
  overflow: hidden;
  height: 200px;
  width: 250px;
  flex-shrink: 0;
}

.news-grid .news-image a {
  display: block;
  height: 100%;
}

.news-grid .news-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.news-grid .news-item:hover .news-image img {
  transform: scale(1.05);
}

.news-grid .news-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-grid .news-title {
  margin-bottom: 15px;
  font-size: 18px;
  font-weight: bold;
}

.news-grid .news-title a {
  color: #333;
  text-decoration: none;
  font-weight: 600;
  line-height: 1.4;
  transition: color 0.3s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-grid .news-title a:hover {
  color: #faaf40;
}

.news-grid .news-meta {
  margin-bottom: 15px;
}

.news-grid .news-time {
  color: #999;
  font-size: 14px;
  font-style: italic;
}

.news-grid .news-summary {
  color: #666;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-grid .news-read-more {
  margin-top: auto;
}

.news-grid .news-read-more a {
  color: #faaf40;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: color 0.3s ease;
}

.news-grid .news-read-more a:hover {
  color: #333;
}

.news-grid .news-read-more i {
  margin-left: 5px;
  transition: transform 0.3s ease;
}

.news-grid .news-read-more a:hover i {
  transform: translateX(3px);
}

.news-grid .no-news {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 16px;
}

/* Pagination */
.pagination-wrapper {
  margin-top: 40px;
  text-align: center;
}

.pagination-wrapper .pagination {
  display: inline-flex;
  gap: 5px;
  justify-content: center;
  align-items: center;
}

.pagination-wrapper .pagination a,
.pagination-wrapper .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #333;
  text-decoration: none;
  transition: all 0.3s ease;
  min-width: 40px;
  height: 40px;
}

.pagination-wrapper .pagination a:hover {
  background: #faaf40;
  border-color: #faaf40;
  color: #fff;
}

.pagination-wrapper .pagination .current {
  background: #faaf40;
  border-color: #faaf40;
  color: #fff;
  font-weight: 600;
}

/* Loading states */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Category active state */
.category-item a.active {
  background: #007bff;
  color: white;
}

/* Image lazy loading */
.news-image img.lazy {
  opacity: 0;
  transition: opacity 0.3s;
}

.news-image img:not(.lazy) {
  opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
  /* Categories Grid - Mobile */
  .news-categories-grid {
    padding-top: 20px;
    margin-bottom: 30px;
  }

  .news-categories-grid .section-title {
    font-size: 18px;
    height: 40px;
    margin-bottom: 20px;
    background: linear-gradient(60deg, #faaf40 80%, #f8f8f8 80%);
  }

  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 15px;
  }

  .categories-grid .category-item {
    padding: 15px;
  }

  .categories-grid .category-content .category-name {
    font-size: 14px;
  }

  /* News Content - Mobile */
  .news-sort-bar {
    flex-direction: column;
    gap: 15px;
    text-align: center;
    padding: 15px;
  }

  .page-title {
    font-size: 18px;
  }

  .sort-options {
    flex-direction: column;
    gap: 8px;
  }

  /* News Grid - Mobile */
  .news-grid {
    grid-template-columns: 1fr;
    grid-gap: 20px;
  }

  .news-grid .news-item {
    flex-direction: column;
  }

  .news-grid .news-image {
    height: 200px;
    width: 100%;
  }

  .news-grid .news-content {
    padding: 15px;
  }

  .news-grid .news-title a {
    font-size: 16px;
  }

  .news-grid .news-summary {
    font-size: 13px;
  }

  /* Hide old layout elements */
  .news-layout {
    display: none;
  }

  .news-sidebar-left {
    display: none;
  }

  .news-main-content {
    display: none;
  }
}

@media (max-width: 480px) {
  .categories-grid {
    grid-template-columns: 1fr;
    grid-gap: 10px;
  }

  .categories-grid .category-item {
    padding: 12px;
  }

  .news-grid {
    grid-gap: 15px;
  }

  .news-grid .news-image {
    height: 180px;
    width: 100%;
  }

  .news-grid .news-content {
    padding: 12px;
  }
}
