/*
    File: wholesale.css
    Purpose: Styles for wholesale products page
    Contains: Grid layout, access control UI, responsive design
*/

/* ========================================
   WHOLESALE CONTAINER
   ======================================== */

.wholesale-container {
  min-height: 100vh;
  padding-top: 0;
  background: #f5f5f5;
  margin-top: 0;
}

/* Ensure banner doesn't overflow */
body {
  overflow-x: clip;
  box-sizing: border-box;
}

* {
  box-sizing: border-box;
}

/* Fix any blue background issues */
.wholesale-container::before {
  display: none;
}

/* Fix cart icon */
.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff6b35;
  color: white;
  font-size: 12px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fix nav styling */
.main-nav {
  background: white;
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Top banner fix */
.top-banner {
  background: #7bc043;
  overflow: hidden;
}

/* ========================================
   ACCESS DENIED SECTION
   ======================================== */

.access-denied-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 180px);
  padding: var(--spacing-xxl);
}

.access-denied-content {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--spacing-xxl);
  max-width: 600px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.lock-icon {
  margin-bottom: var(--spacing-lg);
  color: #ff6b35;
}

.lock-icon svg {
  stroke-width: 1.5;
}

.access-denied-content h1 {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: var(--spacing-md);
}

.access-denied-content p {
  font-size: 16px;
  color: #666;
  line-height: 1.6;
  margin-bottom: var(--spacing-xl);
}

.access-denied-buttons {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  padding: var(--spacing-md) var(--spacing-xl);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-normal);
  font-size: 16px;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, #ff6b35 0%, #f59e0b 100%);
  color: white;
  border: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 107, 53, 0.3);
}

.btn-secondary {
  background: white;
  color: #1a1a1a;
  border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
  border-color: #ff6b35;
  color: #ff6b35;
}

/* ========================================
   WHOLESALE HEADER
   ======================================== */

.wholesale-header {
  background: linear-gradient(135deg, #ff6b35 0%, #f59e0b 100%);
  padding: var(--spacing-xxl) 0;
  color: white;
  text-align: center;
}

.header-content h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 900;
  margin-bottom: var(--spacing-md);
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
}

.header-content p {
  font-size: clamp(16px, 2vw, 18px);
  opacity: 0.95;
  max-width: 600px;
  margin: 0 auto;
}

/* ========================================
   CONTROLS SECTION
   ======================================== */

.wholesale-controls {
  background: white;
  padding: var(--spacing-lg) 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 70px;
  z-index: 100;
}

.controls-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
  display: flex;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.filter-group label {
  font-weight: 600;
  color: #1a1a1a;
  font-size: 14px;
  white-space: nowrap;
}

.filter-select {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: #1a1a1a;
  background: white;
  cursor: pointer;
  transition: all var(--transition-normal);
  min-width: 150px;
}

.filter-select:focus {
  outline: none;
  border-color: #ff6b35;
}

.filter-select:hover {
  border-color: #ff6b35;
}

/* ========================================
   PRODUCTS SECTION
   ======================================== */

.wholesale-products {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--spacing-xxl) var(--spacing-md);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-lg);
}

/* Loading State */
.loading-container {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xxl);
  gap: var(--spacing-md);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e0e0e0;
  border-top-color: #ff6b35;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-container p {
  color: #666;
  font-size: 16px;
}

/* Wholesale page card design with dropdowns and quantity */

.wholesale-products .product-card {
  background: white;
  border-radius: 8px;
  overflow: visible;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.wholesale-products .product-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
  z-index: 10;
}

.wholesale-products .product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: linear-gradient(135deg, #ff6b35 0%, #f59e0b 100%);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  z-index: 10;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wholesale-products .product-badge.sale-badge {
  top: 12px;
  left: 12px;
}

