/* ============================================================
   PatternWise Store — shared styles for products + orders pages
   Shopify-inspired clean commerce look, matched to brand sky-blue
   ============================================================ */

:root {
  --sky-blue: #00bfff;
  --deep-sky: #0099cc;
  --gray-light: #f8f9fa;
  --gray-medium: #e5e7eb;
  --text-dark: #1f2937;
  --text-muted: #64748b;
  --border: #e5e7eb;
  --success: #16a34a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #ffffff;
  color: var(--text-dark);
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* Announcement bar (very Shopify) */
.announce-bar {
  background: var(--text-dark);
  color: #fff;
  text-align: center;
  font-size: 0.9rem;
  padding: 10px 1rem;
  letter-spacing: 0.02em;
}

/* Store navbar */
.store-nav {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.store-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.store-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 700;
}
.store-logo svg { width: 34px; height: 34px; }
.store-links { display: flex; gap: 2rem; align-items: center; }
.store-links a { font-weight: 500; transition: color 0.2s; }
.store-links a:hover { color: var(--sky-blue); }
.store-nav-actions { display: flex; align-items: center; gap: 1.25rem; }

/* Cart button with badge */
.cart-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--text-dark);
  display: flex;
  align-items: center;
}
.cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--sky-blue);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Page shell */
.store-main { max-width: 1280px; margin: 0 auto; padding: 3rem 2rem 5rem; }
.store-hero { text-align: center; margin-bottom: 3rem; }
.store-hero h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; margin-bottom: 0.75rem; }
.store-hero p { color: var(--text-muted); font-size: 1.2rem; max-width: 620px; margin: 0 auto; }

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) { .product-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .product-grid { grid-template-columns: 1fr; } }

.product-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.3s, transform 0.3s;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  box-shadow: 0 18px 40px -12px rgba(0, 191, 255, 0.28);
  transform: translateY(-4px);
}
.product-media {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.product-media .doc-icon { font-size: 5rem; opacity: 0.9; }
.product-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.product-media .file-tag {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--deep-sky);
  padding: 4px 10px;
  border-radius: 9999px;
}
.product-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.product-body h3 { font-size: 1.3rem; }
.product-body .tagline { color: var(--text-muted); font-size: 0.98rem; flex: 1; }
.product-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}
.product-price { font-size: 1.4rem; font-weight: 700; }
.price-free { color: var(--success); }

