/* ===== LESSONS V2 (MOBILE FIRST) ===== */


/* TOP */
.lessons-top h1 {
  font-size: 20px;
  margin-bottom: 12px;
}

/* GRID */
/* =========================
   GRID – 3 PER ROW
========================= */

/* =========================
   LESSON GRID – MIN 2 PER ROW
========================= */

.lessons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* с 650px — 3 в ряд */
@media (min-width: 500px) {
  .lessons-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* если хочешь ещё лучше — с 1100px можно 4 */
@media (min-width: 800px) {
  .lessons-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1500px) {
  .lessons-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* CARD */
.lesson-tile {
  background: var(--surface);
  color: var(--text);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}

.lesson-tile:active {
  transform: scale(.98);
}

/* IMAGE */
.lesson-img {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.lesson-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* DONE BADGE */
.lesson-check {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 600;
}

/* TITLE */
.lesson-name {
  padding: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
}

body {
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}


.lesson-name {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* =========================
   LESSONS – DASHBOARD STYLE
========================= */


/* HEADER */
.section-header {
  justify-content: center;
  margin-bottom: 10px;
}

.section-header h2 {
  font-size: 20px;
  margin: 0;
}

/* =========================
   TOPIC SWITCH – SMOOTH
========================= */

.topics-row {
  display: flex;
  justify-content: center;
}

.topics-switch {
  position: relative;
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}


/* кнопки */
.topic-btn {
  position: relative;
  z-index: 2;
  border: none;
  background: transparent;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 400;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
}

/* активный текст */
.topic-btn.active {
  font-weight: 500;
}


/* =========================
   SEARCH
========================= */

.lessons-search {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-sizing: border-box;
  height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1;
}

.lessons-search:focus {
  outline: none;
  border-color: #c7d2fe;
}



/* убираем стрелки */
.filters-arrow {
  display: none;
}

.filters-container {
  display: flex;
  gap: 6px;
}

/* =========================
   CARD MEDIA (наследует dashboard)
========================= */

.card-media {
  position: relative;
  display: block;
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.card-media:hover {
  transform: translateY(-2px);
}


.card-media__image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.card-media__image {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.card-media__title {
  
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: 42px;   /* фиксируем высоту блока с текстом */
  display: flex;
  align-items: flex-end;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.2), transparent);
  z-index: 2;
}

/* =========================
   OTHER TOPICS
========================= */

.other-topics-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.other-topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s ease;
}

.other-topic-card:hover {
  transform: translateY(-2px);
}

.other-topic-icon {
  font-size: 22px;
}


.filters-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 2px;
}

.filters-scroll::-webkit-scrollbar {
  display: none;
}



/* =========================
   FILTER TAGS — iOS / TG style
========================= */

.filter-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 1px 12px;

  font-size: 13px;
  font-weight: 500;

  border-radius: 999px;

  background: transparent;
  color: var(--text);

  border: 1px solid var(--border);

  cursor: pointer;
  white-space: nowrap;

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

.filters-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  align-items: center;
}

.filter-tag {
  height: 32px;
  padding: 0 14px;
}
/* hover */

.filter-tag:hover {
  background: var(--surface-2);
}

/* active */

.filter-tag.active {
  background: var(--surface);
  border: 1px solid var(--text-muted);

  box-shadow:
    0 2px 6px rgba(0,0,0,0.08),
    inset 0 0 0 1px rgba(0,0,0,0.04);

  color: var(--text);
  font-weight: 600;
}

/* click */

.filter-tag:active {
  transform: scale(.96);
}


.filter-tag span {
  display: inline-flex;        /* Для текста внутри тега тоже сделаем flex */
  align-items: center;         /* Центрируем по вертикали */
}



.tabs-header {
  display: flex;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 14px;
  margin: 0;              
}

.tabs-header,
.search-container {
  width: 100%;
}

.tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: transparent;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.wrapper {
  padding: 0;     /* оставляем боковые */
  display: flex;
  flex-direction: column;
  gap: 16px;         /* вот главный магический параметр */
}

.dashboard-section {
  display: flex;
  flex-direction: column;
    gap: 12px;
}


.is-hidden {
  display: none;
}

.dashboard-v2 {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px clamp(16px, 3vw, 32px) 96px;
  box-sizing: border-box;
}

.lessons-container {
  background: var(--surface);
  border-radius: 18px;
  padding: 0px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-media__image {
  position: relative;
}

.favorite-btn {
  opacity: 0;
  transition: opacity 0.2s ease;
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(6px);
  color: white;
  cursor: pointer;
  z-index: 10;
}

/* Появляется на десктопе при hover */
@media (hover: hover) {
  .card-media:hover .favorite-btn {
    opacity: 1;
  }
}

/* На мобильных — всегда доступно, но без эффекта hover */



@media (max-width: 768px) {
  .favorite-btn {
    display: none !important;
  }
}

.favorite-toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(20px);

  background: var(--overlay-strong);
  color: #fff;
  padding: 12px 18px;
  border-radius: 20px;

  font-size: 14px;
  font-weight: 500;

  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;

  z-index: 9999;
  white-space: nowrap;
}

.favorite-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== HEART OVERLAY PREMIUM ===== */

.heart-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  background: var(--overlay);
  backdrop-filter: blur(4px);

  pointer-events: none;
  z-index: 30;
}

