/**
 * Standalone Store - Styles
 *
 * This stylesheet provides styling for the standalone store mode.
 * It's designed to integrate with existing site styles.
 */

/* ============================================
   CSS Variables (can be overridden by store-colors.css)
   ============================================ */

:root {
  --store-primary: #2563eb;
  --store-primary_hover: #1d4ed8;
  --store-secondary: #64748b;
  --store-accent: #f59e0b;
  --store-text_dark: #111827;
  --store-text_light: #6b7280;
  --store-background: #ffffff;
  --store-background_alt: #f9fafb;
  --store-border: #e5e7eb;
  --store-success: #059669;
  --store-error: #dc2626;
  --store-cart_button_bg: #000000;
  --store-cart_button_color: #ffffff;
}

/* ============================================
   Store Layout
   ============================================ */

.store-page {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
}

.store-main {
  min-height: 60vh;
  padding: 2rem 0;
}

.store-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ============================================
   Breadcrumbs
   ============================================ */

.store-breadcrumbs {
  margin-bottom: 2rem;
}

.store-breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.store-breadcrumbs li {
  display: flex;
  align-items: center;
}

.store-breadcrumbs li:not(:last-child)::after {
  content: '/';
  margin-left: 0.5rem;
  color: #9ca3af;
}

.store-breadcrumbs a {
  color: var(--store-primary);
  text-decoration: none;
}

.store-breadcrumbs a:hover {
  text-decoration: underline;
}

/* ============================================
   Page Header
   ============================================ */

.store-page-header {
  margin-bottom: 2rem;
  text-align: center;
}

.store-page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--store-text_dark);
}

.store-page-description {
  font-size: 1.125rem;
  color: var(--store-text_light);
  margin: 0;
}

/* ============================================
   Toolbar
   ============================================ */

.store-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.store-search {
  flex: 1;
  min-width: 200px;
}

.store-search input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
}

.store-search input:focus {
  outline: none;
  border-color: var(--store-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.store-filters select {
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  background: white;
  cursor: pointer;
}

/* ============================================
   Product Grid
   ============================================ */

.store-products {
  margin-bottom: 3rem;
}

.store-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.store-products-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1200px) {
  .store-products-grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .store-products-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   Product Card
   ============================================ */

.store-product-card {
  background: var(--store-background);
  border: 1px solid var(--store-border);
  border-radius: 0.5rem;
  overflow: hidden;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.store-product-card a {
  text-decoration: none;
  color: inherit;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
}

.store-product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  border-color: var(--store-primary);
}

.store-product-link {
  text-decoration: none;
  color: inherit;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.store-product-image {
  width: 100%;
  background: var(--store-background_alt);
  overflow: hidden;
  position: relative;
}

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

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

.store-no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 0.875rem;
}

/* Scoped to product cards only (not product detail page) */
.store-product-card .store-product-info {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Scoped to product cards only */
.store-product-card .store-product-brand {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.store-product-name {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--store-text_dark);
  line-height: 1.4;
}

.store-product-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--store-text_dark);
  margin-top: auto;
  margin-bottom: 0.5rem;
}

.store-availability {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0;
  display: inline-block;
}

.store-in-stock {
  color: var(--store-success);
}

.store-out-of-stock {
  color: var(--store-error);
}

.store-add-to-cart {
  margin: 0 1rem 1rem 1rem;
  width: calc(100% - 2rem);
  display: block;
}

/* ============================================
   Product Detail
   ============================================ */

.store-product-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

/* Sticky gallery on desktop only */
@media (min-width: 1025px) {
  .store-product-gallery {
    position: sticky;
    top: 2rem;
    height: fit-content;
  }
}

.store-gallery-main {
  width: 100%;
  height: 500px;
  background: #f9fafb;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1rem;
}

.store-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.store-gallery-thumbnails {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.store-gallery-thumbnails img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 0.25rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.store-gallery-thumbnails img:hover {
  border-color: #2563eb;
}

.store-product-main {
  display: flex;
  flex-direction: column;
}

.store-product-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: #111827;
}

.store-product-rating {
  font-size: 1.25rem;
  color: #fbbf24;
  margin-bottom: 1rem;
}

.store-product-rating span {
  font-size: 0.875rem;
  color: #6b7280;
  margin-left: 0.5rem;
}

.store-product-price-large {
  font-size: 2.5rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 1rem;
}

.store-product-description {
  font-size: 1rem;
  color: #4b5563;
  line-height: 1.8;
  margin: 1.5rem 0;
}

.store-product-sku {
  font-size: 0.875rem;
  color: #9ca3af;
  margin-bottom: 2rem;
}

.store-product-actions {
  margin-top: auto;
}

.store-product-actions .store-btn {
  width: 100%;
  display: block;
}

/* ============================================
   Buttons
   ============================================ */

.store-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  letter-spacing: 0.025em;
}

.store-btn-primary {
  background: var(--store-primary);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.store-btn-primary:hover {
  background: var(--store-primary_hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.store-btn-primary:active {
  transform: translateY(0);
}

.store-btn-primary:disabled {
  background: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

.store-btn-large {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.store-btn-block {
  width: 100%;
  display: block;
  margin: 0 auto;
}

.store-btn-secondary {
  background: transparent;
  color: var(--store-primary);
  border: 2px solid var(--store-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.store-btn-secondary:hover {
  background: var(--store-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.store-btn-disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

.store-btn-disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ============================================
   Section
   ============================================ */

.store-section {
  margin: 4rem 0;
}

.store-section h2 {
  font-size: 1.875rem;
  font-weight: 700;
  margin: 0 0 2rem 0;
  color: #111827;
}

/* ============================================
   Loading State
   ============================================ */

.store-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  text-align: center;
}

.store-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f4f6;
  border-top: 4px solid #2563eb;
  border-radius: 50%;
  animation: store-spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes store-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.store-loading p {
  color: #6b7280;
  margin: 0;
}

/* Inline loading (for "Load More" pagination) */
.store-loading-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
}

.store-spinner-small {
  width: 24px;
  height: 24px;
  border: 3px solid #f3f4f6;
  border-top: 3px solid #2563eb;
  border-radius: 50%;
  animation: store-spin 1s linear infinite;
}

.store-loading-inline p {
  color: #6b7280;
  margin: 0;
  font-size: 0.875rem;
}

/* ============================================
   Empty State
   ============================================ */

.store-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: #6b7280;
}

.store-empty p {
  font-size: 1.125rem;
  margin: 0;
}

/* ============================================
   Error State
   ============================================ */

.store-error {
  text-align: center;
  padding: 4rem 1rem;
}

.store-error p {
  color: #dc2626;
  font-size: 1.125rem;
  margin: 0;
}

/* ============================================
   Pagination
   ============================================ */

.store-pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 3rem 0;
}

.store-pagination button {
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.store-pagination button:hover {
  background: #f9fafb;
  border-color: #2563eb;
}

.store-pagination button.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
  .store-page-header h1 {
    font-size: 2rem;
  }

  .store-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }

  .store-product-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .store-gallery-main {
    height: 300px;
  }

  .store-product-gallery {
    position: static;
  }

  .store-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  .store-container {
    padding: 0 0.75rem;
  }

  .store-products-grid {
    grid-template-columns: 1fr;
  }

  .store-product-title {
    font-size: 1.5rem;
  }

  .store-product-price-large {
    font-size: 2rem;
  }
}
