/* ==========================================================================
   GIFTS WIZARD - 100% соответствие дизайн-системе каталога РодКод / Status Gift
   ========================================================================== */

/* Общий макет страницы */
.page-gifts {
  padding-top: 10px;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  min-height: 0 !important;
}

/* Keep the approved desktop state untouched; mobile uses the catalog entrance. */
@media (min-width: 768px) {
  .page-gifts {
    opacity: 1 !important;
    transform: none !important;
  }
}

.page-gifts .catalog-header {
  width: 100% !important;
  max-width: 100% !important;
  margin: 20px auto 35px !important;
  text-align: center !important;
}

.page-gifts .catalog-title {
  display: inline-flex !important;
  align-items: baseline !important;
  justify-content: center !important;
  position: relative !important;
}

.page-gifts .title-word-left {
  text-align: right;
  min-width: 320px;
  padding-right: 10px;
}

.page-gifts .title-word-right {
  text-align: left;
  min-width: 320px;
  padding-left: 10px;
}

.gift-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 2.5vw, 36px);
  align-items: start;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* ==========================================================================
   ЛЕВАЯ ПАНЕЛЬ: Блоки фильтров по эскизу в стилистике catalog-filters
   ========================================================================== */
.gift-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  will-change: transform;
}

.gift-box {
  padding: 22px 20px;
  border: 1px solid rgba(215, 155, 69, .3);
  border-radius: 24px;
  background:
    radial-gradient(circle at 88% 0, rgba(141, 65, 27, .22), transparent 34%),
    linear-gradient(135deg, rgba(48, 18, 10, .9), rgba(13, 5, 3, .94));
  box-shadow: 0 22px 52px rgba(0, 0, 0, .3), 0 1px rgba(255, 224, 171, .07) inset;
}

.gift-box-title {
  color: #f0cf94;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 23px;
  font-weight: 500;
  margin-bottom: 15px;
  line-height: 1.15;
  letter-spacing: -.02em;
}

/* 1. Блок цены со слайдером */
.gift-price-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.gift-price-field {
  flex: 1;
  position: relative;
}

.gift-price-field span.field-label {
  position: absolute;
  top: 6px;
  left: 12px;
  color: rgba(244, 224, 193, .72);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  pointer-events: none;
}

.gift-price-input {
  width: 100%;
  height: 46px;
  padding: 16px 26px 4px 12px;
  color: #f5dfb7;
  border: 1px solid rgba(214, 153, 65, .35);
  border-radius: 13px;
  background: rgba(4, 2, 1, .46);
  font-size: 15px;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  transition: all 0.3s ease;
  -moz-appearance: textfield;
}

.gift-price-input::-webkit-outer-spin-button,
.gift-price-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.gift-price-input:focus {
  outline: none;
  border-color: #d9a44b;
  box-shadow: 0 0 0 3px rgba(212, 151, 61, .12);
}

.gift-price-suffix {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(242, 220, 184, .6);
  pointer-events: none;
}

.gift-price-separator {
  color: rgba(214, 153, 65, .5);
  font-weight: 600;
}

/* Двойной ползунок */
.gift-slider-track-wrap {
  position: relative;
  height: 26px;
  display: flex;
  align-items: center;
  margin: 8px 0;
}

.gift-slider-base-track {
  position: absolute;
  width: 100%;
  height: 5px;
  background: rgba(215, 155, 69, .18);
  border-radius: 3px;
}

.gift-slider-active-track {
  position: absolute;
  height: 5px;
  background: linear-gradient(90deg, #bd7928, #f0d19a);
  border-radius: 3px;
  left: 0;
  right: 0;
}

.gift-range-thumb {
  position: absolute;
  width: 100%;
  height: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  margin: 0;
  z-index: 3;
}

.gift-range-thumb::-webkit-slider-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #f0d19a;
  border: 3px solid #7c3a10;
  box-shadow: 0 0 10px rgba(223, 167, 79, .6);
  cursor: pointer;
  pointer-events: auto;
  -webkit-appearance: none;
  transition: transform 0.15s ease;
}

.gift-range-thumb::-webkit-slider-thumb:hover {
  transform: scale(1.18);
  background: #ffe3b0;
}

.gift-range-thumb::-moz-range-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #f0d19a;
  border: 3px solid #7c3a10;
  box-shadow: 0 0 10px rgba(223, 167, 79, .6);
  cursor: pointer;
  pointer-events: auto;
  -moz-appearance: none;
}

/* 2, 3, 4. Опции выбора в стиле сайта */
.gift-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gift-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(214, 153, 65, .2);
  background: rgba(10, 4, 2, .45);
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
  font-size: 14px;
  color: rgba(244, 224, 193, .8);
  font-family: 'Montserrat', sans-serif;
}

