/* css/referrals.css */

/* Если шрифт уже подключён в другом CSS — этот блок можно удалить */
@font-face {
  font-family: "RubikBoldLocal";
  src: url("font/RubikBold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* угол поворота выреза у кнопки */
  --notch-rotation: -135deg;

  /* настройки вкладок под окном */
  --friends-tab-btn-size: 56px;
  --friends-tab-gap: 15px;
  --friends-tab-active-scale: 1.08;
  --friends-tab-transition: 0.12s ease-out;
}

/* локальные элементы, без трогания body */

/* ===== ОВЕРЛЕЙ ДЛЯ РЕФЕРАЛОВ (как миссии) ===== */
.friends-modal {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;

  /* ВАЖНО: вот эти две строки */
  align-items: center;          /* по горизонтали по центру */
  justify-content: flex-end;    /* по вертикали вниз */

  padding: 0px 0px 48px;        /* отступ снизу 20px */
  z-index: 1000;
  box-sizing: border-box;

  width: 100%;
  font-family: "RubikBoldLocal", -apple-system, BlinkMacSystemFont,
    system-ui, sans-serif;
  color: #ffe8bf;

  overflow-y: auto;
}

/* если захочешь прятать через класс */
.friends-modal.is-hidden {
  display: none;
}

.friends-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 440px;

  /* анимация вылета снизу */
  transform: translateY(40px);
  opacity: 0;
  animation: friendsSlideUp 0.25s ease-out forwards;
}

