/* ============================================
   Products Page Styles - Anas Plastic Enterprises
   Complete Version with Mobile Fixes
   ============================================ */

.products-section {
  padding: 60px 0;
  min-height: 60vh;
  background: #f8fafc;
}

/* ============================================
   Search and Filter Container
   ============================================ */
.search-filter-container {
  margin-bottom: 40px;
}

.search-bar {
  position: relative;
  max-width: 500px;
  margin: 0 auto 30px;
}

.search-bar input {
  width: 100%;
  padding: 15px 50px 15px 20px;
  border: 2px solid #e5e7eb;
  border-radius: 50px;
  font-size: 1rem;
  transition: all 0.3s ease;
  outline: none;
  background: white;
  color: #1f2937;
}

.search-bar input:focus {
  border-color: #1e3a8a;
  box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.1);
}

.search-bar i {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 1.2rem;
  pointer-events: none;
}

/* ============================================
   Category Filters
   ============================================ */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 0 10px;
}

.filter-btn {
  padding: 10px 22px;
  border: 2px solid #e5e7eb;
  background: white;
  color: #374151;
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: #1e3a8a;
  color: #1e3a8a;
  background: #eff6ff;
}

.filter-btn.active {
  background: #1e3a8a;
  color: white;
  border-color: #1e3a8a;
  font-weight: 600;
}

/* ============================================
   Products Grid
   ============================================ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

/* ============================================
   Product Card
   ============================================ */
.product-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  border-color: #1e3a8a;
}

/* Product Image */
.product-image {
  position: relative;
  height: 280px;
  overflow: hidden;
  background: #f9fafb;
  flex-shrink: 0;
}

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

.product-card:hover .product-image img {
  transform: scale(1.06);
}

.product-badge {
  position: absolute;
  top: 15px;
  left: 15px;
  background: #dc2626;
  color: white;
  padding: 6px 16px;
  border-radius: 25px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.product-actions {
  position: absolute;
  top: 15px;
  right: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateX(15px);
  transition: all 0.3s ease;
}

.product-card:hover .product-actions {
  opacity: 1;
  transform: translateX(0);
}

.action-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: white;
  color: #374151;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  font-size: 0.9rem;
  text-decoration: none;
}

.action-btn:hover {
  background: #1e3a8a;
  color: white;
  transform: scale(1.1);
}

/* Product Info */
.product-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-category {
  font-size: 0.78rem;
  color: #dc2626;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: inline-block;
}

.product-name {
  font-size: 1.1rem;
  color: #1f2937;
  margin-bottom: 10px;
  line-height: 1.4;
  font-weight: 600;
}

.product-name a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
}

.product-name a:hover {
  color: #1e3a8a;
}

.product-description {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 15px;
  line-height: 1.5;
  flex: 1;
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
}

.product-rating i {
  color: #f59e0b;
  font-size: 0.85rem;
}

.product-rating span {
  font-size: 0.85rem;
  color: #6b7280;
  font-weight: 600;
}

/* ============================================
   Product Card Actions (Buttons)
   ============================================ */
.product-card-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.add-to-cart-btn {
  flex: 1;
  padding: 11px 16px;
  background: #1e3a8a;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  min-width: 0;
  letter-spacing: 0.2px;
}

.add-to-cart-btn:hover {
  background: #152c6b;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.add-to-cart-btn:active {
  transform: translateY(0);
}

.add-to-cart-btn i {
  font-size: 0.85rem;
  flex-shrink: 0;
}

.view-details-btn {
  padding: 11px 16px;
  border: 2px solid #1e3a8a;
  color: #1e3a8a;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.view-details-btn:hover {
  background: #1e3a8a;
  color: white;
}

/* ============================================
   No Products State
   ============================================ */
.no-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
}

.no-products i {
  font-size: 4rem;
  color: #d1d5db;
  margin-bottom: 20px;
}

.no-products h3 {
  font-size: 1.5rem;
  color: #1f2937;
  margin-bottom: 10px;
}

.no-products p {
  color: #6b7280;
  margin-bottom: 20px;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 10px 16px;
  border: 2px solid #e5e7eb;
  background: white;
  color: #374151;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.page-btn:hover:not(:disabled) {
  border-color: #1e3a8a;
  color: #1e3a8a;
  background: #eff6ff;
}

.page-btn.active {
  background: #1e3a8a;
  color: white;
  border-color: #1e3a8a;
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-dots {
  padding: 10px 8px;
  color: #9ca3af;
  font-weight: 600;
}

/* ============================================
   Cart Notification
   ============================================ */
.cart-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #10b981;
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  max-width: 90vw;
}

.cart-notification.show {
  transform: translateX(0);
}

.cart-notification a {
  color: white;
  text-decoration: underline;
  font-weight: 700;
  margin-left: 5px;
  white-space: nowrap;
}

/* ============================================
   SKELETON LOADERS
   ============================================ */

/* Skeleton Card */
.skeleton-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

.skeleton-image {
  height: 280px;
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

.skeleton-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: skeleton-shine 1.5s ease-in-out infinite;
}