.gift-option-row input[type="radio"] {
  accent-color: #d9a44b;
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.gift-option-row:hover {
  background: rgba(25, 10, 5, .6);
  border-color: rgba(228, 171, 80, .5);
  color: #fdf5e7;
}

.gift-option-row.is-selected {
  background: rgba(141, 65, 27, .32);
  border-color: rgba(228, 171, 80, .7);
  color: #ffe2aa;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}

/* Разделение фильтров на 2 столбца под бюджетом */
.gift-filters-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.gift-filter-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.gift-box-occasion {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.gift-box-occasion .gift-options-list {
  flex: 1;
}

/* 5. Блок сброса и запуска подборки */
.gift-actions-box {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.gift-btn-reset {
  flex: 0 0 142px;
  padding: 13px 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid rgba(213, 151, 64, .4);
  border-radius: 13px;
  background: rgba(67, 25, 12, .7) !important;
  color: #e9c993 !important;
  text-align: center;
  white-space: nowrap;
}

.gift-btn-reset:hover {
  background: rgba(85, 33, 16, .85) !important;
  border-color: rgba(228, 171, 80, .6);
}

.gift-btn-submit {
  flex: 1;
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid rgba(244, 206, 137, .56);
  border-radius: 13px;
  background:
    linear-gradient(112deg, rgba(255, 246, 212, .58), transparent 35%),
    linear-gradient(180deg, #eecb84, #bd7928) !important;
  color: #1e0c05 !important;
  box-shadow: 0 9px 24px rgba(141, 72, 17, .25);
  text-align: center;
  white-space: nowrap;
}

.gift-btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(141, 72, 17, .38);
}

.gift-btn-submit:active {
  transform: translateY(0);
}

.gift-btn-submit.is-busy {
  pointer-events: none;
  opacity: 0.82;
  filter: grayscale(0.2);
}

/* ==========================================================================
   ПРАВАЯ КОЛОНКА: Сетка книг и элитный лоадер подбора
   ========================================================================== */
.gift-loader-view {
  min-height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px 24px;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(68, 25, 12, 0.72) 0%, rgba(28, 10, 4, 0.94) 80%),
    linear-gradient(180deg, rgba(46, 17, 8, 0.6), rgba(20, 7, 3, 0.8));
  border: 1px solid rgba(228, 171, 80, 0.35);
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(15, 5, 2, 0.5), inset 0 1px 0 rgba(255, 235, 190, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: giftLoaderFadeIn 0.35s ease forwards;
}

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

.gift-loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 440px;
}

.gift-loader-gem {
  position: relative;
  width: 82px;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}

.gift-loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #f4ce89;
  border-right-color: #bd7928;
  animation: giftRingSpin 1.3s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
  filter: drop-shadow(0 0 8px rgba(238, 203, 132, 0.5));
}

.gift-loader-ring-inner {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  border: 1.5px dashed rgba(244, 206, 137, 0.45);
  border-bottom-color: #f5d499;
  animation: giftRingSpinRev 2.2s linear infinite;
}

.gift-loader-core {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(141, 72, 17, 0.45) 0%, rgba(35, 12, 5, 0.85) 100%);
  box-shadow: 0 0 16px rgba(228, 171, 80, 0.35);
  animation: giftCorePulse 1.8s ease-in-out infinite;
}

@keyframes giftRingSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes giftRingSpinRev {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

@keyframes giftCorePulse {
  0%, 100% { transform: scale(1); opacity: 0.92; }
  50% { transform: scale(1.08); opacity: 1; box-shadow: 0 0 24px rgba(244, 206, 137, 0.6); }
}

.gift-loader-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  color: #fcf4e4;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.gift-loader-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 13.5px;
  color: #dfba82;
  line-height: 1.5;
  transition: opacity 0.3s ease;
  min-height: 20px;
}

.books-grid.is-fading-in {
  animation: giftGridFadeIn 0.45s ease forwards;
}

@keyframes giftGridFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.gift-results-column {
  min-width: 0;
  min-height: 820px;
}

.gift-results-column .books-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: clamp(18px, 2.2vw, 30px) !important;
  margin: 0 !important;
  margin-bottom: 24px !important;
  padding: 0 !important;
}

/* Пустой результат */
.gift-empty-view {
  text-align: center;
  padding: 48px 24px;
  border-radius: 24px;
  border: 1px dashed rgba(215, 155, 69, .3);
  background: rgba(13, 5, 3, .6);
  color: rgba(244, 225, 194, .7);
  font-size: 16px;
  font-family: 'Montserrat', sans-serif;
}

/* Toast */
.gift-toast {
  position: fixed;
  top: 16px;
  right: auto;
  left: 50%;
  width: max-content;
  max-width: min(520px, calc(100vw - 28px));
  background: linear-gradient(145deg, rgba(64, 23, 12, .98), rgba(30, 9, 6, .98));
  border: 1px solid rgba(218, 157, 67, .58);
  color: #f1d9ae;
  padding: 13px 20px;
  border-radius: 15px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, .42), inset 0 1px rgba(255, 230, 181, .08);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -14px);
  transition: opacity .24s ease, transform .24s ease, visibility 0s linear .24s;
  pointer-events: none;
}

