/* =========================================================
   textbooks.css — "School / Purple" theme (Base44-like)
   Structure: ub-hero, ub-filter-card, tb-year, tb-grid cards
   ========================================================= */

:root{
  --ink:#0f172a;
  --muted:rgba(15,23,42,.62);

  --card:rgba(255,255,255,.86);
  --stroke:rgba(15,23,42,.10);

  --p1:#5b21b6;   /* violet */
  --p2:#7c3aed;   /* purple */
  --p3:#2563eb;   /* blue */

  --shadow: 0 18px 50px rgba(2,6,23,.10);
  --shadow2: 0 10px 24px rgba(2,6,23,.08);

  --r:20px;
  --r2:22px;
}

/* =========================================================
   BACKDROP
   ========================================================= */
body.km-layout{
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 12% 0%, rgba(124,58,237,.14), transparent 62%),
    radial-gradient(900px 420px at 86% 6%, rgba(37,99,235,.12), transparent 62%),
    linear-gradient(180deg, #f7f5ff, #ffffff 42%, #f6f7ff);
}

/* =========================================================
   HERO
   ========================================================= */
.ub-hero{
  position: relative;
  overflow: hidden;
  padding: 62px 0 30px;
  color: #fff;

  background:
    radial-gradient(900px 420px at 20% 18%, rgba(255,255,255,.14), transparent 60%),
    radial-gradient(900px 420px at 85% 12%, rgba(255,255,255,.10), transparent 60%),
    linear-gradient(120deg, var(--p1), var(--p2) 55%, var(--p3));
}

.ub-hero-inner{
  position: relative;
  max-width: 980px;
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  padding-bottom: 46px !important; /* компактно */
}

.ub-hero-icons{
  display:flex;
  gap:12px;
  font-size: 28px;
  opacity: .95;
  margin-bottom: 10px;
}

.ub-hero-title{
  margin: 0 0 10px;
  font-weight: 950;
  letter-spacing: .2px;
  text-shadow: 0 12px 26px rgba(0,0,0,.18);
  font-size: clamp(2.2rem, 3.4vw, 3.2rem);
}

.ub-hero-subtitle{
  margin: 8px 0 0;
  max-width: 760px;
  line-height: 1.55;
  font-size: 1.05rem;
  font-weight: 800;
  color: rgba(255,255,255,.95) !important;
  text-shadow: 0 2px 10px rgba(0,0,0,.45) !important;

  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(6px);

  transform: translateY(-10px);
}

/* махаме вълната/лентата */
.ub-hero-wave{ display:none !important; }

/* =========================================================
   MAIN / FILTER
   ========================================================= */
.ub-main{ padding: 24px 0 58px; }

.ub-filter-wrap{
  margin-top: 40px;
  position: relative;
  z-index: 5;
}