.heart-overlay {
  opacity: 0;
}

.heart-overlay.add,
.heart-overlay.remove {
  opacity: 1;
}

.heart-icon {
  width: 110px;
  height: 110px;
  fill: white;
  position: absolute;
  opacity: 0;
}

/* ================= ADD ================= */

/* ================= ADD ================= */

.heart-overlay.add .heart-full {
  animation: heartPop 0.75s ease forwards;
}

@keyframes heartPop {
  0%   { transform: scale(.5); opacity: 0; }
  40%  { transform: scale(1.25); opacity: 1; }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 0; }
}

/* ================= REMOVE ================= */

.heart-overlay.remove .heart-broken {
  animation: heartBreak 0.85s ease forwards;
}

@keyframes heartBreak {
  0%   { transform: scale(1); opacity: 1; }
  40%  { transform: scale(1.15); }
  70%  { transform: scale(.95) rotate(-8deg); }
  100% { transform: scale(.6) rotate(-15deg); opacity: 0; }
}

/* ===== CARD REMOVE ANIMATION ===== */

.card-media.removing {
  animation: cardRemove .6s ease forwards;
}

@keyframes cardRemove {
  0%   { opacity: 1; transform: scale(1); }
  50%  { opacity: .7; transform: scale(.95); }
  100% { opacity: 0; transform: scale(.85); }
}

/* ===== PREMIUM HEART BREAK ===== */

.heart-overlay.remove .heart-broken {
  opacity: 1;
}

.heart-left,
.heart-right {
  fill: white;
  transform-origin: center;
  opacity: 0;
}

/* Анимация запускается только при remove */


/* ===== SLOW PREMIUM HEART BREAK ===== */

.heart-overlay.remove .heart-left {
  animation: breakLeftSlow 1.2s cubic-bezier(.22,.61,.36,1) forwards;
}

.heart-overlay.remove .heart-right {
  animation: breakRightSlow 1.2s cubic-bezier(.22,.61,.36,1) forwards;
}

@keyframes breakLeftSlow {
  0% {
    transform: translateX(0) rotate(0) scale(1);
    opacity: 1;
  }
  35% {
    transform: translateX(-4px) rotate(-6deg) scale(1.05);
  }
  60% {
    transform: translateX(-8px) rotate(-10deg) scale(1);
  }
  100% {
    transform: translateX(-20px) rotate(-18deg) scale(.75);
    opacity: 0;
  }
}

@keyframes breakRightSlow {
  0% {
    transform: translateX(0) rotate(0) scale(1);
    opacity: 1;
  }
  35% {
    transform: translateX(4px) rotate(6deg) scale(1.05);
  }
  60% {
    transform: translateX(8px) rotate(10deg) scale(1);
  }
  100% {
    transform: translateX(20px) rotate(18deg) scale(.75);
    opacity: 0;
  }
}

.empty-state {
  grid-column: 1 / -1;   /* занимает все колонки */
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 60px 20px;
  opacity: 0.6;
  font-size: 14px;
}

