/* ===============================================
   WORLDFEAST SHOP - Bottom Fixed Search Bar
   Apple-inspired Premium Arab Food Shopping Mall
=============================================== */

/* Import Variables */
@import url('../variables.css');

/* ===============================================
   BOTTOM FIXED SEARCH BAR
=============================================== */
.bottom-search-bar {
  position: fixed;
  bottom: 20px; /* Stay at least 20px above footer on desktop */
  left: 0;
  right: 0;
  background: transparent;
  z-index: var(--z-sticky);
  padding: var(--space-lg) 0;
  pointer-events: none;
}

/* Hide search form on specific pages (Login, Register, Customer Service, Community) */
/* Only hide category select, search input, and submit button - keep action buttons visible */
body.login-page .bottom-category-select,
body.login-page .bottom-search-input-wrapper,
body.login-page .bottom-search-btn,
body.register-page .bottom-category-select,
body.register-page .bottom-search-input-wrapper,
body.register-page .bottom-search-btn,
body.customer-service-page .bottom-category-select,
body.customer-service-page .bottom-search-input-wrapper,
body.customer-service-page .bottom-search-btn,
body.community-page .bottom-category-select,
body.community-page .bottom-search-input-wrapper,
body.community-page .bottom-search-btn {
  display: none !important;
}

.bottom-search-bar * {
  pointer-events: auto;
}

.bottom-search-container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Search Form */
.bottom-search-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.bottom-category-select {
  padding: var(--space-sm) var(--space-md);
  padding-right: var(--space-xl);
  border: 2px solid var(--color-border-light);
  border-radius: 8px;
  background: var(--color-white);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: var(--transition-base);
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3e%3cpath fill='%23636366' d='M6 8L0 0h12z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px;
  min-width: 100px;
}

.bottom-category-select:hover {
  border-color: var(--color-primary);
}

.bottom-category-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(126, 211, 33, 0.1);
}

/* Search Input Wrapper */
.bottom-search-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.bottom-search-input-wrapper .search-icon {
  position: absolute;
  left: var(--space-md);
  color: var(--color-text-tertiary);
  font-size: var(--text-base);
  pointer-events: none;
}

.bottom-search-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  padding-left: calc(var(--space-md) + 24px);
  border: 2px solid var(--color-border-light);
  border-radius: 8px;
  background: var(--color-white);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  transition: var(--transition-base);
}

.bottom-search-input::placeholder {
  color: var(--color-text-tertiary);
}

.bottom-search-input:hover {
  border-color: var(--color-primary);
}

.bottom-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(126, 211, 33, 0.1);
}

/* Search Submit Button */
.bottom-search-btn {
  padding: var(--space-sm) var(--space-lg);
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  border-radius: 50%;
  font-size: var(--text-base);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  box-shadow: var(--shadow-sm);
}

.bottom-search-btn:hover {
  background: var(--color-primary-hover);
}

.bottom-search-btn i {
  font-size: var(--text-lg);
}

/* Action Buttons */
.bottom-action-buttons {
  display: flex;
  gap: var(--space-sm);
}

.bottom-action-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.bottom-action-btn:hover {
  box-shadow: var(--shadow-md);
}

.bottom-action-btn i {
  font-size: var(--text-lg);
}

/* Specific Button Colors */
.bottom-action-btn.cart-btn {
  background: var(--color-primary);
}

.bottom-action-btn.cart-btn:hover {
  background: var(--color-primary-hover);
}

.bottom-action-btn.whatsapp-btn {
  background: #25D366;
}

.bottom-action-btn.whatsapp-btn:hover {
  background: #20BD5A;
}

/* Action Badge */
.action-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #FF3B30;
  color: var(--color-white);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--color-white);
}

/* ===============================================
   BUY NOW MODAL
=============================================== */
.buy-now-modal {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg-overlay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
}

.buy-now-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.buy-now-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-3xl);
  max-width: 450px;
  width: 90%;
  box-shadow: var(--shadow-2xl);
}

