/* ==================== PRODUCT CATEGORY WIDGET ==================== */

/* Base */
.product-category-widget {
  background: #fff;
  overflow: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.product-category-widget::-webkit-scrollbar,
.product-category-widget .category-content::-webkit-scrollbar {
  display: none;
}

.product-category-widget .category-content {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Section */
.product-category-widget .category-section {
  border-bottom: 1px solid #e5e7eb;
}

.product-category-widget .category-section:last-child {
  border-bottom: none;
}

/* Header */
.product-category-widget .category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  transition: all 0.3s ease;
  user-select: none;
  position: relative;
}

.product-category-widget .category-header:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

.product-category-widget .category-header:active {
  transform: scale(0.98);
}

.product-category-widget .category-name {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Toggle Icon */
.product-category-widget .toggle-icon {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
}

.product-category-widget .category-header:hover .toggle-icon {
  background: rgba(255, 255, 255, 0.25);
}

.product-category-widget .toggle-icon svg {
  display: block;
  pointer-events: none;
  transition: transform 0.3s ease;
}

.product-category-widget .category-header.collapsed .toggle-icon {
  transform: rotate(-180deg);
}

/* Content */
.product-category-widget .category-content {
  overflow: hidden;
  padding: 8px;
  background: #fff;
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease, padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-category-widget .category-content > * {
  overflow: hidden;
}

.product-category-widget .category-content.collapsed {
  grid-template-rows: 0fr;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* Items Grid */
.product-category-widget .category-items-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.product-category-widget
  .category-content:not(.collapsed)
  .category-items-grid {
  animation: fadeInItems 0.4s ease-out;
}

/* Item */
.product-category-widget .category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: #fff;
  border: 1px solid transparent;
}

.product-category-widget .category-content:not(.collapsed) .category-item {
  animation: slideInItem 0.35s ease-out backwards;
}

.product-category-widget
  .category-content:not(.collapsed)
  .category-item:nth-child(1) {
  animation-delay: 0.02s;
}
.product-category-widget
  .category-content:not(.collapsed)
  .category-item:nth-child(2) {
  animation-delay: 0.04s;
}
.product-category-widget
  .category-content:not(.collapsed)
  .category-item:nth-child(3) {
  animation-delay: 0.06s;
}
.product-category-widget
  .category-content:not(.collapsed)
  .category-item:nth-child(4) {
  animation-delay: 0.08s;
}
.product-category-widget
  .category-content:not(.collapsed)
  .category-item:nth-child(5) {
  animation-delay: 0.1s;
}
.product-category-widget
  .category-content:not(.collapsed)
  .category-item:nth-child(6) {
  animation-delay: 0.12s;
}
.product-category-widget
  .category-content:not(.collapsed)
  .category-item:nth-child(7) {
  animation-delay: 0.14s;
}
.product-category-widget
  .category-content:not(.collapsed)
  .category-item:nth-child(8) {
  animation-delay: 0.16s;
}
.product-category-widget
  .category-content:not(.collapsed)
  .category-item:nth-child(9) {
  animation-delay: 0.18s;
}
.product-category-widget
  .category-content:not(.collapsed)
  .category-item:nth-child(10) {
  animation-delay: 0.2s;
}
.product-category-widget
  .category-content:not(.collapsed)
  .category-item:nth-child(11) {
  animation-delay: 0.22s;
}
.product-category-widget
  .category-content:not(.collapsed)
  .category-item:nth-child(12) {
  animation-delay: 0.24s;
}

.product-category-widget .category-item:hover {
  background: #fef2f2;
  border-color: #fecaca;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.1);
}

.product-category-widget .item-image {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  overflow: hidden;
  border-radius: 6px;
  background: #f9fafb;
}

.product-category-widget .item-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-category-widget .item-name {
  font-size: 11px;
  color: #374151;
  text-align: center;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  font-weight: 500;
}

.product-category-widget .category-item:hover .item-name {
  color: #dc2626;
}

.product-category-widget .no-categories {
  color: #6b7280;
  font-size: 13px;
  text-align: center;
  padding: 20px;
  margin: 0;
}

/* Animations */
@keyframes fadeInItems {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInItem {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-5px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ==================== SIDEBAR CUSTOMIZATION ==================== */

.sidebar-left .widget {
  margin: 0;
  padding: 0;
}

.sidebar-left .sidebar-main-title {
  color: #000000;
  padding: 14px 16px;
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

/* ==================== USER INFO WIDGET ==================== */

.user-info-widget {
  overflow: hidden;
}

.user-info-widget .widget-title {
  font-size: 12px;
  color: #1f2937;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 0;
  margin: 0;
}

/* Contact Section */
.contact-section {
  margin-bottom: 10px;
}

.section-title {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Contact Buttons */
.contact-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid #e5e7eb;
  padding: 16px 8px;
  border-radius: 8px;
  background: #fff;
}

.btn-zalo {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s ease;
  border: none;
}

.btn-zalo.btn-contact {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
}
.btn-zalo.btn-contact:first-child {
  background: #201751;
  color: #fff;
}

/* Policy Section */
.policy-section .policy-links,
.guide-section .policy-links {
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
}

/* Policy Links */
.policy-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.policy-links li {
  margin: 0;
  padding: 0;
}

.policy-links a {
  display: block;
  color: #3b82f6;
  text-decoration: none;
  font-size: 13px;
  padding: 8px 0;
  transition: color 0.2s ease;
  position: relative;
  padding-left: 16px;
}

.policy-links a:before {
  content: "•";
  position: absolute;
  left: 0;
  color: #3b82f6;
  font-weight: bold;
}

.policy-links a:hover {
  color: #2563eb;
  text-decoration: none;
}

/* ==================== WIDGET ADMIN STYLES ==================== */

/* Links Management */
.keyball-links-container {
  margin-top: 10px;
}

.links-list {
  margin: 10px 0;
}

.link-entry {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.link-entry input {
  flex: 1;
  padding: 5px;
}

/* ==================== CART WIDGET ==================== */

.keyball-cart-widget {
  display: flex;
  flex-direction: column;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.keyball-cart-widget .cart-widget-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f5f5f5;
  max-height: 500px;
}

/* Empty Cart State */
.keyball-cart-widget .cart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: #fff;
  border-radius: 8px;
  min-height: 250px;
}

.keyball-cart-widget .cart-empty-icon {
  width: 150px;
  height: 150px;
  margin-bottom: 15px;
}

.keyball-cart-widget .cart-empty-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.keyball-cart-widget .cart-empty-message {
  font-size: 16px;
  font-weight: 600;
  color: #6b7280;
  margin: 0;
}

/* Cart Items */
.keyball-cart-widget .cart-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.keyball-cart-widget .cart-item {
  display: flex;
  align-items: center;
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.keyball-cart-widget .cart-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.keyball-cart-widget .cart-item-image {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  margin-right: 12px;
  overflow: hidden;
  border-radius: 6px;
  background: #f9fafb;
}

.keyball-cart-widget .cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.keyball-cart-widget .cart-item-details {
  flex: 1;
  min-width: 0;
}

.keyball-cart-widget .cart-item-name {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: #1f2937;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.keyball-cart-widget .cart-item-quantity {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.keyball-cart-widget .cart-item-price {
  font-size: 14px;
  font-weight: 700;
  color: #dc2626;
}

.keyball-cart-widget .cart-item-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #fee2e2;
  border: none;
  font-size: 18px;
  color: #dc2626;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.keyball-cart-widget .cart-item-remove:hover {
  background: #dc2626;
  color: #fff;
  transform: scale(1.1);
}

/* Cart Footer */
.keyball-cart-widget .cart-widget-footer {
  padding: 15px;
  background: #fff;
  border-top: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.keyball-cart-widget .cart-total {
  display: flex;
  flex-direction: column;
}

.keyball-cart-widget .cart-total-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.keyball-cart-widget .cart-total-amount {
  font-size: 18px;
  font-weight: 700;
  color: #dc2626;
}

.keyball-cart-widget .cart-checkout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

.keyball-cart-widget .cart-checkout-btn:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
  color: #fff;
}

/* Widget Title Override */
.keyball-cart-widget-container .widget-title {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  padding: 14px 16px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .keyball-cart-widget .cart-widget-footer {
    flex-direction: column;
    gap: 10px;
  }

  .keyball-cart-widget .cart-checkout-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .product-category-widget .item-image {
    width: 50px;
    height: 50px;
  }

  .product-category-widget .item-name {
    font-size: 10px;
  }

  .product-category-widget .category-header {
    padding: 12px 14px;
  }

  .product-category-widget .category-name {
    font-size: 12px;
  }

  .keyball-cart-widget .cart-item-image {
    width: 60px;
    height: 60px;
  }

  .keyball-cart-widget .cart-item-name {
    font-size: 12px;
  }

  .keyball-cart-widget .cart-empty-icon {
    width: 120px;
    height: 120px;
  }
}