.ub-filter-card{
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  border-radius: var(--r2);
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.ub-filter-head{
  display:flex;
  align-items:center;
  gap: 10px;
  margin-bottom: 10px;
}

.ub-filter-ico{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background: linear-gradient(135deg, rgba(124,58,237,.16), rgba(37,99,235,.12));
  border: 1px solid rgba(15,23,42,.08);
  box-shadow: 0 10px 20px rgba(2,6,23,.06);
}

.ub-filter-title{
  flex: 1;
  font-weight: 950;
  letter-spacing: .12px;
}

.ub-label{
  display:block;
  margin-bottom: 6px;
  font-weight: 900;
  font-size: .92rem;
  color: rgba(15,23,42,.78);
}

.ub-input{
  border-radius: 16px !important;
  border: 1px solid rgba(15,23,42,.14) !important;
  background: rgba(255,255,255,.95) !important;
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.ub-input:hover{ transform: translateY(-1px); }
.ub-input:focus{
  border-color: rgba(124,58,237,.55) !important;
  box-shadow: 0 0 0 .25rem rgba(124,58,237,.16) !important;
}

/* =========================================================
   YEAR CARD (Base44-like) + hover border
   ========================================================= */
.tb-year{
  max-width: 1100px;
  margin: 18px auto 0;
  padding: 18px 18px 16px;
  border-radius: var(--r2);
  background: rgba(255,255,255,.78);
  border: 1.5px solid rgba(124,58,237,.28);
  box-shadow:
    0 18px 50px rgba(2,6,23,.10),
    inset 0 0 0 1px rgba(255,255,255,.35);
  backdrop-filter: blur(10px);

  position: relative;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.tb-year::before{
  content:"";
  position:absolute;
  inset: 6px;
  border-radius: 18px;
  border: 1px dashed rgba(124,58,237,.18);
  pointer-events:none;
}

.tb-year:hover{
  transform: translateY(-4px);
  border-color: rgba(124,58,237,.45);
  box-shadow:
    0 26px 70px rgba(2,6,23,.14),
    0 0 0 6px rgba(124,58,237,.08),
    inset 0 0 0 1px rgba(255,255,255,.45);
}

.tb-year-title{
  font-weight: 950;
  font-size: 1.15rem;
  margin-bottom: 4px;
  display:flex;
  align-items:center;
  gap:8px;
  transition: color .22s ease;
}

.tb-year:hover .tb-year-title{ color: #4c1d95; }

.tb-year-sub{
  color: rgba(15,23,42,.62);
  font-weight: 800;
  margin-bottom: 12px;
}

.tb-chips{
  display:flex;
  flex-wrap:wrap;
  gap: 10px 12px;
}

.tb-chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;

  font-weight: 900;
  font-size: .86rem;
  color: rgba(15,23,42,.78);

  background: rgba(124,58,237,.10);
  border: 1px solid rgba(124,58,237,.14);

  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.tb-chip::before{
  content:"✔";
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 22px;
  height: 22px;
  border-radius: 8px;

  background: rgba(124,58,237,.12);
  border: 1px solid rgba(124,58,237,.18);
  color: rgba(15,23,42,.85);
  font-weight: 950;
  line-height: 1;
}

.tb-chip:hover{
  transform: translateY(-1px);
  background: rgba(124,58,237,.14);
  box-shadow: 0 8px 18px rgba(124,58,237,.18);
}

/* =========================================================
   EMPTY (with animation)
   ========================================================= */
.tb-empty{
  max-width: 1100px;
  margin: 14px auto 0;
  border-radius: var(--r2);
  padding: 20px 18px;
  text-align:center;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: var(--shadow2);

  position: relative;
  overflow: hidden;

  /* ✅ animation */
  opacity: 0;
  transform: translateY(10px) scale(.985);
  animation: tb-empty-in .48s cubic-bezier(.2,.8,.2,1) forwards;
}

@keyframes tb-empty-in{
  to{ opacity: 1; transform: translateY(0) scale(1); }
}

/* subtle shimmer line */
.tb-empty::before{
  content:"";
  position:absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(124,58,237,.10), transparent);
  transform: translateX(-120%);
  animation: tb-empty-shine 1.1s ease forwards;
  pointer-events:none;
}

@keyframes tb-empty-shine{
  to{ transform: translateX(120%); }
}

.tb-empty-title{ font-weight: 950; font-size: 1.1rem; }
.tb-empty-sub{ color: rgba(15,23,42,.62); font-weight: 800; }

/* helper class to re-trigger animation */
.tb-empty.tb-anim-reset{
  animation: none !important;
}
.tb-empty.tb-anim-reset::before{
  animation: none !important;
}

/* =========================================================
   CARDS GRID (like books.php)
   ========================================================= */
.tb-meta{
  max-width: 1100px;
  margin: 16px auto 10px;
  font-weight: 900;
  color: rgba(15,23,42,.65);
}

/* ONE ROW SCROLL */
.tb-grid-scroll{
  display: flex;
  gap: 24px;
  overflow-x: auto;
  padding: 10px 4px 24px;
  scroll-snap-type: x mandatory;
}
.tb-grid-scroll::-webkit-scrollbar{ height: 10px; }
.tb-grid-scroll::-webkit-scrollbar-thumb{
  background: rgba(124,58,237,.35);
  border-radius: 10px;
}
.tb-grid-scroll .tb-card{
  flex: 0 0 auto;
  width: 280px;
  scroll-snap-align: start;
}

.tb-card{
  border-radius: 20px;
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: 0 10px 24px rgba(2,6,23,.08);
  overflow: hidden;

  transform: translateY(0);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;

  opacity: 0;
  animation: tb-popcard .45s cubic-bezier(.2,.8,.2,1) forwards;
  animation-delay: var(--d, 0ms);
}

@keyframes tb-popcard{
  from{ opacity:0; transform: translateY(12px) scale(.985); }
  to{ opacity:1; transform: translateY(0) scale(1); }
}

.tb-card:hover{
  transform: translateY(-4px);
  box-shadow: 0 26px 70px rgba(2,6,23,.14);
  border-color: rgba(124,58,237,.22);
}

/* ✅✅✅ ONLY CHANGE AREA: tb-media + tb-img (NO CROPPING) */
.tb-media{
  position: relative;
  background: rgba(241,245,249,.8);
  display:flex;
  align-items:center;
  justify-content:center;
}

.tb-img{
  width: 100%;
  height: 230px;
  object-fit: contain;         /* ✅ show whole image */
  background: rgba(241,245,249,.8);
  display: block;
  transform: scale(1);
  transition: transform .25s ease, filter .25s ease;
}

.tb-card:hover .tb-img{
  transform: scale(1.03);
  filter: saturate(1.05);
}

.tb-noimg{
  height: 230px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 34px;
  color: rgba(15,23,42,.45);
}

.tb-tag{
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  font-weight: 950;
  font-size: .82rem;
  color: #120a2a;
  background: linear-gradient(90deg, rgba(124,58,237,.18), rgba(37,99,235,.16));
  border: 1px solid rgba(124,58,237,.22);
  box-shadow: 0 14px 24px rgba(0,0,0,.10);
}

.tb-body{ padding: 14px 14px 12px; }

.tb-title{
  margin: 6px 0 4px;
  font-weight: 950;
  line-height: 1.2;
}

.tb-sub{
  color: rgba(15,23,42,.62);
  font-weight: 800;
}

.tb-row{
  margin-top: 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}

.tb-price{
  font-weight: 950;
  padding: 7px 10px;
  border-radius: 999px;
  color: #0a2a17;
  background: rgba(124,58,237,.10);
  border: 1px solid rgba(124,58,237,.14);
}

.tb-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 950;
  text-decoration:none;
  color:#fff;

  background: linear-gradient(135deg, var(--p2), var(--p3));
  box-shadow: 0 16px 30px rgba(2,6,23,.12);

  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.tb-btn:hover{
  transform: translateY(-2px);
  box-shadow: 0 22px 44px rgba(2,6,23,.16);
  filter: brightness(1.02);
  color:#fff;
}

/* =========================================================
   ENTER ANIMATIONS (hero/filter/year)
   ========================================================= */
.ub-hero .ub-hero-icons,
.ub-hero .ub-hero-title,
.ub-hero .ub-hero-subtitle{
  opacity: 0;
  transform: translateY(10px);
  animation: tb-fade-up .55s cubic-bezier(.2,.8,.2,1) forwards;
}
.ub-hero .ub-hero-icons{ animation-delay: .05s; }
.ub-hero .ub-hero-title{ animation-delay: .12s; }
.ub-hero .ub-hero-subtitle{ animation-delay: .20s; }

.ub-filter-card{
  opacity: 0;
  transform: translateY(14px) scale(.99);
  animation: tb-pop .55s cubic-bezier(.2,.8,.2,1) forwards;
  animation-delay: .28s;
}

.tb-year{
  opacity: 0;
  transform: translateY(14px) scale(.99);
  animation: tb-pop .55s cubic-bezier(.2,.8,.2,1) forwards;
  animation-delay: .38s;
}

@keyframes tb-fade-up{ to{ opacity:1; transform: translateY(0); } }
@keyframes tb-pop{ to{ opacity:1; transform: translateY(0) scale(1); } }

/* Hide grade badge on textbook cards (1-4, 5-7, 8-12) */
.tb-tag{ display:none !important; }

.tv-avatar-img{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(124,58,237,.18);
  background: rgba(124,58,237,.10);
}

.tb-like{
  position:absolute;
  top:12px;
  right:12px;
  width:38px;
  height:38px;
  border-radius:999px;
  background:rgba(255,255,255,.92);
  display:grid;
  place-items:center;
  cursor:pointer;
  box-shadow:0 8px 20px rgba(0,0,0,.15);
  transition:transform .2s ease, background .2s ease;

  /* ✅ ВАЖНО: най-отгоре + винаги кликаемо */
  z-index: 999;
  pointer-events: auto;

  border:0;
  padding:0;
  outline:0;
  user-select:none;
}

.tb-media{ position: relative; }

.tb-like:hover{ transform: scale(1.08); }

.tb-like:focus{ outline: none; }
.tb-like:focus-visible{
  box-shadow: 0 0 0 4px rgba(124,58,237,.18), 0 8px 20px rgba(0,0,0,.15);
}

/* SVG icon */
.tb-like-ico{
  width: 20px;
  height: 20px;

  fill: transparent;
  stroke: #cbd5e1;
  stroke-width: 2;
  transition: fill .2s ease, stroke .2s ease, transform .2s ease;
}

.tb-like.is-active .tb-like-ico{
  fill: #ef4444;
  stroke: #ef4444;
  transform: scale(1.05);
}

