/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #e94560;
  --primary-d: #c0392b;
  --dark:      #1a1a2e;
  --dark2:     #16213e;
  --bg:        #f0f2f5;
  --card-bg:   #ffffff;
  --text:      #1a1a2e;
  --muted:     #6b7280;
  --border:    #e5e7eb;
  --radius:    18px;
  --shadow:    0 4px 24px rgba(0,0,0,.08);
  --shadow-h:  0 12px 40px rgba(0,0,0,.15);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

header {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 100%);
  color: #fff;
  padding: 20px 24px 18px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,.35);
}
header h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: .5px; margin-bottom: 14px; }
header h1 span { color: var(--primary); }

.search-wrap { display: flex; justify-content: center; }
#searchBar {
  width: 100%; max-width: 480px;
  padding: 11px 20px; border-radius: 50px; border: none;
  font-size: .95rem; outline: none;
  background: rgba(255,255,255,.13); color: #fff;
  backdrop-filter: blur(6px);
  transition: background .25s, box-shadow .25s;
}
#searchBar::placeholder { color: rgba(255,255,255,.45); }
#searchBar:focus { background: rgba(255,255,255,.22); box-shadow: 0 0 0 3px rgba(233,69,96,.4); }

.products-wrapper { max-width: 1160px; margin: 32px auto 80px; padding: 0 20px; }
.section-title { font-size: 1rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 20px; }

.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }

.card {
  background: var(--card-bg); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: transform .3s ease, box-shadow .3s ease;
  animation: fadeUp .4s ease both; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-h); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-video { position: relative; padding-top: 56.25%; background: #000; overflow: hidden; }
.card-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; transition: transform .4s ease; }
.card:hover .card-video iframe { transform: scale(1.02); }

.video-fallback {
  display: none; position: absolute; inset: 0; background: var(--dark);
  flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: #fff; font-size: .85rem; text-align: center; padding: 20px;
}
.video-fallback.show { display: flex; }
.video-fallback span { font-size: 2.2rem; }

.btn-open-yt {
  display: inline-block; padding: 9px 20px; background: #ff0000; color: #fff;
  border: none; border-radius: 50px; font-size: .85rem; font-weight: 700;
  cursor: pointer; text-decoration: none; transition: opacity .2s, transform .2s;
}
.btn-open-yt:hover { opacity: .88; transform: scale(1.04); }

.card-body { padding: 18px 18px 20px; display: flex; flex-direction: column; flex: 1; }

.card-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  line-height: 1.45; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card-desc { font-size: .84rem; color: var(--muted); line-height: 1.65; margin-bottom: 6px; flex: 1; }

.show-more-btn {
  background: none; border: none; color: var(--primary);
  font-size: .82rem; font-weight: 600; cursor: pointer;
  padding: 0; margin-bottom: 16px; display: inline-block; transition: opacity .2s;
}
.show-more-btn:hover { opacity: .75; }

.card-actions { display: flex; gap: 10px; margin-top: auto; }

.btn-buy {
  flex: 1; padding: 11px 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  color: #fff; border: none; border-radius: 12px;
  font-size: .92rem; font-weight: 700; cursor: pointer; letter-spacing: .3px;
  transition: opacity .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 14px rgba(233,69,96,.35);
}
.btn-buy:hover { opacity: .92; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(233,69,96,.45); }
.btn-buy:active { transform: scale(.97); }

.btn-share {
  padding: 11px 16px; background: var(--bg); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 12px;
  font-size: .92rem; font-weight: 600; cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
}
.btn-share:hover { background: #e8eaed; border-color: #d1d5db; transform: translateY(-1px); }
.btn-share:active { transform: scale(.97); }

.empty-state { grid-column: 1/-1; text-align: center; padding: 60px 20px; color: #9ca3af; font-size: .95rem; }
.empty-state span { font-size: 3rem; display: block; margin-bottom: 12px; }

#toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(90px);
  background: var(--dark); color: #fff;
  padding: 13px 26px; border-radius: 50px; font-size: .88rem; font-weight: 500;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
  z-index: 999; white-space: nowrap; pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }

@media (max-width: 640px) {
  header h1 { font-size: 1.3rem; }
  .products-wrapper { padding: 0 12px; margin-top: 24px; }
  .products-grid { grid-template-columns: 1fr; gap: 18px; }
  .card-body { padding: 14px 14px 16px; }
  .btn-buy, .btn-share { padding: 10px 12px; font-size: .88rem; }
}
@media (min-width: 641px) and (max-width: 900px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); }
}