/* Variant (size) multi-select with dot selectors */
.variant-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin: 0.75rem 0 1rem;
}
.variant-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  user-select: none;
}
.variant-row:last-child { border-bottom: none; }
.variant-row:hover { background: #f0f9ff; }
.variant-row.disabled { opacity: 0.4; cursor: not-allowed; }
.variant-row.disabled:hover { background: transparent; }
.variant-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.variant-row .dot {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #cbd5e1; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.variant-row input:checked + .dot { border-color: var(--sky-blue); background: var(--sky-blue); }
.variant-row input:checked + .dot::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff;
}
.variant-row input:focus-visible + .dot { box-shadow: 0 0 0 3px rgba(0,191,255,0.25); }
.variant-row .variant-label { flex: 1; font-weight: 600; }
.variant-row .variant-price { color: var(--deep-sky); font-weight: 700; }
.variant-row input:checked ~ .variant-label { color: var(--deep-sky); }
.variant-hint { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 0.75rem; }

/* Card as a link to the product page */
.product-link { text-decoration: none; color: inherit; }
.view-cta { color: var(--deep-sky); font-weight: 700; }

/* ---------- Product detail page (Shopify-style) ---------- */
.pdp-back { display: inline-block; margin: 0.5rem 0 2.5rem; color: var(--text-muted); font-weight: 600; }
.pdp-back:hover { color: var(--sky-blue); }
.pdp {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}
.pdp-media {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: sticky;
  top: 96px;
}
.pdp-media .doc-icon-lg { font-size: 7rem; opacity: 0.9; }
.pdp-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pdp-info h1 { font-size: 2.6rem; line-height: 1.15; margin-bottom: 0.75rem; }
.pdp-price { font-size: 1.7rem; font-weight: 700; color: var(--deep-sky); margin-bottom: 2rem; }
.pdp-section { border-top: 1px solid var(--border); padding: 2rem 0; }
.pdp-section h3 {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin-bottom: 1rem;
}
.pdp-section p { color: #334155; font-size: 1.05rem; line-height: 1.75; }
.pdp-section .variant-list { margin: 0; }
.pdp-info .btn-block { margin-top: 2.25rem; padding: 16px; font-size: 1.1rem; }
@media (max-width: 800px) {
  .pdp { grid-template-columns: 1fr; gap: 2rem; }
  .pdp-media { position: relative; top: 0; }
  .pdp-info h1 { font-size: 2.1rem; }
}

/* Buttons */
.btn {
  border: none;
  cursor: pointer;
  font-weight: 600;
  border-radius: 9999px;
  padding: 12px 24px;
  font-size: 1rem;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary {
  background: var(--sky-blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 191, 255, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 191, 255, 0.4); }
.btn-outline { background: #fff; color: var(--deep-sky); border: 2px solid var(--sky-blue); }
.btn-outline:hover { background: #f0f9ff; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Cart drawer */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s;
  z-index: 1000;
}
.overlay.open { opacity: 1; visibility: visible; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 420px;
  max-width: 90vw;
  background: #fff;
  z-index: 1001;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
}
.cart-drawer.open { transform: translateX(0); }
.cart-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-header h2 { font-size: 1.4rem; }
.close-x { background: none; border: none; font-size: 1.6rem; cursor: pointer; color: var(--text-muted); }
.cart-items { flex: 1; overflow-y: auto; padding: 1rem 1.5rem; }
.cart-line {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.cart-line .thumb {
  width: 60px; height: 60px; border-radius: 12px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  display: flex; align-items: center; justify-content: center; font-size: 1.8rem;
  flex-shrink: 0;
}
.cart-line .info { flex: 1; }
.cart-line .info .name { font-weight: 600; }
.cart-line .info .meta { font-size: 0.85rem; color: var(--text-muted); }
.cart-line .remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; }
.cart-line .remove:hover { color: #dc2626; }
.cart-empty { text-align: center; color: var(--text-muted); padding: 3rem 1rem; }
.cart-footer { padding: 1.5rem; border-top: 1px solid var(--border); }
.cart-total-row { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; }

/* Modal (checkout + success) */
.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-wrap.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55); }
.modal-card {
  position: relative;
  background: #fff;
  border-radius: 22px;
  width: 100%;
  max-width: 460px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
  animation: pop 0.28s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-card h2 { font-size: 1.5rem; margin-bottom: 0.35rem; }
.modal-sub { color: var(--text-muted); margin-bottom: 1.5rem; }

/* Order summary in checkout */
.summary {
  background: var(--gray-light);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.summary-line { display: flex; justify-content: space-between; padding: 4px 0; }
.summary-total { font-weight: 700; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }

/* Payment options */
.pay-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.pay-tab {
  flex: 1;
  border: 2px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}
.pay-tab.active { border-color: var(--sky-blue); color: var(--deep-sky); background: #f0f9ff; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--text-dark); }
.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  transition: border 0.2s, box-shadow 0.2s;
}
.field input:focus { outline: none; border-color: var(--sky-blue); box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.15); }
.field-row { display: flex; gap: 1rem; }
.field-row .field { flex: 1; }
.field .err { color: #dc2626; font-size: 0.8rem; margin-top: 4px; display: none; }
.field.invalid input { border-color: #dc2626; }
.field.invalid .err { display: block; }

.paypal-mock {
  border: 2px solid #ffc439;
  background: #ffc439;
  color: #003087;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  font-weight: 700;
  font-style: italic;
  font-size: 1.15rem;
  cursor: pointer;
  margin-bottom: 0.75rem;
}
.paypal-note { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin-bottom: 1rem; }

.secure-note {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 0.82rem; color: var(--text-muted); margin-top: 1rem;
}

/* Success / download popup */
.success-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: #dcfce7; color: var(--success);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; margin: 0 auto 1rem;
  animation: popIcon 0.5s ease;
}
@keyframes popIcon { 0% { transform: scale(0); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.download-list { margin: 1.5rem 0; text-align: left; }
.download-list .dl-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px;
}
.download-list .dl-item .dl-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }

/* Orders / history page */
.orders-table { width: 100%; border-collapse: collapse; }
.orders-table th, .orders-table td { text-align: left; padding: 1rem; border-bottom: 1px solid var(--border); }
.orders-table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.order-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.order-card-head {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
  padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.order-id { font-weight: 700; }
.order-date { color: var(--text-muted); font-size: 0.9rem; }
.order-item-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 0;
}
.order-item-row .oi-left { display: flex; align-items: center; gap: 12px; }
.order-item-row .oi-thumb {
  width: 48px; height: 48px; border-radius: 10px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}
.empty-state { text-align: center; padding: 5rem 1rem; color: var(--text-muted); }
.empty-state .big { font-size: 4rem; margin-bottom: 1rem; }

.badge-paid {
  background: #dcfce7; color: var(--success);
  font-size: 0.78rem; font-weight: 700; padding: 4px 12px; border-radius: 9999px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--text-dark); color: #fff;
  padding: 14px 24px; border-radius: 12px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25); z-index: 1200;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1); max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Footer (shared minimal) */
.store-footer {
  background: #0f172a; color: #fff; padding: 3rem 2rem; text-align: center;
}
.store-footer .fl { display: flex; gap: 1.5rem; justify-content: center; margin: 1rem 0; flex-wrap: wrap; }
.store-footer .fl a { opacity: 0.8; }
.store-footer .fl a:hover { opacity: 1; color: var(--sky-blue); }
.store-footer .copy { opacity: 0.6; font-size: 0.9rem; margin-top: 1rem; }

@media (max-width: 640px) {
  .store-nav-inner { padding: 0 1rem; }
  .store-links { gap: 1rem; font-size: 0.95rem; }
  .store-main { padding: 2rem 1rem 4rem; }
  .field-row { flex-direction: column; gap: 0; }
}
