/* 
 * brands.css
 * Styles for the brands module of BlueCart website
 */

/* Page Structure */
body {
  padding-top: 60px; /* For fixed navbar */
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
}

.brands-section {
  padding: 2rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: #2196f3;
}

.section-header p {
  font-size: 1rem;
  color: #666;
  max-width: 600px;
  margin: 0 auto;
}

/* Brands Container */
.brands-container {
  margin-bottom: 2rem;
}

/* Search Input */
.brand-search-container {
  margin-bottom: 1.5rem;
}

.brand-search {
  width: 100%;
  padding: 12px 15px;
  font-size: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background-color: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transition: box-shadow 0.3s ease;
}

.brand-search:focus {
  outline: none;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
  border-color: #2196f3;
}

/* Brand Cards */
.brand-card {
  background-color: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.brand-header {
  display: flex;
  align-items: center;
  padding: 1.25rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.brand-header:hover {
  background-color: #f9f9f9;
}

.brand-header img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-right: 1rem;
  border-radius: 6px;
  border: 1px solid #f0f0f0;
}

.brand-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
  font-weight: 600;
}

/* Brand Items List */
.brand-items-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-in-out;
  background-color: #f8f9fa;
  padding: 0;
  border-top: 1px solid #e0e0e0;
}

.brand-items-list.show {
  max-height: 2000px; /* Large enough to accommodate content */
  padding: 1rem;
}

/* Brand Items Grid */
.brand-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

/* Item Cards */
.item-card {
  background-color: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

.item-header {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}

.item-image {
  width: 100%;
  height: 150px;
  object-fit: contain;
  margin-bottom: 0.75rem;
  border-radius: 6px;
  background-color: #f9f9f9;
}

.item-info h4 {
  margin: 0 0 0.5rem 0;
  font-size: 16px;
  color: #333;
  line-height: 1.3;
}

.item-price {
  font-weight: bold;
  color: #2196f3;
  font-size: 18px;
}

/* Item Controls */
.item-controls {
  margin-top: auto;
}

.quantity-controls {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.quantity-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #e0e0e0;
  background-color: #f5f5f5;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.quantity-btn:hover {
  background-color: #e8e8e8;
}

.quantity-btn:first-child {
  border-radius: 4px 0 0 4px;
}

.quantity-btn:last-child {
  border-radius: 0 4px 4px 0;
}

.quantity-input {
  width: 50px;
  height: 36px;
  border: 1px solid #e0e0e0;
  border-left: none;
  border-right: none;
  text-align: center;
  font-size: 16px;
  appearance: textfield;
  -moz-appearance: textfield; /* Firefox */
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.add-to-cart-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 4px;
  background-color: #2196f3;
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.add-to-cart-btn:hover {
  background-color: #1976d2;
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(33, 150, 243, 0.2);
  border-top: 4px solid #2196f3;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Error and Empty Messages */
.error-message, .empty-brands-message, .empty-items-message {
  text-align: center;
  padding: 2rem;
}

.error-message {
  color: #e53935;
}

.error-message h3, .empty-brands-message h3 {
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.empty-brands-message {
  color: #4a5568;
}

.empty-items-message {
  text-align: center;
  padding: 1rem;
  color: #4a5568;
}

/* Responsive Adjustments */
@media (min-width: 768px) {
  .brand-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  
  .brand-header img {
    width: 80px;
    height: 80px;
  }
  
  .brand-header h3 {
    font-size: 20px;
  }
}

@media (min-width: 1024px) {
  .brand-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}
