/* ============================================================
   ANITRACKERS STORE STYLES
   Professional e-commerce styling for the Store tab
   ============================================================ */

/* Store Container */
.store-container {
  padding: 1.5rem 2rem;
  height: 100%;
  overflow-y: auto;
  width: 100%;
}

/* Store Header */
.store-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.store-header h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.store-cart-button {
  position: relative;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 0.5rem;
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  color: var(--accent);
  font-weight: 500;
}

.store-cart-button:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
}

.store-cart-icon {
  width: 20px;
  height: 20px;
}

.store-cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #f97373;
  color: white;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0 4px;
}

/* Filters Bar */
.store-filters {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 0.75rem;
}

.store-filters-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  display: block;
}

.store-search-wrapper {
  display: flex;
  flex-direction: column;
}

.store-sort-wrapper {
  display: flex;
  flex-direction: column;
  min-width: 200px;
}

.store-filter-wrapper {
  display: flex;
  flex-direction: column;
  min-width: 200px;
}

.store-results-count {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.store-results-count strong {
  color: var(--accent);
}

.store-search-input,
.store-sort-select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  background: white;
  color: var(--text-main);
  font-size: 0.95rem;
  transition: all 0.2s;
}

.store-search-input {
  width: 100%;
}

.store-search-input:focus,
.store-sort-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.store-sort-select {
  width: 100%;
  cursor: pointer;
}

/* Product Grid */
.store-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 1400px) {
  .store-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* Product Card */
.store-product-card {
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  overflow: hidden;
  transition: all 0.3s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.store-product-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.3);
}

.store-product-image-wrapper {
  position: relative;
  padding-top: 100%; /* 1:1 aspect ratio */
  background: #f8f9fa;
  overflow: hidden;
}

.store-product-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-product-content {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.store-product-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.store-product-price {
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
}

.store-product-button {
  width: 100%;
  padding: 0.65rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 0.5rem;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: auto;
}

.store-product-button:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
}

/* Loading Skeleton */
.store-skeleton-card {
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  overflow: hidden;
}

.store-skeleton-image {
  width: 100%;
  padding-top: 100%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

.store-skeleton-content {
  padding: 1rem;
}

.store-skeleton-line {
  height: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.store-skeleton-line:last-child {
  width: 60%;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty State */
.store-empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.store-empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.store-empty-title {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  font-weight: 600;
}

/* Sign In Message */
.store-signin-message {
  text-align: center;
  padding: 4rem 1rem;
  max-width: 500px;
  margin: 0 auto;
}

.store-signin-message h2 {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.store-signin-message p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Product Modal */
.store-modal-overlay {
  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: 10000;
  padding: 1rem;
  opacity: 0;
  animation: fadeIn 0.2s forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.store-modal-content {
  background: white;
  border-radius: 0.75rem;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.3s ease-out;
}

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

.store-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 1;
}

.store-modal-close:hover {
  background: #f8f9fa;
  border-color: var(--text-muted);
}

.store-modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  padding: 2rem;
}

.store-modal-image-wrapper {
  position: relative;
  padding-top: 100%;
  background: #f8f9fa;
  border-radius: 0.5rem;
  overflow: hidden;
}

.store-modal-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-modal-details h2 {
  font-size: 1.8rem;
  margin: 0 0 0.75rem 0;
  color: var(--text-main);
}

.store-modal-description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.store-modal-price {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.store-modal-option-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.store-modal-option-group {
  margin-bottom: 1.5rem;
}

.store-modal-size-buttons,
.store-modal-color-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.store-modal-size-button,
.store-modal-color-button {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  color: var(--text-main);
}

.store-modal-size-button:hover,
.store-modal-color-button:hover {
  border-color: var(--accent);
}

.store-modal-size-button.active,
.store-modal-color-button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.store-modal-size-button:disabled,
.store-modal-color-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.store-modal-stock-status {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  display: inline-block;
}

.store-modal-stock-status.in-stock {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.store-modal-stock-status.out-of-stock {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.store-modal-add-button {
  width: 100%;
  padding: 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.store-modal-add-button:hover:not(:disabled) {
  background: #0ea5e9;
}

.store-modal-add-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Cart Overlay */
.store-cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10001;
  opacity: 0;
  animation: fadeIn 0.2s forwards;
}

.store-cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 500px;
  background: white;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  animation: slideInRight 0.3s ease-out forwards;
}

@keyframes slideInRight {
  to { transform: translateX(0); }
}

.store-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.store-cart-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.store-cart-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.store-cart-close:hover {
  background: #f8f9fa;
  color: var(--text-main);
}

.store-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.store-cart-item {
  display: flex;
  gap: 1rem;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.store-cart-item:last-child {
  border-bottom: none;
}

.store-cart-item-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 0.5rem;
  background: #f8f9fa;
}

.store-cart-item-details {
  flex: 1;
}

.store-cart-item-name {
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  color: var(--text-main);
}

.store-cart-item-variant {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem 0;
}

.store-cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.store-cart-item-qty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.375rem;
  padding: 0.25rem;
}

.store-cart-qty-button {
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 0.25rem;
  color: var(--text-main);
  transition: all 0.2s;
}

.store-cart-qty-button:hover:not(:disabled) {
  background: #f8f9fa;
}

.store-cart-qty-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.store-cart-qty-value {
  min-width: 24px;
  text-align: center;
  font-weight: 500;
}

.store-cart-item-price {
  font-weight: 600;
  color: var(--text-main);
}

.store-cart-item-remove {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.store-cart-item-remove:hover {
  background: rgba(239, 68, 68, 0.1);
}

.store-cart-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.store-cart-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.store-cart-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 1.5rem;
}

@media (max-width: 768px) {
  .store-container {
    padding: 1.25rem 1rem;
  }

  .store-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .store-cart-button {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .store-filters {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .store-sort-wrapper,
  .store-filter-wrapper {
    min-width: 0;
  }

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

  .store-modal-body {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }

  .store-cart-panel {
    max-width: 100%;
  }

  .store-product-button,
  .store-modal-add-button,
  .store-cart-checkout-button,
  .store-cart-continue-button {
    width: 100%;
    min-height: 44px;
  }
}

.store-cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.store-cart-subtotal-label {
  font-weight: 600;
  color: var(--text-main);
}

.store-cart-subtotal-value {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.3rem;
}

.store-cart-checkout-button {
  width: 100%;
  padding: 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 0.75rem;
}

.store-cart-checkout-button:hover:not(:disabled) {
  background: #0ea5e9;
}

.store-cart-checkout-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.store-cart-continue-button {
  width: 100%;
  padding: 0.9rem;
  background: white;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.store-cart-continue-button:hover {
  background: #f8f9fa;
}

/* Banner */
.store-banner {
  margin-bottom: 1.5rem;
  padding: 1rem 1.2rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.store-banner.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #16a34a;
}

.store-banner.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

.store-banner.warning {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #d97706;
}

.store-banner-icon {
  font-size: 1.2rem;
}

.store-banner-message {
  flex: 1;
  font-weight: 500;
}

.store-banner-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.store-banner-close:hover {
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .store-modal-body {
    grid-template-columns: 1fr;
  }
  
  .store-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }
  
  .store-cart-panel {
    max-width: 100%;
  }
  
  .store-filters {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  
  .store-container {
    padding: 1rem;
  }
  
  .store-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .store-cart-button {
    align-self: flex-end;
  }
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.store-spinner {
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.5rem;
}

.store-spinner circle {
  animation: store-spin 1s linear infinite;
}

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

