/* ===== PRODUCTS MANAGEMENT STYLES ===== */

/* Shop Quality Badges */
.shop-quality-section {
  margin-bottom: 2rem;
}

.quality-badges-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid #e3e6f0;
}

.quality-badges-card h5 {
  color: #2c3e50;
  font-weight: 600;
  margin-bottom: 1rem;
}

.quality-badges-card h5 i {
  color: #f39c12;
  margin-right: 8px;
}

.quality-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.quality-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 25px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
}

.quality-badge i {
  margin-right: 6px;
  font-size: 0.875rem;
}

.quality-badge--verified {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: white;
}

.quality-badge--partner {
  background: linear-gradient(135deg, #3498db, #5dade2);
  color: white;
}

.quality-badge--certified {
  background: linear-gradient(135deg, #f39c12, #f4d03f);
  color: white;
}

.quality-badge--organic {
  background: linear-gradient(135deg, #8e44ad, #bb8fce);
  color: white;
}

/* Product Tabs */
.product-tabs {
  margin-top: 2rem;
}

.product-tabs .nav-tabs {
  border: none;
  margin-bottom: 2rem;
}

.product-tabs .nav-link {
  border: none;
  border-radius: 12px 12px 0 0;
  background: #f8f9fa;
  color: #6c757d;
  font-weight: 600;
  padding: 1rem 1.5rem;
  margin-right: 0.5rem;
  transition: all 0.3s ease;
  position: relative;
}

.product-tabs .nav-link.active {
  background: #fff;
  color: var(--thm-primary);
  border-bottom: 3px solid var(--thm-primary);
}

.product-tabs .nav-link:hover {
  background: #e9ecef;
  color: var(--thm-primary);
}

.product-tabs .nav-link i {
  margin-right: 8px;
  font-size: 1.1rem;
}

.product-tabs .badge {
  font-size: 0.75rem;
}

/* Product Sections */
.product-section {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid #e3e6f0;
  height: fit-content;
}

.product-section__header {
  padding: 1.5rem;
  border-bottom: 1px solid #e3e6f0;
  display: flex;
  justify-content: between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.product-section__header h3 {
  color: #2c3e50;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
}

.product-section__header h3 i {
  margin-right: 10px;
  color: var(--thm-primary);
}

.product-section__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.product-section__content {
  padding: 1.5rem;
  min-height: 400px;
}

/* Category Search */
.category-search .input-group {
  border-radius: 8px;
  overflow: hidden;
}

.category-search .form-control {
  border-right: none;
  border-radius: 8px 0 0 8px;
}

.category-search .btn {
  border-left: none;
  border-radius: 0 8px 8px 0;
}

/* Category Items */
.category-item {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.category-item:hover {
  background: #e3f2fd;
  border-color: var(--thm-primary);
  transform: translateY(-2px);
}

.category-item.active {
  background: #dde4bb;
  border-color: #dde4bb;
}

.category-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.category-item__name {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
}

.category-item__actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.category-item:hover .category-item__actions {
  opacity: 1;
}

.category-item.active .category-item__actions {
  opacity: 1;
}

.category-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-action-btn--edit {
  background: #ffc107;
  color: white;
}

.category-action-btn--delete {
  background: #dc3545;
  color: white;
}

.category-action-btn:hover {
  transform: scale(1.1);
}

.category-item__info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: #6c757d;
}

.category-item.active .category-item__info {
  color: black;
}

.category-item__count {
  background: #e9ecef;
  color: #495057;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.category-item.active .category-item__count {
  background: rgba(255, 255, 255, 0.2);
  color: black;
}

/* Loading States */
.category-loading,
.products-loading {
  text-align: center;
  padding: 3rem 1rem;
  color: #6c757d;
}

.category-loading i,
.products-loading i {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--thm-primary);
}

/* Empty States */
.products-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #6c757d;
}

.empty-state__icon {
  font-size: 4rem;
  color: #dee2e6;
  margin-bottom: 1.5rem;
}

.products-empty-state h4 {
  color: #495057;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.products-empty-state p {
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* Product Filters */
.products-filters {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e9ecef;
}

.products-filters .form-control,
.products-filters .form-select {
  border-radius: 6px;
  border: 1px solid #ced4da;
  transition: border-color 0.2s ease;
}

.products-filters .form-control:focus,
.products-filters .form-select:focus {
  border-color: var(--thm-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--thm-primary-rgb), 0.25);
}

/* Product Grid View */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 1rem 0;
}
.product-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  border: 1px solid #e3e6f0;
  transition: all 0.3s ease;
  position: relative;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.product-card__image {
  height: 200px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.product-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-card__image img {
  transform: scale(1.05);
}

.product-card__image-placeholder {
  color: #dee2e6;
  font-size: 3rem;
}

.product-card__badges {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.product-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  backdrop-filter: blur(10px);
}

.product-badge--verified {
  background: rgba(39, 174, 96, 0.9);
}

.product-badge--partner {
  background: rgba(52, 152, 219, 0.9);
}

.product-badge--new {
  background: rgba(241, 196, 15, 0.9);
}

.product-badge--sale {
  background: rgba(231, 76, 60, 0.9);
}

.product-card__actions {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.product-card:hover .product-card__actions {
  opacity: 1;
}

.product-action-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.product-action-btn--view {
  background: rgba(52, 152, 219, 0.9);
}

.product-action-btn--edit {
  background: rgba(255, 193, 7, 0.9);
}

.product-action-btn--delete {
  background: rgba(220, 53, 69, 0.9);
}

.product-action-btn:hover {
  transform: scale(1.1);
}

.product-card__content {
  padding: 1.25rem;
}

.product-card__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__sku {
  font-size: 0.8rem;
  color: #6c757d;
  margin-bottom: 0.75rem;
  font-family: "Courier New", monospace;
}

.product-card__price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--thm-primary);
  margin-bottom: 0.75rem;
}

.product-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: #6c757d;
}

