/* Maker Components: section cards, chips, buttons, grid */

:root {
  --ink-1: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --bg-card: rgba(255,255,255,0.9);
  --card-surface: #f2f4f9;
  --bg-chip: #f3f4f6;
  --bd-chip: #e5e7eb;
  --grad-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.section-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid rgba(0,0,0,0.04);
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;            /* allow chips to wrap under title on small screens */
  row-gap: 10px;
}

.section-title { display: flex; align-items: center; gap: 10px; }
.section-title h3 { margin: 0; font-size: 1.1rem; color: var(--ink-1); }

.chips { display: flex; gap: 12px; padding: 12px 0; margin-bottom: 12px; overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 8px 16px;
  background: var(--bg-chip);
  border: 2px solid var(--bd-chip);
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, color .2s ease;
  white-space: nowrap;
}
.chip:hover { background: #111827; color: #fff; border-color: #111827; transform: translateY(-1px); }
.chip.active { background: #111827; color: #fff; border-color: #111827; }

.btn-refresh {
  padding: 8px 18px;
  background: var(--grad-primary);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(102,126,234,.3);
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn-refresh:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(102,126,234,.4); }

.grid-cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px 8px; min-height: 240px; }
.grid-cards.tight { gap: 8px; }
.grid-cards.single { grid-template-columns: 1fr; }
.grid-cards.duo { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-span-all { grid-column: 1 / -1; }
.grid-span-2 { grid-column: span 2; }

.card {
  background: var(--card-surface);
  border-radius: 0;
  border: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px 16px;
}
.card + .card { margin-top: 16px; }
.card.fake-card { display:flex; align-items:center; justify-content:center; padding: 0; min-height: 140px; background: transparent; cursor:pointer; border: none; }
.card.fake-card:hover { box-shadow: none; }
.card.fake-card.paste-active .fake-inner { border-color: #667eea; box-shadow: inset 0 0 0 2px rgba(102,126,234,.18); background: linear-gradient(180deg, #eef1ff 0%, #f7faff 100%); }
.card.fake-card.paste-active .fake-title { color: #4c51bf; }
.fake-inner { width:100%; height:100%; border: 2px dashed #d8dcff; border-radius: 12px; display:flex; flex-direction:column; align-items:center; justify-content:center; background: linear-gradient(180deg, #fbfcff 0%, #f7faff 100%); }
.fake-title { font-weight: 900; color: #0b1220; }
.fake-sub { margin-top: 6px; color: #6b7280; font-weight: 700; }
.card-thumb {
  position: relative;
  background: var(--card-surface);
  border-radius: 0;
  overflow: hidden;
}
.card-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  border-radius: 0;
}
.badge { position: absolute; top: 6px; right: 6px; padding: 2px 6px; border-radius: 6px; font-size: .75rem; font-weight: 700; color: #fff; }
.badge--hot { background: #ef4444; }
.badge--new { background: #10b981; }
.tag-badge { position:absolute; bottom:6px; right:6px; background:#111827; color:#fff; border:none; border-radius:12px; padding:3px 8px; font-size:.72rem; font-weight:800; cursor:pointer; box-shadow:0 2px 6px rgba(0,0,0,.15); opacity:.6; }
.tag-badge:hover { transform: translateY(-1px); opacity:.9; }
.card-meta {
  padding: 10px 0 0;
  background: var(--card-surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-id-btn {
  background: none;
  border: none;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: .02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.card-id-btn:hover,
.card-id-btn:focus {
  color: #2563eb;
  outline: none;
}

.card-id-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: .02em;
}

.card-id {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: .02em;
}

.card-body {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--card-surface);
}
.btn { flex: 1; border: none; border-radius: 0; padding: 10px 14px; font-size: .9rem; font-weight: 800; cursor: pointer; position: relative; white-space: nowrap; }
.btn-sm { padding: 8px 10px; font-size: .8rem; font-weight: 700; }
.btn-view { background: var(--grad-primary); color: #fff; box-shadow: none; opacity: 0.8; }
.btn-print {
  background: white;
  color:#111827;
  border: none;
  box-shadow: none;
  outline: none;
  opacity: 0.7;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}
.btn-view:hover { filter: brightness(1.03); opacity: 1; }
.btn-print:hover { background: #FAFAFA; border: none; outline: none; opacity: 0.9; }
/* Removed AI pill - no longer needed */

/* Discover toolbar (chips + actions) */
.discover-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-bottom: 8px; }
.discover-toolbar .chips { flex: 1 1 auto; overflow-x:auto; padding-bottom:6px; }
.discover-toolbar .btn-refresh { flex: 0 0 auto; }

/* Refine Hot & New quick filters as plain clickable text */
#hotnew-chips.chips { gap: 18px; padding-top: 6px; padding-bottom: 10px; }
#hotnew-chips .chip {
  background: transparent;
  border: none;
  appearance: none;
  padding: 0;
  border-radius: 0;
  color: var(--ink-2);
  font-weight: 800;
}
#hotnew-chips .chip:hover { background: transparent; border: none; text-decoration: underline; transform: none; color: var(--ink-1); }
#hotnew-chips .chip.active { background: transparent; border: none; color: var(--ink-1); text-decoration: underline; }

/* Compact card for mobile usability: bigger image, tighter actions */
.card.compact { padding: 8px !important; }
.card.compact .card-meta { padding: 6px 0; gap: 10px; flex-direction: row !important; justify-content: space-between; }
.card.compact .card-body { gap: 6px; background: transparent; margin-top: 6px; }
.card.compact .btn { padding: 10px 12px; font-size: 14px; font-weight: 700; opacity: 0.8; border-radius: 8px; }
.card.compact .btn-print { opacity: 0.7; }
.card.compact .badge { transform: scale(.85); transform-origin: top right; }
.card.compact .card-id-text { font-size: 11px; font-weight: 500; color: #94a3b8; opacity: 0.8; }
/* Hide TAG on mobile, only show ID */
.card.compact .card-meta span:last-child:not(:first-child) { display: none; }

/* Ultra small screens */
@media (max-width: 360px) {
  .grid-cards { grid-template-columns: 1fr; }
}

/* Mobile styles */
@media (max-width: 768px) {
  .section-card {
    padding: 8px !important;
  }
  .card {
    border-radius: 12px !important;
    padding: 8px !important;
  }
  .card-thumb {
    border-radius: 8px !important;
    margin: 0 !important;
  }
  .card-thumb img {
    border-radius: 8px !important;
  }
  .btn {
    border-radius: 8px !important;
  }
  .grid-cards {
    gap: 8px !important;
  }
}

/* Mobile-first → enhance as width grows */
@media (min-width: 560px) {
  .grid-cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (min-width: 900px) {
  .grid-cards { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .section-card { padding: 18px; }
}

@media (min-width: 1200px) {
  .grid-cards { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .chips { overflow-x: visible; }
  .btn { font-size: .85rem; padding: 8px 10px; font-weight: 600; }
}

/* Force mobile-friendly columns inside local preview mode */
#preview-wrap.mobile .grid-cards { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }

.skeleton-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  border-radius: 16px;
  background: #f3f4f6;
  min-height: 260px;
}

.skeleton-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,0.2) 25%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0.2) 75%);
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.6s infinite;
}

.skeleton-card .card-overlay,
.skeleton-card .card-foot,
.skeleton-card .skeleton-title,
.skeleton-card .skeleton-tags,
.skeleton-card .skeleton-cta {
  position: relative;
  z-index: 1;
}

.skeleton-card .card-foot {
  padding: 16px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(4px);
  display: grid;
  gap: 10px;
}

.skeleton-title,
.skeleton-tags,
.skeleton-cta {
  height: 14px;
  border-radius: 8px;
  background: #e5e7eb;
}

.skeleton-title { width: 70%; height: 16px; }
.skeleton-tags { width: 90%; }
.skeleton-cta { width: 40%; height: 32px; border-radius: 16px; }

@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

/* Mobile Sticky Action Bar */
.mobile-sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10110; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0)); background: linear-gradient(180deg, rgba(255,255,255,.0) 0%, rgba(255,255,255,.85) 30%, #fff 100%); backdrop-filter: blur(10px); border-top: 1px solid rgba(0,0,0,.06); }
.mobile-sticky { pointer-events: auto; display: none !important; }
.mobile-sticky .ms-btn { height: 46px; border: 2px solid #e5e7eb; border-radius: 12px; font-weight: 900; background: #fff; color: #111827; }
.mobile-sticky .ms-btn.primary { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border-color: transparent; box-shadow: 0 6px 14px rgba(102,126,234,.28); }

/* Add bottom space so content isn't hidden under bar */
.has-mobile-bar main.container { padding-bottom: 90px; }

@media (min-width: 769px) {
  .mobile-sticky { display: none !important; }
  .has-mobile-bar main.container { padding-bottom: 0; }
}

/* Prevent overlaying preview toggle when cart is open */
body.cart-open #preview-toggle { display: none !important; }
