/* ==========================================================================
   SITE-WIDE MODERN MOTION, GLASS & THEME-ADAPTIVE CARDS
   Єдина візуальна система для Рецептів, Продуктів, Зошита, Холодильника та Товарів
   ========================================================================== */

:root {
  --card-lift-y: -4px;
  --card-transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.24s ease,
    box-shadow 0.24s ease,
    background 0.24s ease;
  --card-hover-border: color-mix(in srgb, var(--accent-primary) 52%, transparent);
  --card-hover-shadow:
    0 14px 30px rgba(0, 0, 0, 0.30),
    0 0 0 1px color-mix(in srgb, var(--accent-primary) 18%, transparent);
}

/* --- 1. УНІФІКОВАНІ КАРТКИ ПО ВСЬОМУ САЙТУ (РЕЦЕПТИ, ПРОДУКТИ, ЗОШИТ, ТОВАРИ, ХОЛОДИЛЬНИК) --- */
.recipe-card,
.product-card,
.prod-card,
.cat-card,
.catalog-card,
.note-card,
.notebook-card,
.draft-card,
.gear-card,
.gear-item,
.fridge-match-card,
.fridge-result-card,
.about-card,
.contact-card,
#sec-recipes .grid-3 > .panel,
#sec-recipes .grid-4 > .panel,
#sec-products .grid-3 > .panel,
#sec-products .grid-4 > .panel,
#sec-notebook .grid-3 > .panel,
#sec-notebook .grid-2 > .panel,
#sec-gear .grid-3 > .panel,
#sec-gear .grid-4 > .panel,
#sec-fridge .grid-3 > .panel {
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent-primary) 8%, transparent), transparent 58%),
    var(--bg-surface);
  transition: var(--card-transition);
  will-change: transform;
}

.recipe-card:hover,
.product-card:hover,
.prod-card:hover,
.cat-card:hover,
.catalog-card:hover,
.note-card:hover,
.notebook-card:hover,
.draft-card:hover,
.gear-card:hover,
.gear-item:hover,
.fridge-match-card:hover,
.fridge-result-card:hover,
.about-card:hover,
.contact-card:hover,
#sec-recipes .grid-3 > .panel:hover,
#sec-recipes .grid-4 > .panel:hover,
#sec-products .grid-3 > .panel:hover,
#sec-products .grid-4 > .panel:hover,
#sec-notebook .grid-3 > .panel:hover,
#sec-notebook .grid-2 > .panel:hover,
#sec-gear .grid-3 > .panel:hover,
#sec-gear .grid-4 > .panel:hover,
#sec-fridge .grid-3 > .panel:hover {
  transform: translateY(var(--card-lift-y));
  border-color: var(--card-hover-border);
  box-shadow: var(--card-hover-shadow);
}

/* Плавний зум фотографій у всіх картках */
.recipe-card .thumb-box,
.product-card .thumb-box,
.prod-card .thumb-box,
.cat-card .thumb-box,
.gear-card .thumb-box,
.gear-thumb,
.prod-thumb,
.card-thumb {
  overflow: hidden;
  position: relative;
}

.recipe-card .thumb-box img,
.product-card img,
.prod-card img,
.cat-card img,
.gear-card img,
.gear-thumb img,
.prod-thumb img,
.card-thumb img {
  transition: transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
}

.recipe-card:hover .thumb-box img,
.product-card:hover img,
.prod-card:hover img,
.cat-card:hover img,
.gear-card:hover img,
.gear-thumb:hover img,
.prod-thumb:hover img,
.card-thumb:hover img {
  transform: scale(1.05);
}

/* --- 2. РЕЦЕПТИ (#sec-recipes) --- */
#sec-recipes .recipe-card .thumb-box {
  background:
    radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent-primary) 15%, transparent), transparent 68%),
    linear-gradient(155deg, var(--bg-surface) 0%, var(--bg-surface-2) 100%);
}

#sec-recipes .badge,
.recipe-card .badge,
.source-badge {
  backdrop-filter: blur(8px);
  border: 1px solid color-mix(in srgb, var(--accent-primary) 34%, rgba(255, 255, 255, 0.12));
}

/* --- 3. ПРОДУКТИ (#sec-products) --- */
#sec-products .panel,
#sec-products .sub-card {
  border-radius: 14px;
}

#sec-products table tbody tr {
  transition: background-color 0.18s ease, transform 0.18s ease;
}

#sec-products table tbody tr:hover {
  background-color: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-surface-2));
}

