/* =============================
   POPBRIZ Kilimall-Inspired Product Cards - Guaranteed Visibility
   ============================= */

/* Reset + Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #2d3748;
  overflow-x: hidden;
  line-height: 1.5;
}

/* =============================
   Category Section
   ============================= */
.category-section {
  margin: 2rem 0;
  padding: 0 1rem;
  position: relative;
}

.category-section.general-category {
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-radius: 12px;
  border: 2px solid #ffa500;
 
}

/* =============================
   Category Header - NEW STRUCTURE with both buttons
   ============================= */
.category-header {
  width: 100%;
  margin-bottom: 1.5rem;
}

.category-title-wrapper {
  background: #ffffff;
  border-radius: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #ff6600;
  padding: 1rem 1.5rem;
  width: 100%;
}

.category-section.general-category .category-title-wrapper {
  border-left: 4px solid #ff8c00;
  box-shadow: 0 6px 20px rgba(255, 165, 0, 0.2);
  background: linear-gradient(135deg, #ffffff 0%, #fff9e6 100%);
}

/* Title line with buttons - Responsive layout */
.category-title-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
  gap: 1rem;
}

.category-title-content {
  flex: 1;
  min-width: 200px;
}

.category-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #1a202c;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.category-section.general-category .category-title {
  color: #e65100;
}

.category-icon {
  font-size: 1.5rem;
  color: #ffd700;
}

.category-subtitle {
  font-size: 1rem;
  color: #4a5568;
  font-weight: 500;
  font-style: normal;
  line-height: 1.4;
  margin-top: 0.25rem;
}

.category-section.general-category .category-subtitle {
  color: #f57c00;
}

/* Category Actions Container */
.category-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Info Button */
.info-btn {
  padding: 0.625rem 1.25rem;
  background: transparent;
  color: #3182ce;
  border: 2px solid #3182ce;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(49, 130, 206, 0.2);
}

.info-btn:hover {
  background: #3182ce;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
}

.info-btn:active {
  transform: translateY(0);
}

.category-section.general-category .info-btn {
  border-color: #f57c00;
  color: #f57c00;
}

.category-section.general-category .info-btn:hover {
  background: #f57c00;
  color: white;
}