/* =========================
   SMALL FAVORITE HEART ONLY
========================= */

.card-media::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;

  width: 20px;
  height: 20px;

  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='rgba(255,255,255,0.7)' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 21s-7-4.5-9-9c-1.5-3.5 1-7 4.5-7 2 0 3.5 1.5 4.5 3 1-1.5 2.5-3 4.5-3 3.5 0 6 3.5 4.5 7-2 4.5-9 9-9 9z'/%3E%3C/svg%3E");

  background-size: contain;
  background-repeat: no-repeat;

  opacity: 0;
  transform: scale(.8);
  transition: opacity .25s ease, transform .25s ease;

  z-index: 40;
}

/* показываем если в избранном */
.card-media[data-favorite="1"]::after {
  opacity: 1;
  transform: scale(1);
}

/* =========================
   STORE TILE
========================= */

.store-tile {
  position: relative;
}

.store-price-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;

  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);

  color: #fff;
  font-size: 13px;
  font-weight: 600;

  padding: 6px 10px;
  border-radius: 10px;

  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Темная тема */
body.dark .store-price-badge {
  background: rgba(15, 15, 15, 0.85);
  color: #fff;
}


.tag-filters {
  height: 36px;
  display: flex;
  align-items: center;
}

/* =========================
   ADMIN ACTIONS
========================= */

.admin-actions {

  display: flex;
  justify-content: center;
  gap: 10px;

  margin-bottom: 12px;
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;            /* уменьшить расстояние между иконкой и текстом */
  padding: 4px 10px;    /* уменьшить padding */
  font-size: 13px;      /* уменьшить размер текста */
  border-radius: 12px;  /* меньше скругление, не овал */
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--accent);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(8px);
  transition: all .15s ease;
}
.admin-btn:hover {

  background: rgba(255,255,255,0.1);
  transform: translateY(-1px);
}

.admin-btn-secondary {

  color: var(--text-muted);
}


/* =========================
   FAVORITE HEART — RECIPES
========================= */

.recipe-card::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;

  width: 20px;
  height: 20px;

  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='rgba(255,255,255,0.7)' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 21s-7-4.5-9-9c-1.5-3.5 1-7 4.5-7 2 0 3.5 1.5 4.5 3 1-1.5 2.5-3 4.5-3 3.5 0 6 3.5 4.5 7-2 4.5-9 9-9 9z'/%3E%3C/svg%3E");

  background-size: contain;
  background-repeat: no-repeat;

  opacity: 0;
  transform: scale(.8);
  transition: opacity .25s ease, transform .25s ease;

  z-index: 40;
}

/* показываем если избранное */

.recipe-card[data-favorite="1"]::after {
  opacity: 1;
  transform: scale(1);
}

/* =========================
   FAVORITE HEART – RECIPES
========================= */

.recipe-card::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;

  width: 20px;
  height: 20px;

  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='rgba(255,255,255,0.7)' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 21s-7-4.5-9-9c-1.5-3.5 1-7 4.5-7 2 0 3.5 1.5 4.5 3 1-1.5 2.5-3 4.5-3 3.5 0 6 3.5 4.5 7-2 4.5-9 9-9 9z'/%3E%3C/svg%3E");

  background-size: contain;
  background-repeat: no-repeat;

  opacity: 0;
  transform: scale(.8);
  transition: opacity .25s ease, transform .25s ease;

  z-index: 40;
}

.recipe-card[data-favorite="1"]::after {
  opacity: 1;
  transform: scale(1);
}

.recipe-card {
  position: relative;
}

.lesson-tile{
  touch-action: pan-y;
}

.filters-scroll {
  display:flex;
  gap:10px;
  overflow-x:auto;
  padding-bottom:4px;
  scroll-behavior:smooth;
}

.lesson-telegram-badge{
position:absolute;
top:10px;
left:10px;
width:28px;
height:28px;
background:#229ED9;
border-radius:50%;
display:flex;
align-items:center;
justify-content:center;
z-index:5;
}

.lesson-telegram-badge svg{
width:16px;
fill:white;
}

.video-preview {
  position: relative;
  cursor: pointer;
}

.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 40px;
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.video-play-btn:hover {
  background: rgba(0,0,0,0.7);
}