/**
 * Shopping List Styles - Gold Theme
 */

/* Gold Theme Variables */
:root {
  --gold: #C9A94C;
  --gold-light: #E6C766;
  --gold-dark: #A68B30;
  --gold-glow: rgba(201, 169, 76, 0.3);
}

/* ============ Shopping List Panel ============ */
.shopping-list-panel {
  margin-top: 24px;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  border-radius: 12px;
  border: 2px solid var(--gold);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 20px var(--gold-glow);
}

.shopping-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #252525 0%, #1a1a1a 100%);
  border-bottom: 1px solid var(--gold);
}

.shopping-list-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.shopping-list-count {
  font-weight: 400;
  color: var(--gold-light);
}

.shopping-list-toggle {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--gold);
  transition: transform 0.2s, color 0.2s;
  border-radius: 6px;
}

.shopping-list-toggle:hover {
  color: var(--gold-light);
  background: rgba(201, 169, 76, 0.1);
}

.shopping-list-toggle.collapsed {
  transform: rotate(-90deg);
}

.shopping-list-content {
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.2);
}

/* ============ Shopping Items ============ */
.shopping-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(201, 169, 76, 0.3);
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
}

.shopping-item:hover {
  background: rgba(201, 169, 76, 0.1);
  border-color: var(--gold);
  transform: translateX(2px);
}

.shopping-item-icon {
  font-size: 24px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(201, 169, 76, 0.15);
  border-radius: 10px;
  flex-shrink: 0;
  border: 1px solid rgba(201, 169, 76, 0.3);
}

.shopping-item-info {
  flex: 1;
  min-width: 0;
}

.shopping-item-name {
  font-weight: 500;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

.shopping-item-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}

.shopping-item-price {
  font-size: 13px;
  color: var(--gold-light);
  font-weight: 500;
  margin-top: 4px;
}

.shopping-item-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: var(--gold);
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.shopping-item-btn:hover {
  background: var(--gold-light);
  transform: scale(1.02);
  box-shadow: 0 2px 10px var(--gold-glow);
}

.shopping-item-btn:active {
  transform: scale(0.98);
}

/* ============ Search Box ============ */
.shopping-search {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(201, 169, 76, 0.3);
}

.shopping-search input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid rgba(201, 169, 76, 0.4);
  border-radius: 8px;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.3);
  color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.shopping-search input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.shopping-search input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* ============ Total Price ============ */
.shopping-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(201, 169, 76, 0.3);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

.shopping-total-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--gold-light);
}

/* ============ Loading / Empty / Error States ============ */
.shopping-loading,
.shopping-empty,
.shopping-error {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.6);
}

.shopping-loading .spinner,
.products-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(201, 169, 76, 0.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.shopping-error {
  color: #ff6b6b;
}

/* Search Button in Shopping List */
.shopping-search .btn {
  background: var(--gold);
  color: #1a1a1a;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.shopping-search .btn:hover {
  background: var(--gold-light);
  box-shadow: 0 2px 10px var(--gold-glow);
}

/* ============ Product Modal ============ */
.product-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.product-modal-content {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  border-radius: 16px;
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px var(--gold-glow);
  border: 2px solid var(--gold);
  position: relative;
}

.product-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(201, 169, 76, 0.4);
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--gold);
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
  z-index: 1;
}

.product-modal-close:hover {
  background: rgba(201, 169, 76, 0.2);
  border-color: var(--gold);
  transform: scale(1.1);
}

.product-modal-header {
  padding: 24px 60px 24px 24px;
  border-bottom: 1px solid var(--gold);
  background: linear-gradient(135deg, #252525 0%, #1a1a1a 100%);
}

.product-modal-header h4 {
  font-size: 20px;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
}

.product-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: rgba(0, 0, 0, 0.2);
}

.product-modal-search {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--gold);
  background: linear-gradient(135deg, #252525 0%, #1a1a1a 100%);
}

.product-modal-search input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(201, 169, 76, 0.4);
  border-radius: 8px;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.3);
  color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.product-modal-search input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.product-modal-search input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* ============ Products Grid ============ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.product-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(201, 169, 76, 0.3);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 15px var(--gold-glow);
  border-color: var(--gold);
}

.product-image {
  aspect-ratio: 1;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.product-card:hover .product-image img {
  transform: scale(1.05);
}

.product-info {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  line-height: 1.4;
  height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-shop {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-price {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.product-price-current {
  font-size: 18px;
  font-weight: 600;
  color: var(--gold-light);
}

.product-price-original {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  text-decoration: line-through;
}

.product-rating {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
}

.product-buy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 12px;
  background: var(--gold);
  color: #1a1a1a;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}

.product-buy-btn:hover {
  background: var(--gold-light);
  box-shadow: 0 2px 10px var(--gold-glow);
  transform: scale(1.02);
}

.product-buy-btn:active {
  transform: scale(0.98);
}

/* ============ Products States ============ */
.products-loading,
.products-empty,
.products-error {
  text-align: center;
  padding: 60px 20px;
  color: rgba(255, 255, 255, 0.6);
}

.products-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(201, 169, 76, 0.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

.products-error {
  color: #ff6b6b;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .shopping-item {
    flex-wrap: wrap;
  }

  .shopping-item-info {
    flex: 1 1 calc(100% - 60px);
  }

  .shopping-item-btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .product-modal-content {
    max-height: 90vh;
    border-radius: 12px 12px 0 0;
    margin-top: auto;
  }

  .product-modal {
    align-items: flex-end;
    padding: 0;
  }
}

@media (max-width: 480px) {
  .shopping-list-panel {
    margin-top: 16px;
  }

  .shopping-list-header {
    padding: 12px 16px;
  }

  .shopping-list-content {
    padding: 12px 16px;
  }

  .shopping-item {
    padding: 10px;
  }

  .shopping-item-icon {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .products-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .product-info {
    padding: 10px;
  }

  .product-name {
    font-size: 12px;
  }

  .product-price-current {
    font-size: 16px;
  }

  .product-buy-btn {
    padding: 10px;
    font-size: 13px;
  }
}