/* View All Button */
.view-all-btn {
  padding: 0.625rem 1.5rem;
  background: linear-gradient(135deg, #f46b03, #f97316);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(244, 107, 3, 0.3);
}

.view-all-btn:hover {
  background: linear-gradient(135deg, #f97316, #f46b03);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(244, 107, 3, 0.4);
}

.view-all-btn:active {
  transform: translateY(0);
}

.category-section.general-category .view-all-btn {
  background: linear-gradient(135deg, #f57c00, #ff9800);
}

.category-section.general-category .view-all-btn:hover {
  background: linear-gradient(135deg, #ff9800, #f57c00);
}

/* Hide View All button for General category */
.category-section.general-category .view-all-btn {
  display: none !important;
}

/* =============================
   Wrapper Container
   ============================= */
.wrapper-container {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

.category-section.general-category .wrapper-container {
  padding: 0.5rem;
}

/* Scrollable Row */
.wrapper-scroll {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 1rem 0.25rem;
  scrollbar-width: none;
  width: 100%;
  position: relative;
}

.wrapper-scroll::-webkit-scrollbar {
  display: none;
}

.category-section.general-category .wrapper-scroll {
  padding: 0.5rem 0.25rem;
}

/* =============================
   Scroll Buttons - Always Visible
   ============================= */
.scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: #ffffff;
  border: 2px solid #ff6600;
  color: #ff6600;
  font-size: 1.25rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
}

.scroll-btn.prev-btn {
  left: -20px;
}

.scroll-btn.next-btn {
  right: -20px;
}

.scroll-btn:hover {
  background: #ff6600;
  color: white;
  transform: translateY(-50%) scale(1.05);
}

.category-section.general-category .scroll-btn {
  border-color: #ffa500;
  color: #ffa500;
}

.category-section.general-category .scroll-btn:hover {
  background: #ffa500;
  color: white;
}

/* =============================
   Product Card - Guaranteed Content Visibility
   ============================= */
.product-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  min-width: 200px;
  height: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
  position: relative;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: #ff6600;
  box-shadow: 0 6px 20px rgba(255, 102, 0, 0.15);
}

.category-section.general-category .product-card {
  border: 1px solid #ffe0b2;
  box-shadow: 0 3px 12px rgba(255, 165, 0, 0.1);
}

.category-section.general-category .product-card:hover {
  border-color: #ffa500;
  box-shadow: 0 6px 20px rgba(255, 165, 0, 0.2);
}

/* =============================
   Product Image (Strict 3/4 Height)
   ============================= */
.product-image {
  position: relative;
  width: 100%;
  height: 180px; /* 3/4 of 240px */
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  padding: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.05);
}

.category-section.general-category .product-image {
  background: #fff8e1;
}

/* =============================
   Tags - Always Visible
   ============================= */
.tag {
  position: absolute;
  top: 1px;
  left: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  color: #ffffff;
  text-transform: uppercase;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  line-height: 1;
}

.tag.free {
  background: #10b981;
}

.tag.premium {
  background: #ff6600;
}

.category-section.general-category .tag.premium {
  background: #ffa500;
}

/* =============================
   Product Info (Strict 1/4 Height) - GUARANTEED VISIBILITY
   ============================= */
.product-info {
  height: 140px; /* 1/4 of 320px */
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
  flex-shrink: 0;
  min-height: 140px; /* Ensure minimum height */
}

.category-section.general-category .product-info {
  background: #fffdf6;
}

/* Product Name - Always Visible */
.product-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #000000;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.3rem;
  margin-bottom: 0.4rem;
  word-wrap: break-word;
}

/* Ratings - Always Visible */
.rating {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-bottom: 0.4rem;
  flex-shrink: 0;
}

.star {
  color: #ffc107;
  font-size: 0.8rem;
  line-height: 1;
}

.star.filled {
  color: #ffc107;
}

.rating-count {
  font-size: 0.75rem;
  color: #64748b;
  margin-left: 0.4rem;
  font-weight: 500;
  line-height: 1;
}

/* Price - Always Visible */
.product-price {
  font-size: 1rem;
  font-weight: 700;
  color: #ff6600;
  margin-top: auto;
  line-height: 1.2;
  flex-shrink: 0;
}

.product-price.free-text {
  color: #059669;
}

.product-price.premium-text {
  color: #ff6600;
  font-style: italic;
}

.category-section.general-category .product-price {
  color: #ff8c00;
}

.category-section.general-category .product-price.premium-text {
  color: #ff8c00;
}

/* =============================
   RESPONSIVE DESIGN FOR ALL DEVICES
   ============================= */

/* Large Desktop (1400px and above) */
@media (min-width: 1400px) {
  .category-section {
    padding: 0 2rem;
  }
  
  .category-title {
    font-size: 2rem;
  }
  
  .category-subtitle {
    font-size: 1.1rem;
  }
  
  .info-btn, .view-all-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
  
  .product-card {
    min-width: 240px;
    height: 360px;
  }
  
  .product-image {
    height: 210px;
  }
  
  .product-info {
    height: 150px;
    min-height: 150px;
    padding: 1rem;
  }
  
  .product-name {
    font-size: 1rem;
    min-height: 2.6rem;
  }
}

/* Desktop (1200px - 1399px) */
@media (max-width: 1399px) and (min-width: 1200px) {
  .category-title {
    font-size: 1.75rem;
  }
  
  .category-subtitle {
    font-size: 1rem;
  }
  
  .info-btn, .view-all-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
  }
  
  .product-card {
    min-width: 220px;
    height: 340px;
  }
  
  .product-image {
    height: 195px;
  }
  
  .product-info {
    height: 145px;
  }
}

