/* Main CSS for Halal Market Warehouse System */
/* مع التعديلات: إضافة أنماط لحالة التوفر */

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --secondary: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --background: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow: rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Cairo', sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* قاعدة عامة لجميع الصور لضمان fit على الصناديق */
img {
  object-fit: cover;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.header {
  background: var(--surface);
  box-shadow: 0 2px 8px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.logo img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.logo-text {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 24px;
  align-items: center;
}

.nav-menu a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  transition: color 0.3s;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--primary);
}

.cart-icon {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.cart-icon.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 80px 24px;
  text-align: center;
}

.hero h1 {
  font-size: 48px;
  margin-bottom: 16px;
  font-weight: 700;
}

.hero p {
  font-size: 20px;
  margin-bottom: 32px;
  opacity: 0.9;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 16px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #475569;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Categories Section */
.categories {
  padding: 80px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: 36px;
  text-align: center;
  margin-bottom: 48px;
  font-weight: 700;
  color: var(--text);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px;
}

.category-card {
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
}

.category-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px var(--shadow);
}

.category-image {
  width: 100%;
  height: 200px;
  object-fit: contain;
}

.category-content {
  padding: 24px;
}

.category-content h3 {
  font-size: 24px;
  margin-bottom: 12px;
  color: var(--text);
}

.category-content p {
  color: var(--text-light);
  margin-bottom: 16px;
}

/* Search Container - NEW */
.search-container {
  margin-bottom: 32px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 16px 48px 16px 20px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: 'Cairo', sans-serif;
  transition: all 0.3s;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.search-clear-btn {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.3s;
}

.search-clear-btn:hover {
  background: var(--background);
  color: var(--danger);
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px var(--shadow);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: var(--background);
}

.suggestion-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.suggestion-info {
  flex: 1;
  min-width: 0;
}

.suggestion-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-name mark {
  background: #fef3c7;
  color: var(--text);
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 700;
}

.suggestion-category {
  font-size: 14px;
  color: var(--text-light);
}

.suggestion-availability {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.suggestion-availability.available {
  background: #d1fae5;
  color: #065f46;
}

.suggestion-availability.unavailable {
  background: #fee2e2;
  color: #991b1b;
}

.no-suggestions {
  padding: 24px;
  text-align: center;
  color: var(--text-light);
  font-size: 16px;
}

/* Scrollbar for suggestions */
.search-suggestions::-webkit-scrollbar {
  width: 8px;
}

.search-suggestions::-webkit-scrollbar-track {
  background: var(--background);
  border-radius: 0 12px 12px 0;
}

.search-suggestions::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.search-suggestions::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* Products Section */
.products-section {
  padding: 40px 24px;
  max-width: 1200px;
  margin: 0 auto;
  min-height: calc(100vh - 200px);
}

.category-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  padding: 10px 20px;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 24px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--text);
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.product-card {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px var(--shadow);
}

.product-card.product-unavailable {
  opacity: 0.7;
  background: #f8f9fa;
}

.product-image {
  width: 100%;
  height: 200px;
  object-fit: contain;
}
 

.product-info {
  padding: 16px;
}

.product-name {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 600;
}

.product-description {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* حالة التوفر - NEW */
.product-availability {
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
  text-align: center;
}

.availability-available {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.availability-unavailable {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

/* Stock Status - للأدمن فقط */
.product-stock {
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
  text-align: center;
}

.stock-available {
  background: #d1fae5;
  color: #065f46;
}

.stock-low {
  background: #fef3c7;
  color: #92400e;
}

.stock-out {
  background: #fee2e2;
  color: #991b1b;
}

/* Quantity Selector */
.quantity-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.quantity-btn {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--text);
}

.quantity-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.quantity-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.quantity-display {
  font-size: 18px;
  font-weight: 700;
  min-width: 40px;
  text-align: center;
  color: var(--text);
}

/* Footer */
.footer {
  background: var(--text);
  color: white;
  padding: 32px 24px;
  text-align: center;
  margin-top: 80px;
}

.footer-content p {
  margin: 8px 0;
  opacity: 0.8;
}

/* Notifications */
.notification {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 16px 24px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 4px 12px var(--shadow);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.notification-success {
  background: var(--success);
  color: white;
}

.notification-error {
  background: var(--danger);
  color: white;
}

.notification-warning {
  background: var(--warning);
  color: white;
}

/* Mobile Menu */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
}

/* Responsive */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }

  .nav-menu {
    position: fixed;
    top: 80px;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 24px;
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateX(100%);
    transition: transform 0.3s;
    width: 250px;
  }

  .nav-menu.active {
    transform: translateX(0);
  }
  
  /* إظهار السلة دائماً في الشاشات الصغيرة */
  .nav-menu .cart-icon {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero p {
    font-size: 16px;
  }

  .section-title {
    font-size: 28px;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }

  .search-container {
    margin-bottom: 24px;
  }

  .search-input {
    font-size: 14px;
    padding: 14px 44px 14px 16px;
  }

  .suggestion-item {
    padding: 10px 12px;
    gap: 12px;
  }

  .suggestion-image {
    width: 50px;
    height: 50px;
  }

  .suggestion-name {
    font-size: 14px;
  }

  .suggestion-category {
    font-size: 12px;
  }

  .suggestion-availability {
    font-size: 11px;
    padding: 4px 8px;
  }
}
/* Pagination Styles */
.pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 48px;
  padding: 32px 0;
}

.pagination-info {
  font-size: 16px;
  color: var(--text-light);
  font-weight: 600;
}

.pagination-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.pagination-btn {
  padding: 10px 16px;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--text);
  font-size: 14px;
  min-width: 44px;
}

.pagination-btn:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.pagination-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  cursor: default;
}

.pagination-dots {
  padding: 0 8px;
  color: var(--text-light);
  font-weight: 700;
}

@media (max-width: 768px) {
  .pagination {
    gap: 16px;
    margin-top: 32px;
    padding: 24px 0;
  }
  
  .pagination-info {
    font-size: 14px;
  }
  
  .pagination-btn {
    padding: 8px 12px;
    font-size: 13px;
    min-width: 38px;
  }
  
  .pagination-buttons {
    gap: 6px;
  }
}
