/* --- PREMIUM MERCH STORE STYLES --- */

/* Ambient Lighting Background */
.ambient-glow {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vw;
  height: 80vh;
  background: radial-gradient(circle, rgba(0,240,255,0.05) 0%, rgba(0,0,0,0) 70%);
  z-index: -1;
  pointer-events: none;
}

/* Glassmorphism Utilities */
.glass-panel {
  background: rgba(6, 9, 14, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 240, 255, 0.15);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-btn {
  background: rgba(0, 240, 255, 0.05);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0, 240, 255, 0.3);
  transition: all 0.3s ease;
}

.glass-btn:hover {
  background: rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

/* Store Hero */
.store-hero {
  padding: 8rem 2rem 4rem;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.store-title {
  font-size: clamp(3rem, 6vw, 5rem);
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
  margin-bottom: 1rem;
}

.store-lead {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 5rem;
  color: var(--color-cyan);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(0, 240, 255, 0.1);
  border-top-color: var(--color-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Premium Grid */
.merch-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem 6rem;
}

.premium-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 3rem;
}

/* Premium Product Card */
.premium-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: transparent;
  cursor: pointer;
  group: true;
}

.card-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: #0a0e14;
  border: 1px solid rgba(255,255,255,0.05);
  transition: border-color 0.4s ease;
}

.premium-card:hover .card-image-wrapper {
  border-color: var(--color-cyan);
}

.premium-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1), filter 0.4s ease;
  filter: grayscale(10%) contrast(110%);
}

.premium-card:hover img {
  transform: scale(1.05);
  filter: grayscale(0%) contrast(120%);
}

.quick-view-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  display: flex;
  justify-content: center;
}

.premium-card:hover .quick-view-overlay {
  transform: translateY(0);
}

.card-info {
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.card-title {
  font-size: 1.1rem;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
  color: var(--color-text-primary);
  transition: color 0.3s ease;
}

.premium-card:hover .card-title {
  color: var(--color-cyan);
}

.card-price {
  font-size: 1rem;
  color: var(--color-text-muted);
}

/* Modal Redesign */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 95%;
  max-width: 1100px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(0,240,255,0.3);
  position: relative;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  z-index: 10;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: var(--color-cyan);
}

.modal-close .hover-bracket {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.modal-close:hover .hover-bracket {
  opacity: 1;
}

.product-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  background: rgba(8, 12, 18, 0.98);
  border: 1px solid rgba(0, 240, 255, 0.35);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 240, 255, 0.15);
  border-radius: 6px;
  overflow: hidden;
  max-height: 85vh;
}

@media (max-width: 850px) {
  .product-detail-layout {
    grid-template-columns: 1fr;
    max-height: 90vh;
    overflow-y: auto;
  }
}

.product-detail-img-wrapper {
  background: #0b0f19;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  border-right: 1px solid rgba(0, 240, 255, 0.15);
  position: relative;
}

.product-detail-img-wrapper img {
  width: 100%;
  max-width: 420px;
  max-height: 420px;
  object-fit: contain;
  border-radius: 4px;
  filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.8));
}

.product-detail-info {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 85vh;
}

.product-detail-title {
  font-family: var(--font-hud);
  font-size: 1.6rem;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.25;
  letter-spacing: 0.05em;
}

.product-detail-price {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: var(--color-cyan);
  text-shadow: var(--glow-cyan);
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.product-detail-desc {
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.55;
  margin-bottom: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.85rem;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.variant-selectors {
  margin-bottom: 1.5rem;
}

.variant-group {
  margin-bottom: 2rem;
}

.variant-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  letter-spacing: 1px;
}

.variant-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Variant Button styling */
.variant-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--color-text-primary);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.variant-btn:hover:not(:disabled) {
  border-color: rgba(0,240,255,0.5);
  background: rgba(0,240,255,0.05);
}

.variant-btn.selected {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
  background: rgba(0,240,255,0.1);
  box-shadow: 0 0 10px rgba(0,240,255,0.2);
}

.variant-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  text-decoration: line-through;
}

.add-to-cart-action {
  width: 100%;
  padding: 1.25rem;
  font-size: 1.1rem;
  letter-spacing: 2px;
  transition: all 0.3s ease;
}

.add-to-cart-action:disabled {
  opacity: 0.5;
  filter: grayscale(100%);
  cursor: not-allowed;
}