/* Tablet Landscape (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
  .category-section {
    padding: 0 1.5rem;
  }
  
  .category-title-wrapper {
    padding: 0.875rem 1.25rem;
  }
  
  .category-title {
    font-size: 1.5rem;
  }
  
  .category-subtitle {
    font-size: 0.95rem;
  }
  
  .info-btn, .view-all-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .product-card {
    min-width: 200px;
    height: 320px;
  }
  
  .product-image {
    height: 180px;
  }
  
  .product-info {
    height: 140px;
  }
  
  .product-name {
    font-size: 0.9rem;
  }
}

/* Tablet Portrait (768px - 991px) */
@media (max-width: 991px) and (min-width: 768px) {
  .category-section {
    padding: 0 1rem;
    margin: 1.5rem 0;
  }
  
  .category-title-wrapper {
    padding: 0.75rem 1rem;
  }
  
  .category-title {
    font-size: 1.35rem;
  }
  
  .category-subtitle {
    font-size: 0.9rem;
  }
  
  .category-title-line {
    gap: 0.75rem;
  }
  
  .category-actions {
    gap: 0.5rem;
  }
  
  .info-btn, .view-all-btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
  }
  
  .product-card {
    min-width: 180px;
    height: 300px;
  }
  
  .product-image {
    height: 170px;
  }
  
  .product-info {
    height: 130px;
    padding: 0.625rem;
  }
  
  .product-name {
    font-size: 0.85rem;
  }
  
  .scroll-btn {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
}

/* Mobile Landscape (576px - 767px) */
@media (max-width: 767px) and (min-width: 576px) {
  .category-section {
    padding: 0 0.75rem;
    margin: 1.25rem 0;
  }
  
  .category-title-wrapper {
    padding: 0.625rem 0.875rem;
  }
  
  .category-title {
    font-size: 1.2rem;
  }
  
  .category-subtitle {
    font-size: 0.85rem;
  }
  
  .category-title-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .category-actions {
    width: 100%;
    justify-content: flex-start;
  }
  
  .info-btn, .view-all-btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.85rem;
    flex: 1;
    justify-content: center;
  }
  
  .product-card {
    min-width: 160px;
    height: 280px;
  }
  
  .product-image {
    height: 158px;
  }
  
  .product-info {
    height: 122px;
    padding: 0.5rem;
  }
  
  .product-name {
    font-size: 0.8rem;
  }
  
  .scroll-btn {
    width: 38px;
    height: 38px;
    font-size: 1rem;
    display: none; /* Hide on smaller screens for more space */
  }
}

/* Mobile Portrait (480px - 575px) */
@media (max-width: 575px) and (min-width: 480px) {
  .category-section {
    padding: 0 0.5rem;
    margin: 1rem 0;
  }
  
  .category-title-wrapper {
    padding: 0.5rem 0.75rem;
  }
  
  .category-title {
    font-size: 1.1rem;
  }
  
  .category-subtitle {
    font-size: 0.8rem;
  }
  
  .category-title-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .category-actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .info-btn, .view-all-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    flex: 1;
    max-width: 48%;
  }
  
  .product-card {
    min-width: 150px;
    height: 260px;
  }
  
  .product-image {
    height: 146px;
  }
  
  .product-info {
    height: 114px;
    padding: 0.5rem;
  }
  
  .product-name {
    font-size: 0.78rem;
  }
  
  .scroll-btn {
    display: none;
  }
}