.product-card__stock {
  display: flex;
  align-items: center;
}

.product-card__stock i {
  margin-right: 4px;
}

.product-card__status {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.product-status--active {
  background: #d4edda;
  color: #155724;
}

.product-status--inactive {
  background: #f8d7da;
  color: #721c24;
}

.product-status--out-of-stock {
  background: #fff3cd;
  color: #856404;
}

/* Product List View */
.products-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.product-list-item {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid #e3e6f0;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.product-list-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.product-list-item__image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-list-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-list-item__content {
  flex: 1;
  min-width: 0;
}

.product-list-item__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.product-list-item__sku {
  font-size: 0.8rem;
  color: #6c757d;
  margin-bottom: 0.5rem;
  font-family: "Courier New", monospace;
}

.product-list-item__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.product-list-item__price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--thm-primary);
}

.product-list-item__actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Pagination */
.products-pagination {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #e3e6f0;
}

.products-pagination .pagination {
  margin: 0;
}

.products-pagination .page-link {
  border-radius: 8px;
  margin: 0 2px;
  border: 1px solid #e3e6f0;
  color: #6c757d;
  transition: all 0.2s ease;
}

.products-pagination .page-link:hover {
  background: var(--thm-primary);
  border-color: var(--thm-primary);
  color: white;
}

.products-pagination .page-item.active .page-link {
  background: var(--thm-primary);
  border-color: var(--thm-primary);
}

/* View Toggle Buttons */
.btn-group .thm-btn.active {
  background: var(--thm-primary);
  border-color: var(--thm-primary);
  color: white;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 cột trên tablet */
  }

  .product-section__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .product-section__actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: 1fr; /* 1 cột trên mobile */
    gap: 1rem;
  }

  .product-list-item {
    flex-direction: column;
    align-items: flex-start;
    text-align: center;
  }

  .product-list-item__image {
    align-self: center;
  }

  .product-list-item__meta {
    justify-content: center;
  }

  .product-list-item__actions {
    align-self: center;
  }

  .quality-badges {
    justify-content: center;
  }

  .product-section__content {
    padding: 1rem;
  }

  .products-filters .row {
    --bs-gutter-x: 0.5rem;
  }
}

@media (max-width: 576px) {
  .admin-page-header__actions {
    flex-direction: column;
    width: 100%;
  }

  .admin-page-header__actions .dropdown {
    width: 100%;
  }

  .admin-page-header__actions .dropdown .thm-btn {
    width: 100%;
    justify-content: center;
  }

  .product-tabs .nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .product-section__header h3 {
    font-size: 1.1rem;
  }
}