.buy-now-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
}

.buy-now-modal-header h2 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  margin: 0;
}

.buy-now-modal-close {
  background: var(--color-bg-secondary);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: var(--text-2xl);
  color: var(--color-text-secondary);
  line-height: 1;
}

.buy-now-modal-close:hover {
  background: var(--color-border-medium);
  color: var(--color-text-primary);
}

.buy-now-modal-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* Product Preview */
.product-preview {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
}

.product-preview img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--color-white);
}

.product-preview-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-xs);
}

.product-preview-info h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  margin: 0;
  line-height: var(--leading-snug);
}

.product-preview-info .price {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
  margin: 0;
}

/* Buy Options */
.buy-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.buy-options > p {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  text-align: center;
  margin: 0;
}

.option-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.option-btn {
  padding: var(--space-md) var(--space-lg);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
}

/* Cancel Option */
.cancel-option {
  border-color: var(--color-border-medium);
  background: var(--color-bg-secondary);
}

.cancel-option:hover {
  border-color: var(--color-text-secondary);
  background: var(--color-border-light);
}

.cancel-option .option-title {
  color: var(--color-text-secondary);
}

/* Buy Option */
.buy-option {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.buy-option:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.buy-option .option-title {
  color: var(--color-white);
}

/* ===============================================
   ANIMATIONS
=============================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ===============================================
   RESPONSIVE DESIGN
=============================================== */
@media (max-width: 1024px) {
  .bottom-search-bar {
    bottom: 16px; /* Slightly less spacing on tablets */
  }

  .bottom-search-container {
    padding: 0 var(--space-md);
  }

  .bottom-category-select {
    min-width: 90px;
    font-size: var(--text-xs);
  }
}

@media (max-width: 768px) {
  .bottom-search-bar {
    bottom: 12px; /* Reduced spacing on mobile */
    padding: var(--space-sm) 0;
  }

  .bottom-search-container {
    gap: var(--space-sm);
  }

  .bottom-category-select {
    display: none; /* Hide on mobile to save space */
  }

  .bottom-search-input {
    font-size: var(--text-sm);
    padding: var(--space-xs) var(--space-sm);
    padding-left: calc(var(--space-sm) + 24px);
  }

  .bottom-search-btn {
    min-width: 40px;
    height: 40px;
    padding: var(--space-xs);
  }

  .bottom-action-btn {
    width: 40px;
    height: 40px;
  }

  .bottom-action-btn i {
    font-size: var(--text-base);
  }

  /* Buy Now Modal Responsive */
  .buy-now-modal-content {
    padding: var(--space-2xl);
    width: 95%;
  }

  .buy-now-modal-header h2 {
    font-size: var(--text-xl);
  }

  .product-preview {
    gap: var(--space-sm);
    padding: var(--space-sm);
  }

  .product-preview img {
    width: 80px;
    height: 80px;
  }

  .product-preview-info h3 {
    font-size: var(--text-base);
  }

  .product-preview-info .price {
    font-size: var(--text-lg);
  }
}

@media (max-width: 480px) {
  .bottom-search-bar {
    bottom: 8px; /* Minimal spacing on small mobile devices */
  }

  .bottom-search-container {
    padding: 0 var(--space-sm);
  }

  .bottom-action-buttons {
    gap: var(--space-xs);
  }

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

  .bottom-search-btn {
    min-width: 36px;
    height: 36px;
  }

  /* Buy Now Modal for Extra Small Screens */
  .buy-now-modal-content {
    padding: var(--space-xl);
    max-width: calc(100% - 32px);
  }

  .product-preview img {
    width: 70px;
    height: 70px;
  }

  .product-preview-info h3 {
    font-size: var(--text-sm);
  }

  .product-preview-info .price {
    font-size: var(--text-base);
  }

  .option-buttons {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .option-btn {
    padding: var(--space-sm) var(--space-md);
  }
}