.wholesale-products .product-image {
  width: 100%;
  height: 280px;
  overflow: hidden;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  cursor: pointer;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.wholesale-products .product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.wholesale-products .product-card:hover .product-image img {
  transform: scale(1.05);
}

.wholesale-products .product-info {
  padding: var(--spacing-md);
  padding-bottom: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.wholesale-products .product-brand {
  font-size: 11px;
  font-weight: 600;
  color: #ff6b35;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wholesale-products .product-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.4;
  min-height: 40px;
}

.wholesale-products .product-price {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wholesale-products .current-price {
  font-size: 20px;
  font-weight: 500;
  color: #ff6b35;
}

.wholesale-products .original-price {
  font-size: 14px;
  color: #999;
  text-decoration: line-through;
}

.wholesale-products .product-stock {
  font-size: 12px;
  color: #22c55e;
  font-weight: 600;
}

.wholesale-products .product-stock.out-of-stock {
  color: #ef4444;
}

/* Variant Dropdowns (old system — native select) */
.wholesale-products .product-variant {
  width: 100%;
  position: relative;
  z-index: 2;
}

.wholesale-products .variant-select {
  width: 100% !important;
  padding: 10px 36px 10px 12px !important;
  border: 2px solid #e0e0e0 !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #1a1a1a !important;
  background-color: white !important;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 18px !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  cursor: pointer !important;
  transition: border-color 0.2s ease !important;
}

.wholesale-products .variant-select:hover {
  border-color: #ff6b35 !important;
}

.wholesale-products .variant-select:focus {
  outline: none !important;
  border-color: #ff6b35 !important;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1) !important;
}

/* Custom Flavour Dropdown (new combination system) */
.wholesale-products .custom-flavour-select {
  position: relative;
  width: 100%;
  user-select: none;
}

.wholesale-products .select-selected {
  padding: 10px 36px 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background-color: white;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  font-size: 14px;
  font-weight: 500;
  color: #999;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wholesale-products .select-selected.selected {
  color: #1a1a1a;
}

.wholesale-products .select-selected:hover,
.wholesale-products .select-selected.open {
  border-color: #ff6b35;
}

.wholesale-products .select-selected.open {
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff6b35' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='18 15 12 9 6 15'%3e%3c/polyline%3e%3c/svg%3e");
}

.wholesale-products .select-items {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 999;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.wholesale-products .select-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  transition: background 0.15s ease, color 0.15s ease;
}

.wholesale-products .select-item:hover {
  background: #fff5f0;
  color: #ff6b35;
}

.select-hide {
  display: none !important;
}

/* Quantity Controls */
.wholesale-products .product-quantity {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.wholesale-products .quantity-label {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  min-width: 60px;
}

.wholesale-products .quantity-controls {
  display: flex;
  align-items: center;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  flex: 1;
}

.wholesale-products .quantity-btn {
  background: #f9fafb;
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.wholesale-products .quantity-btn:hover:not(:disabled) {
  background: #ff6b35;
  color: white;
}

.wholesale-products .quantity-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.wholesale-products .quantity-input {
  flex: 1;
  border: none;
  border-left: 2px solid #e5e7eb;
  border-right: 2px solid #e5e7eb;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  padding: 8px;
  min-width: 0;
  background: white;
}

.wholesale-products .quantity-input:focus {
  outline: none;
}

/* Add to Cart Button */
.wholesale-products .add-to-cart-btn {
  width: calc(100% - calc(var(--spacing-md) * 2));
  margin: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--dark-bg);
  color: var(--light-bg);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  border-radius: var(--radius-md);
  transition: var(--transition-normal);
  display: block;
  border: none;
  cursor: pointer;
}

.wholesale-products .add-to-cart-btn:hover:not(:disabled) {
  background-color: var(--primary-color);
}

.wholesale-products .add-to-cart-btn:disabled {
  background-color: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}

/* No Products Message */
.no-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--spacing-xxl);
  color: #666;
}

.no-products h2 {
  font-size: 24px;
  margin-bottom: var(--spacing-md);
  color: #1a1a1a;
}

/* ========================================
   NOTIFICATIONS
   ======================================== */

.notification {
  position: fixed;
  top: 100px;
  right: var(--spacing-lg);
  background: white;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  min-width: 300px;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.notification-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.notification-content span {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.notification-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-normal);
}

.notification-close:hover {
  color: #1a1a1a;
}

.notification-success {
  border-left: 4px solid #22c55e;
}

.notification-error {
  border-left: 4px solid #ef4444;
}

.notification-info {
  border-left: 4px solid #3b82f6;
}

@media (max-width: 768px) {
  .notification {
    top: 80px;
    right: var(--spacing-md);
    left: var(--spacing-md);
    min-width: auto;
  }

  /* Wholesale Page Mobile - 2 Column Grid */
  .wholesale-products {
    padding: var(--spacing-lg) var(--spacing-sm);
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--spacing-md) !important;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .wholesale-products .product-card {
    width: 100%;
    box-sizing: border-box;
  }

  .wholesale-products .product-image {
    height: auto !important;
    aspect-ratio: 1 / 1;
    padding: var(--spacing-sm);
  }

  .wholesale-products .product-info {
    padding: var(--spacing-sm);
    gap: 6px;
  }

  .wholesale-products .product-name {
    font-size: 13px;
    min-height: auto;
    line-height: 1.3;
  }

  .wholesale-products .product-brand {
    font-size: 10px;
  }

  .wholesale-products .current-price {
    font-size: 16px;
  }

  .wholesale-products .variant-select {
    font-size: 12px;
    padding: 8px 10px;
  }

  .wholesale-products .quantity-label {
    font-size: 12px;
    min-width: 50px;
  }

  .wholesale-products .quantity-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .wholesale-products .quantity-input {
    font-size: 13px;
    padding: 6px;
  }

  .wholesale-products .add-to-cart-btn {
    width: calc(100% - 16px) !important;
    margin: var(--spacing-sm) 8px;
    padding: 10px 12px;
    font-size: 11px;
  }

  .wholesale-controls {
    top: 58px;
    padding: var(--spacing-sm) 0;
  }

  .controls-container {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-sm);
    padding: 0 var(--spacing-sm);
  }

  .filter-group {
    width: 100%;
  }

  .filter-select {
    width: 100%;
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .wholesale-products {
    padding: var(--spacing-md) var(--spacing-xs);
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--spacing-sm) !important;
  }

  .wholesale-products .product-image {
    height: auto !important;
    aspect-ratio: 1 / 1;
    padding: var(--spacing-xs);
  }

  .wholesale-products .product-info {
    padding: var(--spacing-xs);
  }

  .wholesale-products .product-name {
    font-size: 12px;
  }

  .wholesale-products .current-price {
    font-size: 15px;
  }

  .wholesale-products .variant-select {
    font-size: 11px;
    padding: 6px 8px;
  }

  .wholesale-products .quantity-label {
    font-size: 11px;
    min-width: 45px;
  }

  .wholesale-products .quantity-btn {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .wholesale-products .quantity-input {
    font-size: 12px;
    padding: 4px;
  }

  .wholesale-products .add-to-cart-btn {
    width: calc(100% - 12px) !important;
    margin: var(--spacing-xs) 6px;
    padding: 8px 10px;
    font-size: 10px;
  }

  .wholesale-header {
    padding: var(--spacing-lg) 0;
  }

  .header-content h1 {
    font-size: 24px;
  }

  .header-content p {
    font-size: 14px;
  }
}