.gift-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity .24s ease, transform .24s ease, visibility 0s;
}

/* ==========================================================================
   Адаптивность
   ========================================================================== */
@media (min-width: 1181px) {
  .catalog-site-header {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
  }
}

@media (max-width: 1180px) {
  .gift-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .gift-sidebar {
    position: static !important;
    transform: none !important;
  }
  .page-gifts .catalog-title {
    display: block !important;
  }
  .page-gifts .title-word-left,
  .page-gifts .title-word-right {
    min-width: auto;
    padding: 0 4px;
    display: inline;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .gift-filters-columns {
    grid-template-columns: 1fr;
  }
  .gift-actions-box {
    flex-direction: column-reverse;
  }
  .gift-btn-submit,
  .gift-btn-reset {
    width: 100%;
  }
  .gift-results-column .books-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Mobile-only header parity and compact step-by-step gift wizard. */
@media (max-width: 920px) {
  .catalog-site-header .header-container {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    min-height: 70px;
    align-items: center;
    gap: 0;
  }

  .catalog-site-header .logo-container {
    display: contents;
  }

  .catalog-menu-toggle {
    z-index: 2;
    grid-row: 1;
    grid-column: 1;
    width: 44px;
    height: 44px;
    justify-self: start;
  }

  .catalog-brand {
    position: relative;
    grid-row: 1;
    grid-column: 1 / -1;
    width: 100%;
    height: 70px;
    margin: 0;
    align-items: center;
    font-size: 32px;
    font-weight: 600;
    transform: none;
  }

  .catalog-brand .brand__mark {
    position: absolute;
    right: 0;
    display: block;
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    object-fit: contain;
    content: url("./assets/brand/status-gift-mark-clean.webp");
  }

  .catalog-brand .brand__desktop-name {
    position: absolute;
    left: 50%;
    display: block;
    color: #f1cd91;
    font-size: 32px;
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 0 2px 18px rgba(221, 151, 64, .24);
    transform: translateX(-50%);
  }

  .catalog-brand .brand__mobile-name,
  .catalog-site-header .nav-buttons {
    display: none;
  }
}

@media (max-width: 767px) {
  .page-gifts {
    padding-top: 5px;
  }

  .page-gifts .catalog-header {
    margin: 12px auto 20px !important;
  }

  .page-gifts .catalog-title {
    display: flex !important;
    align-items: baseline !important;
    justify-content: center !important;
    font-size: clamp(28px, 8.4vw, 34px) !important;
    line-height: 1 !important;
    white-space: nowrap;
  }

  .page-gifts .title-word-left,
  .page-gifts .title-word-right {
    min-width: 0;
    padding: 0 3px;
  }

  .gift-layout {
    gap: 18px;
  }

  .gift-sidebar {
    gap: 12px;
    scroll-margin-top: 86px;
  }

  .gift-sidebar .gift-box-budget,
  .gift-sidebar .gift-box-occasion,
  .gift-sidebar .gift-box-gender,
  .gift-sidebar .gift-box-status,
  .gift-sidebar .gift-actions-box {
    display: none;
  }

  .gift-sidebar[data-mobile-step="occasion"] .gift-box-occasion,
  .gift-sidebar[data-mobile-step="gender"] .gift-box-gender,
  .gift-sidebar[data-mobile-step="age"] .gift-box-status {
    display: block;
  }

  .gift-sidebar[data-mobile-step="budget"] .gift-box-budget {
    display: block;
  }

  .gift-sidebar[data-mobile-step="budget"] .gift-filters-columns {
    display: none;
  }

  .gift-filters-columns {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .gift-sidebar[data-mobile-step="occasion"].has-mobile-choice .gift-actions-box,
  .gift-sidebar[data-mobile-step="gender"] .gift-actions-box,
  .gift-sidebar[data-mobile-step="age"] .gift-actions-box,
  .gift-sidebar[data-mobile-step="budget"] .gift-actions-box {
    display: flex;
    flex-direction: row;
    gap: 9px;
    padding: 10px;
    border-radius: 18px;
  }

  .gift-actions-box .gift-btn-reset,
  .gift-actions-box .gift-btn-submit {
    width: auto !important;
    min-height: 43px;
    padding: 10px 8px;
    border-radius: 12px;
    font-size: 12px;
  }

  .gift-actions-box .gift-btn-reset {
    flex: 0 0 34%;
  }

  .gift-actions-box .gift-btn-submit {
    flex: 1 1 auto;
  }

  .page-gifts:not(.has-mobile-results) .gift-results-column {
    display: none;
  }

  .page-gifts.has-mobile-results .gift-results-column {
    display: block;
  }
}