/* --- 4. ЗОШИТ (#sec-notebook) --- */
#sec-notebook .note-card,
#sec-notebook .notebook-card,
#sec-notebook .panel {
  position: relative;
}

.heart-btn {
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease;
}

.heart-btn:hover {
  transform: scale(1.06);
  border-color: var(--accent-primary);
}

.heart-btn:active {
  transform: scale(0.94);
}

.heart-btn.heart-active {
  background: color-mix(in srgb, var(--accent-primary) 20%, var(--bg-surface-2));
  border-color: var(--accent-primary);
  color: var(--accent-soft);
}

/* --- 5. ХОЛОДИЛЬНИК (#sec-fridge) --- */
#sec-fridge .fridge-chip,
#sec-fridge .fridge-prod-chip,
#sec-fridge .prod-chip,
#sec-fridge .ingredient-chip,
#sec-fridge [data-fridge-slug],
#sec-fridge [data-prod-slug] {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

#sec-fridge .fridge-chip:hover,
#sec-fridge .fridge-prod-chip:hover,
#sec-fridge .prod-chip:hover,
#sec-fridge .ingredient-chip:hover,
#sec-fridge [data-fridge-slug]:hover,
#sec-fridge [data-prod-slug]:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

#sec-fridge .fridge-chip.active,
#sec-fridge .fridge-chip.selected,
#sec-fridge .fridge-prod-chip.active,
#sec-fridge .fridge-prod-chip.selected,
#sec-fridge .prod-chip.selected,
#sec-fridge [data-fridge-slug].selected {
  background: color-mix(in srgb, var(--accent-primary) 22%, var(--bg-surface-2));
  border-color: var(--accent-primary);
  color: var(--accent-soft);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent-primary) 22%, transparent);
}

/* --- 6. ТОВАРИ, ЯКИМИ Я КОРИСТУЮСЬ (#sec-gear) --- */
#sec-gear .gear-card,
#sec-gear .gear-item {
  overflow: hidden;
}

/* --- 7. КНОПКИ, ФІЛЬТРИ, ТАБИ, ПОЛЯ ВВОДУ ТА ШАПКА --- */
.pill-btn,
.btn-beige,
.btn-dark,
.nav-btn,
.cat-pill,
.filter-pill,
.tab-btn {
  transition:
    transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
}

.pill-btn:hover,
.cat-pill:hover,
.filter-pill:hover {
  transform: translateY(-1.5px);
  border-color: var(--accent-primary);
}

.btn-beige:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent-primary) 32%, transparent);
}

.btn-dark:hover {
  transform: translateY(-1.5px);
  border-color: color-mix(in srgb, var(--accent-primary) 55%, var(--border-subtle));
  background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-surface-2));
}

.pill-btn:active,
.btn-beige:active,
.btn-dark:active,
.nav-btn:active {
  transform: translateY(0) scale(0.98);
}

.pill-btn.active,
.cat-pill.active,
.filter-pill.active,
.nav-btn.active {
  background: color-mix(in srgb, var(--accent-primary) 18%, var(--bg-surface));
  border-color: var(--accent-primary);
  color: var(--accent-soft);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent-primary) 16%, transparent);
}

/* Інтерактивні поля пошуку та фільтрів */
input[type="text"],
input[type="search"],
input[type="number"],
input[type="email"],
select,
textarea {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input[type="text"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 18%, transparent);
}

/* --- 8. МОДАЛЬНІ ВІКНА (РЕЦЕПТИ, ПРОДУКТИ, КАБІНЕТ) --- */
.modal-backdrop {
  backdrop-filter: blur(6px);
}

.modal-card {
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--accent-primary) 32%, var(--border-subtle));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.52);
  animation: modalPopIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --- 9. ПОЯВА КОНТЕНТУ ПРИ ПЕРЕМИКАННІ ВКЛАДОК --- */
.page-section.active {
  animation: sectionFadeSlide 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sectionFadeSlide {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Вимкнення руху, якщо у користувача в системі увімкнено Reduce Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
#fridgeResultsBox .grid-3 {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px !important;
  align-items: start !important;
}

#fridgeResultsBox .fridge-result-card {
  min-width: 0 !important;
  max-width: 100% !important;
  width: auto !important;
  margin-bottom: 0 !important;
}

@media (max-width: 900px) {
  #fridgeResultsBox .grid-3 {
    grid-template-columns: 1fr !important;
  }
}