/* Small Mobile (360px - 479px) */
@media (max-width: 479px) and (min-width: 360px) {
  .category-section {
    padding: 0 0.375rem;
    margin: 0.875rem 0;
  }
  
  .category-title-wrapper {
    padding: 0.5rem 0.625rem;
  }
  
  .category-title {
    font-size: 1rem;
  }
  
  .category-subtitle {
    font-size: 0.75rem;
  }
  
  .category-title-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .category-actions {
    width: 100%;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .info-btn, .view-all-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    width: 100%;
    justify-content: center;
  }
  
  .wrapper-scroll {
    gap: 0.5rem;
    padding: 0.5rem 0.125rem;
  }
  
  .product-card {
    min-width: 140px;
    height: 240px;
  }
  
  .product-image {
    height: 135px;
    padding: 5px;
  }
  
  .product-info {
    height: 105px;
    padding: 0.4rem;
  }
  
  .product-name {
    font-size: 0.75rem;
  }
  
  .scroll-btn {
    display: none;
  }
}

/* Extra Small Mobile (below 360px) */
@media (max-width: 359px) {
  .category-section {
    padding: 0 0.25rem;
    margin: 0.75rem 0;
  }
  
  .category-title-wrapper {
    padding: 0.375rem 0.5rem;
  }
  
  .category-title {
    font-size: 0.9rem;
  }
  
  .category-subtitle {
    font-size: 0.7rem;
  }
  
  .category-title-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .category-actions {
    width: 100%;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .info-btn, .view-all-btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    width: 100%;
    justify-content: center;
  }
  
  .wrapper-scroll {
    gap: 0.4rem;
    padding: 0.4rem 0.1rem;
  }
  
  .product-card {
    min-width: 130px;
    height: 220px;
  }
  
  .product-image {
    height: 124px;
    padding: 4px;
  }
  
  .product-info {
    height: 96px;
    padding: 0.3rem;
  }
  
  .product-name {
    font-size: 0.7rem;
  }
  
  .scroll-btn {
    display: none;
  }
}

/* =============================
   Accessibility & Fallbacks
   ============================= */
.scroll-btn:focus,
.product-card:focus,
.view-all-btn:focus,
.info-btn:focus {
  outline: 2px solid #ff6600;
  outline-offset: 2px;
}

.category-section.general-category .scroll-btn:focus,
.category-section.general-category .product-card:focus,
.category-section.general-category .view-all-btn:focus,
.category-section.general-category .info-btn:focus {
  outline-color: #ffa500;
}

/* Ensure content is always visible even if images fail to load */
.product-image {
  background: #f8fafc;
  position: relative;
}

.product-image::before {
  content: '📷';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  opacity: 0.3;
  z-index: 1;
}

.product-image img {
  position: relative;
  z-index: 2;
}

.category-section.general-category .product-image::before {
  content: '⭐';
}

/* Loading animation */
.product-image.loading {
  position: relative;
  overflow: hidden;
}

.product-image.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Print styles */
@media print {
  .product-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }
  
  .scroll-btn,
  .view-all-btn,
  .info-btn {
    display: none;
  }
  
  .category-section.general-category {
    background: none;
    border: 1px solid #000;
  }
}

/* Device Switcher Styles */
.device-switcher-container {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 15px 20px;
  margin-bottom: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  color: white;
}

.device-switcher {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.device-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 500;
}

.device-info i {
  font-size: 20px;
}

.admin-badge {
  background: #ff6b6b;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  margin-left: 10px;
}

.device-buttons {
  display: flex;
  gap: 10px;
}

.device-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.device-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.desktop-btn {
  background: #ffffff;
  color: #667eea;
}

.mobile-btn {
  background: #4ade80;
  color: white;
}

.reset-btn {
  background: #f59e0b;
  color: white;
}

/* Simple device info for non-admin users */
.device-info-container {
  background: #f8fafc;
  padding: 10px 20px;
  margin-bottom: 20px;
  border-radius: 8px;
  border-left: 4px solid #3b82f6;
}

.device-info-simple {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #4b5563;
  max-width: 1200px;
  margin: 0 auto;
}

.device-info-simple i {
  font-size: 18px;
  color: #3b82f6;
}