/* ==========================================================================
   SPEEDMATH — PUBLIC eBOOK STORE
   ========================================================================== */

/* ==========================================================================
   1. STORE GRID & CARDS
   ========================================================================== */

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-6);
  max-width: var(--content-xl);
  margin: 0 auto;
  margin-bottom: 30px;
  margin-top: -30px;
}

.store-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.store-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

.store-card-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--bg-section-soft);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.store-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.store-card-cover-placeholder {
  color: var(--text-muted);
  opacity: 0.4;
}

.store-card-cover-placeholder .lucide {
  width: 48px;
  height: 48px;
}

.store-card-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.store-card-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--text-main);
  margin: 0 0 var(--space-2);
  line-height: var(--lh-tight);
}

.store-card-desc {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  line-height: var(--lh-relaxed);
  margin: 0 0 var(--space-4);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.store-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: auto;
}

.store-card-price {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.store-price-symbol {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  color: var(--text-main);
}

.store-price-amount {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-black);
  color: var(--text-main);
  line-height: 1;
}

.store-price-free {
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  color: var(--color-success);
  background: var(--color-success-bg);
  padding: 0px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
}

/* ==========================================================================
   2. PURCHASED BADGE
   ========================================================================== */

.store-purchased-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(22, 163, 74, 0.25);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

.store-purchased-badge .lucide {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   3. STORE DETAIL PAGE
   ========================================================================== */

.store-detail-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-8);
  max-width: 1080px;
  margin: 0 auto;
  margin-bottom: 30px;
  align-items: start;
}

.store-detail-left {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
}

.store-detail-cover {
  width: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-section-soft);
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
}

.store-detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.store-detail-title {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-extrabold);
  color: var(--text-main);
  margin: 0 0 var(--space-4);
  line-height: var(--lh-tight);
}

.store-detail-desc {
  font-size: var(--fs-base);
  color: var(--text-soft);
  line-height: var(--lh-relaxed);
  margin: 0;
}

.store-detail-desc p { margin: 0 0 var(--space-3); }
.store-detail-desc p:last-child { margin-bottom: 0; }
.store-detail-desc ul,
.store-detail-desc ol {
  margin: 0 0 var(--space-3);
  padding-left: 2rem;
}
.store-detail-desc ul { list-style: disc; }
.store-detail-desc ol { list-style: decimal; }
.store-detail-desc li {
  margin-bottom: var(--space-2);
  padding-left: 0.25rem;
}
.store-detail-desc strong { color: var(--text-main); font-weight: var(--fw-semibold); }
.store-detail-desc blockquote {
  border-left: 3px solid var(--accent-primary);
  margin: var(--space-3) 0;
  padding: var(--space-2) var(--space-4);
  color: var(--text-muted);
  font-style: italic;
}

.store-purchase-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--text-main);
  line-height: var(--lh-tight);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

/* Sticky purchase card */
.store-purchase-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  position: sticky;
  top: 90px;
}

.store-purchase-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.store-purchase-price-label {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
}

.store-purchase-price-value {
  display: flex;
  align-items: baseline;
  gap: 1px;
}

.store-coupon-wrap {
  margin-bottom: var(--space-3);
}
.store-coupon-row {
  display: flex;
  gap: 6px;
}
.store-coupon-input {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-main);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  outline: none;
  transition: border-color var(--transition-fast);
}
.store-coupon-input:focus { border-color: var(--accent-primary); }
.store-coupon-btn {
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--btn-gradient);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.store-coupon-btn:hover { background: var(--accent-gradient); }
.store-coupon-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.store-coupon-msg {
  font-size: 12px;
  margin-top: 5px;
}
.store-coupon-msg--ok  { color: var(--color-success, #16a34a); }
.store-coupon-msg--err { color: var(--color-error, #dc2626); }

.store-buy-btn {
  width: 100%;
  margin-bottom: var(--space-3);
}

.store-download-btn {
  width: 100%;
  margin-bottom: var(--space-3);
}

.store-login-hint {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-soft);
  margin-top: var(--space-3);
}

.store-login-hint a {
  color: var(--accent-primary);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

.store-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
  background: var(--admin-hover-bg);
  text-decoration: none;
  padding: 2px 12px;
  margin-bottom: var(--space-6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: color var(--transition-fast);
}

.store-back-link:hover { color: var(--accent-primary); background: var(--admin-active-bg); }
.store-back-link .lucide { width: 16px; height: 16px; }

/* ==========================================================================
   4. PURCHASED SUCCESS FLASH
   ========================================================================== */

.store-success-flash {
  background: var(--color-success-bg);
  border: 1px solid rgba(22, 163, 74, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: var(--content-xl);
  margin: 0 auto var(--space-6);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-success);
}

.store-success-flash .lucide {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ==========================================================================
   5. SAMPLE PAGES GALLERY
   ========================================================================== */

.store-sample-section {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
}

.store-sample-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
  margin-bottom: var(--space-3);
}

.store-sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-3);
}

.store-sample-thumb {
  border: none;
  padding: 0;
  background: var(--bg-section-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 3 / 4;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.store-sample-thumb:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.store-sample-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==========================================================================
   6. LIGHTBOX
   ========================================================================== */

.store-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.store-lightbox[hidden] { display: none; }

.store-lightbox-img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  display: block;
}

.store-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: background var(--transition-fast);
}

.store-lightbox-close:hover { background: rgba(255,255,255,0.25); }
.store-lightbox-close .lucide { width: 20px; height: 20px; }

.store-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: background var(--transition-fast);
}

.store-lightbox-nav:hover { background: rgba(255,255,255,0.25); }
.store-lightbox-nav .lucide { width: 22px; height: 22px; }
.store-lightbox-prev { left: 16px; }
.store-lightbox-next { right: 16px; }

/* ==========================================================================
   7. EMPTY STATE
   ========================================================================== */

.store-empty {
  text-align: center;
  padding: var(--space-16) var(--space-4);
  color: var(--text-soft);
}

.store-empty .lucide {
  width: 48px;
  height: 48px;
  opacity: 0.3;
  margin-bottom: var(--space-4);
}

/* ==========================================================================
   6. RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
  .store-detail-layout {
    grid-template-columns: 1fr;
  }

  .store-purchase-card {
    position: static;
  }
}

@media (max-width: 480px) {
  .store-grid {
    grid-template-columns: 1fr;
    max-width: 380px;
  }

  .store-detail-title {
    font-size: var(--fs-2xl);
  }
}