/* Cart Drawer Redesign */
.cart-drawer {
  position: fixed;
  top: 0; right: -500px;
  width: 100%;
  max-width: 450px;
  height: 100vh;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  transition: right 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  border-left: 1px solid rgba(0,240,255,0.2);
}

.cart-drawer.open {
  right: 0;
  box-shadow: -20px 0 50px rgba(0,0,0,0.5);
}

.cart-header {
  padding: 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  transition: color 0.2s;
}
.close-btn:hover { color: var(--color-magenta); }

.cart-items-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 2rem;
}

.cart-item {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.cart-item-img {
  width: 90px;
  height: 120px;
  object-fit: cover;
  background: #05070a;
  border: 1px solid rgba(255,255,255,0.05);
}

.cart-item-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.cart-item-title {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  letter-spacing: 1px;
}

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

.cart-item-price {
  color: var(--color-cyan);
  font-size: 1.1rem;
  margin-top: auto;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.qty-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--color-text-primary);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.qty-btn:hover {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
}

.cart-footer {
  padding: 2rem;
  background: rgba(0,0,0,0.6);
  border-top: 1px solid rgba(0,240,255,0.1);
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.checkout-action {
  width: 100%;
  padding: 1.25rem;
  font-size: 1.1rem;
  letter-spacing: 2px;
}

.checkout-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.empty-cart {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  letter-spacing: 2px;
}

/* Dynamic Cart Badge Glow animation */
@keyframes cart-pulse {
  0% {
    box-shadow: 0 0 5px rgba(0, 240, 255, 0.3), inset 0 0 5px rgba(0, 240, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 18px rgba(0, 240, 255, 0.7), inset 0 0 8px rgba(0, 240, 255, 0.3);
    border-color: rgba(0, 240, 255, 0.8);
  }
  100% {
    box-shadow: 0 0 5px rgba(0, 240, 255, 0.3), inset 0 0 5px rgba(0, 240, 255, 0.1);
  }
}

.cart-glow-pulse {
  animation: cart-pulse 2s infinite ease-in-out;
  border-color: var(--color-cyan) !important;
  background: rgba(0, 240, 255, 0.1) !important;
  color: #fff !important;
  text-shadow: 0 0 5px var(--color-cyan);
}

/* Store Policy link under checkout */
.store-policy-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.75rem;
  flex-wrap: wrap;
}

.store-policy-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.store-policy-links a:hover {
  color: var(--color-cyan);
  text-decoration: underline;
}

/* Responsive Media Queries for Merch */
@media (max-width: 900px) {
  .store-hero {
    padding: 4.5rem 1rem 2rem;
  }
  
  .merch-container {
    padding: 0 1rem 4rem;
  }

  .premium-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
  }

  .cart-drawer {
    width: 100vw;
    max-width: 100vw;
  }

  .modal-content {
    width: 92vw;
    max-height: 85vh;
    border-radius: 6px;
    margin: auto;
  }

  .product-detail-layout {
    grid-template-columns: 1fr;
    max-height: 85vh;
    overflow-y: auto;
  }

  .product-detail-img-wrapper {
    padding: 1.25rem 1rem;
    border-right: none;
    border-bottom: 1px solid rgba(0, 240, 255, 0.15);
    background: #080c14;
    min-height: 160px;
    max-height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .product-detail-img-wrapper img {
    max-height: 180px;
    width: auto;
  }

  .product-detail-info {
    padding: 1.25rem 1rem;
    max-height: none;
  }

  .product-detail-title {
    font-size: 1.25rem;
  }

  .product-detail-price {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
  }

  .product-detail-desc {
    max-height: 120px;
    font-size: 0.84rem;
    margin-bottom: 1rem;
  }

  .variant-group {
    margin-bottom: 1rem;
  }

  .variant-label {
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
  }

  .variant-btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
  }

  .add-to-cart-action {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .premium-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .store-title {
    font-size: 2.2rem;
  }

  .cart-item {
    grid-template-columns: 60px 1fr;
    gap: 1rem;
  }

  .cart-item-img {
    width: 60px;
    height: 60px;
  }
}

/* Prefers Reduced Motion in Merch */
@media (prefers-reduced-motion: reduce) {
  .spinner,
  .cart-glow-pulse,
  .success-order-status span,
  .fallback-status span {
    animation: none !important;
  }
  
  .cart-drawer,
  .modal-overlay,
  .modal-content,
  .premium-card img,
  .quick-view-overlay {
    transition: none !important;
    transform: none !important;
  }

  .cart-drawer.open {
    transform: none !important;
  }
}