/* ===== АНИМАЦИИ ВЫЛЕТА / ЗАЛЁТА СНИЗУ ===== */
@keyframes friendsSlideUp {
  0% {
    transform: translateY(40px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* если захочешь анимировать закрытие вниз — есть заготовка */
@keyframes friendsSlideDown {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(40px);
    opacity: 0;
  }
}

/* ===== ОКНО (3 ПОЛОСЫ: ВЕРХ / СЕРЕДИНА / НИЗ) ===== */

.friends-window {
  width: 100%;
  background: #352110;
  border-radius: 13px;
  border: 1px solid #3b2617;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 5px rgba(0, 0, 0, 0.45);
}

/* ВЕРХНЯЯ ПОЛОСА */

.friends-header {
  background: #FDDF86;
  padding: 7px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 13px 13px 0 0;
  border-bottom: 3px solid #7B593A;
}

.friends-title {
  font-size: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #50362A;
}

.friends-close {
  border: none;
  background: none;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.friends-close img {
  width: 90%;
  height: 90%;
  display: block;
}

/* СРЕДНЯЯ ПОЛОСА */

.friends-middle {
  background: #523524;
  padding: 7px 16px 10px;
}

.friends-description {
  font-size: 13px;
  text-align: center;
  color: #C5AD8B;
}

/* строка "текст слева, кнопка справа" по ширине окна */
.friends-copy-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.friends-copy-text {
  font-size: 13px;
  color: #C5AD8B;
  text-align: left;
  flex: 1;
}

.friends-copy-btn-wrap {
  flex-shrink: 0;
}

/* НИЖНЯЯ ПОЛОСА */

.friends-bottom {
  background: #352110;
  padding: 0px 7px 0px;
  border-radius: 0 0 13px 13px;
}

.friends-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.friends-content {
  width: 100%;
}

/* ОБЩИЕ СЕКЦИИ ВНИЗУ */

.friends-section {
  border-radius: 9px;
  padding: 10px 0px 12px;
}

.friends-section + .friends-section {
  margin-top: 6px;
}

.friends-section-title {
  font-size: 13px;
  color: #ffd78c;
}

.friends-section > .friends-section-title {
  margin-bottom: 6px;
}

/* Хедер секции с сортировкой */
.friends-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.friends-sort-toggle {
  font-size: 11px;
  color: #f5d49a;
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  -webkit-tap-highlight-color: transparent;
}

/* ===== БЛОК УРОВНЕЙ (1 ур. / 2 ур. / 3 ур.) ===== */

.friends-levels {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.friends-level-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 12px;
  background: #24150a;
  padding: 6px 8px;
  border-radius: 7px;
}

.friends-level-left {
  color: #ffe8bf;
  display: flex;
  align-items: center;
  gap: 4px;
}

.friends-level-center {
  color: #ffc14a;
  text-align: left;
  flex: 0 0 auto;
}

.friends-level-right {
  color: #c7aa86;
  text-align: right;
  margin-left: auto;
  min-width: 76px;
}

/* ===== БЛОК БОНУСА +5 ЗОЛОТА ===== */

.friends-bonus-card {
  background: #24150a;
  border-radius: 7px;
  padding: 8px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.friends-bonus-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.friends-bonus-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.friends-bonus-value {
  font-size: 16px;
  color: #ffd34e;
  text-shadow: 0 1px 0 #3b2617;
}

.friends-bonus-text {
  font-size: 12px;
  color: #fbe6c2;
  line-height: 1.3;
}

/* ===== БЛОК "ВАШИ ОТЧИСЛЕНИЯ" ===== */

.friends-totals {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.friends-total-item {
  background: #24150a;
  border-radius: 7px;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.friends-total-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.friends-total-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}

.friends-total-value {
  font-size: 15px;
  color: #ffd34e;
  text-shadow: 0 1px 0 #3b2617;
}

.friends-total-text {
  font-size: 12px;
  color: #fbe6c2;
}

/* ===== СПИСОК ДРУЗЕЙ (2-я вкладка) ===== */

.friends-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 349px;
  overflow-y: auto;
  padding-right: 4px;

  /* плавный скролл на iOS */
  -webkit-overflow-scrolling: touch;
}

.friends-list::-webkit-scrollbar {
  width: 5px;
}
.friends-list::-webkit-scrollbar-track {
  background: #2b190f;
  border-radius: 3px;
}
.friends-list::-webkit-scrollbar-thumb {
  background: #8f6136;
  border-radius: 3px;
}

.friend-item {
  background: #24150A;
  border-radius: 9px;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 0 #423320;
}

.friend-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #523524;
  border: 2px solid #7B593A;
}

.friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.friend-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.friend-name {
  font-size: 14px;
  color: #ffe8bf;
}

.friend-level {
  font-size: 11px;
  color: #b59b7a;
}

.friend-action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== КНОПКА collect-btn (как в миссиях) ===== */

.collect-btn {
  position: relative;
  width: 110px;
  height: 45px;
  border-radius: 8px;
  border: none;
  background: #895E35;
  box-shadow: 0 4px 0 #452b1d;
  padding: 2px 2px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fbe6c2;
  border-bottom: 0.25px solid #B28452;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: transform 0.07s ease-out, box-shadow 0.07s ease-out;
  font-family: "RubikBoldLocal", -apple-system, BlinkMacSystemFont,
    system-ui, sans-serif;
}

.collect-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.collect-btn:active,
.collect-btn.is-pressed {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #523723;
}

.collect-btn__top {
  position: relative;
  flex: 0 0 22px;
  border-radius: 7px;
  background: #452B1D;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 800;
  font-size: 14px;
  box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.5);
  border-bottom: 1.3px solid #B28452;
  font-family: "RubikBoldLocal", -apple-system, BlinkMacSystemFont,
    system-ui, sans-serif;
}

.collect-btn__notch {
  position: absolute;
  right: 8px;
  top: -15px;
  width: 0;
  height: 0;
  border-left: 10px solid #895E35;
  border-bottom: 10px solid transparent;
  border-radius: 2.5px;
  transform-origin: center bottom;
  transform: rotate(var(--notch-rotation));
}

.collect-btn__bottom {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  font-weight: 900;
  font-size: 13px;
  color: #452b1d;
  gap: 4px;
  font-family: "RubikBoldLocal", -apple-system, BlinkMacSystemFont,
    system-ui, sans-serif;
}

.collect-btn__bottom-text {
  display: inline-block;
  font-family: "RubikBoldLocal", -apple-system, BlinkMacSystemFont,
    system-ui, sans-serif;
}

.collect-btn__spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(69, 43, 29, 0.4);
  border-top-color: #fbe6c2;
  animation: collectSpinner 0.7s linear infinite;
  flex-shrink: 0;
  display: none;
}

.collect-btn.is-loading .collect-btn__spinner {
  display: inline-block;
}

.collect-btn.is-loading .collect-btn__bottom-text {
  display: none;
}

@keyframes collectSpinner {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* подпись в верхней части (ссылка / +5) */

.collect-btn__label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.friends-btn-top {
  justify-content: center;
}

.collect-btn__icon-wrap {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.collect-btn__icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Варианты цвета */

.collect-btn--green {
  background: #00E800;
  box-shadow: 0 4px 0 #008126;
  border-bottom-color: #52FC35;
  color: #e8ffe1;
}
.collect-btn--green:active,
.collect-btn--green.is-pressed {
  box-shadow: 0 2px 0 #2e5b24;
}
.collect-btn--green .collect-btn__top {
  background: #007322;
  border-bottom-color: #52FC35;
}
.collect-btn--green .collect-btn__bottom {
  color: #005018;
}
.collect-btn--green .collect-btn__notch {
  border-left-color: #00E800;
}

.collect-btn--blue {
  background: #00BFF7;
  box-shadow: 0 4px 0 #00529C;
  border-bottom-color: #00F1FF;
  color: #e1f4ff;
}
.collect-btn--blue:active,
.collect-btn--blue.is-pressed {
  box-shadow: 0 2px 0 #1b425b;
}
.collect-btn--blue .collect-btn__top {
  background: #005DB0;
  border-bottom-color: #00F1FF;
}
.collect-btn--blue .collect-btn__bottom {
  color: #105086;
}
.collect-btn--blue .collect-btn__notch {
  border-left-color: #00BFF7;
}

.collect-btn--purple {
  background: #980294;
  box-shadow: 0 4px 0 #680B66;
  border-bottom-color: #E252DB;
  color: #f5e8ff;
}
.collect-btn--purple:active,
.collect-btn--purple.is-pressed {
  box-shadow: 0 2px 0 #44225e;
}
.collect-btn--purple .collect-btn__top {
  background: #670965;
  border-bottom-color: #E252DB;
}
.collect-btn--purple .collect-btn__bottom {
  color: #4c0634;
}
.collect-btn--purple .collect-btn__notch {
  border-left-color: #980294;
}

/* ===== ВКЛАДКИ ПОД ОКНОМ (2 КНОПКИ) ===== */

.friends-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
}

.friends-tabs__buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--friends-tab-gap);
}

.friends-tab-btn {
  width: var(--friends-tab-btn-size);
  height: var(--friends-tab-btn-size);
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  transition: transform var(--friends-tab-transition);
}

.friends-tab-btn img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.friends-tab-btn.is-active {
  transform: scale(var(--friends-tab-active-scale));
}

/* Адаптив под маленькие экраны */

@media (max-width: 380px) {
  .friends-wrapper {
    max-width: 100%;
  }
  .friends-window {
    border-radius: 13px;
  }
  .friends-header {
    border-radius: 0px;
  }
}