/* Animation Classes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.3s ease-out;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.pulse {
  animation: pulse 2s infinite;
}

/* Loading Spinner */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
}

/* Custom Scrollbar */
.product-section__content::-webkit-scrollbar {
  width: 6px;
}

.product-section__content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.product-section__content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.product-section__content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* View Product Modal Styles */
.product-image-gallery .main-image {
  border: 1px solid #e3e6f0;
  border-radius: 8px;
  overflow: hidden;
}

.product-image-gallery .main-image img {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.product-image-gallery .main-image img:hover {
  transform: scale(1.05);
}

.image-thumbnails {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.image-thumbnail {
  width: 60px;
  height: 60px;
  border: 2px solid #e3e6f0;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.image-thumbnail:hover,
.image-thumbnail.active {
  border-color: var(--thm-primary);
}

.image-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.price-units-view {
  display: grid;
  gap: 0.75rem;
}

.price-unit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid #e3e6f0;
  border-radius: 8px;
  background: #f8f9fa;
}

.price-unit-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.price-unit-label {
  font-weight: 600;
  color: var(--thm-primary);
}

.price-unit-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: #2c3e50;
}

.price-unit-stock {
  font-size: 0.9rem;
  color: #6c757d;
}

.specifications-view {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #e3e6f0;
}

.spec-line {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  border-bottom: 1px solid #e9ecef;
}

.spec-line:last-child {
  border-bottom: none;
}

.spec-label {
  font-weight: 600;
  color: #495057;
  flex-shrink: 0;
  margin-right: 1rem;
}

.spec-value {
  color: #6c757d;
  text-align: right;
}

/* Product Status Badges in View */
.product-status--active {
  background-color: #d4edda !important;
  color: #155724 !important;
}

.product-status--inactive {
  background-color: #f8d7da !important;
  color: #721c24 !important;
}

.product-status--out_of_stock {
  background-color: #fff3cd !important;
  color: #856404 !important;
}

.product-status--pending_approval {
  background-color: #d1ecf1 !important;
  color: #0c5460 !important;
}

/* View Product Modal Styles - FIXED ALIGNMENT */
.product-meta {
  display: flex;
  align-items: center; /* ← THÊM DÒNG NÀY */
  gap: 0.75rem !important; /* Tăng gap một chút */
  margin-bottom: 1rem;
}

.product-meta .badge {
  display: inline-flex;
  align-items: center; /* ← THÊM DÒNG NÀY */
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1; /* ← THÊM DÒNG NÀY */
}

/* Specific styling for SKU badge */
#viewProductSku {
  background-color: #6f42c1 !important;
  color: white !important;
}

/* Ensure badges in product meta are properly aligned */
.product-meta > * {
  display: flex;
  align-items: center;
}

/* Product badges container alignment */
#viewProductBadges {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem;
}

#viewProductBadges .product-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1;
}

/* View Toggle Button States */
.btn-group .thm-btn.active {
  background: var(--thm-primary) !important;
  color: white !important;
  border-color: var(--thm-primary) !important;
}

.btn-group .thm-btn {
  border-radius: 0;
}

.btn-group .thm-btn:first-child {
  border-top-left-radius: 0.375rem;
  border-bottom-left-radius: 0.375rem;
  border-right-width: 0;
}

.btn-group .thm-btn:last-child {
  border-top-right-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
  border-left-width: 1px;
}

/* Product Section Header Improvements */
.product-section__actions {
  display: flex;
  align-items: center;
  gap: 1rem; /* Increased gap */
  flex-wrap: wrap;
}

.product-section__actions .btn-group {
  display: flex;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  overflow: hidden;
}

.product-section__actions .btn-group .thm-btn {
  border-radius: 0 !important;
  border: none;
  border-right: 1px solid #dee2e6;
  margin: 0;
}

.product-section__actions .btn-group .thm-btn:last-child {
  border-right: none;
}

.product-section__actions .btn-group .thm-btn:hover {
  z-index: 2;
  position: relative;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .product-section__actions {
    gap: 0.5rem;
  }

  .product-section__actions > * {
    flex-shrink: 0;
  }
}