.skeleton-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.skeleton-badge {
  width: 80px;
  height: 20px;
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 10px;
}

.skeleton-title {
  width: 90%;
  height: 22px;
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}

.skeleton-title.short {
  width: 60%;
}

.skeleton-text {
  width: 100%;
  height: 14px;
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-rating {
  width: 120px;
  height: 16px;
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-buttons {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
}

.skeleton-btn {
  flex: 1;
  height: 42px;
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 10px;
}

.skeleton-btn:last-child {
  flex: 0.5;
}

/* Skeleton Animations */
@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes skeleton-shine {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Skeleton Pulse */
.skeleton-pulse {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* ============================================
   Responsive Design - Tablet
   ============================================ */
@media screen and (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
  }
}

@media screen and (max-width: 768px) {
  .products-section {
    padding: 40px 0;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
  }

  .product-image,
  .skeleton-image {
    height: 240px;
  }

  .product-info {
    padding: 16px;
  }

  .product-name {
    font-size: 1rem;
  }

  .product-card-actions {
    flex-direction: row;
    gap: 8px;
  }

  .add-to-cart-btn {
    padding: 10px 12px;
    font-size: 0.82rem;
    gap: 4px;
    border-radius: 8px;
  }

  .add-to-cart-btn i {
    font-size: 0.8rem;
  }

  .view-details-btn {
    padding: 10px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
  }

  .filter-btn {
    padding: 8px 16px;
    font-size: 0.82rem;
  }

  .skeleton-info {
    padding: 16px;
    gap: 10px;
  }
}

/* ============================================
   Responsive Design - Mobile (480px and below)
   ============================================ */
@media screen and (max-width: 480px) {
  .products-section {
    padding: 30px 0;
  }

  .search-bar input {
    padding: 12px 45px 12px 16px;
    font-size: 0.9rem;
  }

  .products-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .product-card {
    border-radius: 12px;
  }

  .product-image,
  .skeleton-image {
    height: 180px;
  }

  .product-badge {
    top: 8px;
    left: 8px;
    padding: 4px 10px;
    font-size: 0.65rem;
  }

  .product-actions {
    top: 8px;
    right: 8px;
    gap: 6px;
  }

  .action-btn {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  .product-info {
    padding: 12px;
  }

  .product-category {
    font-size: 0.7rem;
    margin-bottom: 4px;
  }

  .product-name {
    font-size: 0.88rem;
    margin-bottom: 6px;
  }

  .product-description {
    font-size: 0.78rem;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .product-rating {
    margin-bottom: 10px;
    gap: 5px;
  }

  .product-rating i {
    font-size: 0.7rem;
  }

  .product-rating span {
    font-size: 0.75rem;
  }

  .product-card-actions {
    gap: 6px;
  }

  .add-to-cart-btn {
    padding: 9px 8px;
    font-size: 0.75rem;
    gap: 3px;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .add-to-cart-btn i {
    font-size: 0.7rem;
    flex-shrink: 0;
  }

  .view-details-btn {
    padding: 9px 8px;
    font-size: 0.72rem;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .filter-btn {
    padding: 7px 14px;
    font-size: 0.78rem;
  }

  .page-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .pagination {
    gap: 5px;
  }

  .skeleton-info {
    padding: 12px;
    gap: 8px;
  }

  .skeleton-btn {
    height: 36px;
  }
}

/* ============================================
   Responsive Design - Very Small Mobile (360px and below)
   ============================================ */
@media screen and (max-width: 400px) {
  .products-grid {
    gap: 10px;
  }

  .product-image,
  .skeleton-image {
    height: 160px;
  }

  .product-info {
    padding: 10px;
  }

  .product-name {
    font-size: 0.82rem;
  }

  .product-description {
    font-size: 0.72rem;
  }

  .add-to-cart-btn {
    padding: 8px 6px;
    font-size: 0.7rem;
    gap: 2px;
    letter-spacing: 0;
  }

  .add-to-cart-btn i {
    font-size: 0.65rem;
  }

  .view-details-btn {
    padding: 8px 6px;
    font-size: 0.68rem;
  }

  .product-card-actions {
    gap: 4px;
  }

  .skeleton-btn {
    height: 32px;
  }
}

/* ============================================
   Responsive Design - Single Column (320px)
   ============================================ */
@media screen and (max-width: 340px) {
  .products-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .product-image,
  .skeleton-image {
    height: 220px;
  }

  .product-card-actions {
    gap: 8px;
  }

  .add-to-cart-btn {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .view-details-btn {
    padding: 10px 12px;
    font-size: 0.78rem;
  }
}

/* ============================================
   Landscape Mode Fix
   ============================================ */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .product-image,
  .skeleton-image {
    height: 160px;
  }
}

/* ============================================
   Touch Device Optimizations
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  .product-actions {
    opacity: 1;
    transform: translateX(0);
  }

  .action-btn {
    width: 36px;
    height: 36px;
  }

  .product-card:active {
    transform: scale(0.98);
  }
}
