.referral-main {
  margin-bottom: 60px;
}

.referral-main__wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.referral-main__left {
  position: relative;
  width: calc(100% - 490px - 16px);
  padding: 32px 35px;
  border-radius: 16px;
  background-color: var(--bg-color);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.referral-main__left::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background:
    url("../../assets/bg-reverse.svg") no-repeat,
    var(--bg-color);
  opacity: 0.2;
  pointer-events: none;
}

html[data-theme="dark"] .referral-main__left::before {
  background:
    url("../../assets/bg-reverse.svg") no-repeat,
    var(--bg-color);
}

.referral-main__left-inner {
  position: relative;
}

.referral-left__title {
  margin-bottom: 24px;
}

.referral-left__title h1 {
  margin: 0 0 4px;
  font-size: 38px;
  font-weight: 700;
  line-height: 120%;
  letter-spacing: -0.5px;
  color: var(--text-dark);
}

.referral-left__title-badge {
  display: flex;
  align-items: center;
  column-gap: 8px;
}

.referral-left__title-badge strong {
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 32px 0 16px;
  border-radius: 7px;
  background: var(--gradient-1);
  font-size: 38px;
  font-weight: 700;
  line-height: 120%;
  letter-spacing: -0.5px;
  color: var(--white);
}

.referral-left__benefits {
  display: grid;
  row-gap: 18px;
  margin-bottom: 30px;
}

.referral-left__benefits-item {
  display: flex;
  align-items: center;
  column-gap: 8px;
}

.referral-left__benefits-item img {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.referral-left__benefits-item span {
  font-size: 18px;
  font-weight: 500;
  line-height: 120%;
  letter-spacing: -0.5px;
  color: var(--text-dark);
}

.referral-left__benefits-item span strong {
  height: 30px;
  display: inline-flex;
  align-items: center;
  margin: -5px 0;
  padding: 0 8px;
  border-radius: 5px;
  background-color: var(--blue);
  font-size: 18px;
  font-weight: 600;
  line-height: 110%;
  letter-spacing: -0.5px;
  color: var(--white);
}

.referral-left__how {
  margin-bottom: 24px;
}

.referral-left__how h2 {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 700;
  line-height: 100%;
  letter-spacing: -0.5px;
  color: var(--text-dark);
}

.referral-left__how-list {
  display: flex;
  justify-content: space-between;
  align-items: center;
  column-gap: 40px;
  margin: 0;
  padding: 0;
  list-style-type: none;
}

.referral-left__how-item {
  display: flex;
  column-gap: 12px;
}

.referral-left__how-number {
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: var(--orange-dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 120%;
  letter-spacing: 0%;
  color: var(--white);
}

.referral-left__how-text {
  min-width: 100px;
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 110%;
  letter-spacing: -0.5px;
  color: var(--text-dark);
}

.referral-code {
  display: flex;
  column-gap: 16px;
}

.referral-code__ref {
  height: 50px;
  flex: 1;
  display: flex;
  align-items: center;
  column-gap: 8px;
  padding: 0 16px;
  border-radius: 10px;
  background-color: var(--gray-light);
  font-size: 15px;
  font-weight: 600;
  line-height: 100%;
  letter-spacing: -0.5px;
  color: var(--gray);
}

html[data-theme="dark"] .referral-code__ref {
  background-color: #2c3242;
}

.referral-code__button {
  padding: 0 22.5px;
}

.referral-main__right {
  position: relative;
  width: 490px;
  display: grid;
  align-content: space-between;
  flex-shrink: 0;
  row-gap: 30px;
  padding: 24px;
  border-radius: 16px;
  background-color: var(--bg-color);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.referral-main__right::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 110px;
  background: linear-gradient(
    0deg,
    var(--bg-color) 0%,
    rgba(255, 255, 255, 0) 100%
  );
}

.referral__stats-total {
  height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  column-gap: 20px;
  margin-bottom: 18px;
  padding: 10px 10px 10px 20px;
  border-radius: 12px;
  background-color: var(--blue-light);
}

html[data-theme="dark"] .referral__stats-total {
  background-color: #2a2e39;
}

.referral__stats-total-title {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 100%;
  letter-spacing: -0.5px;
  color: var(--gray);
}

.referral__stats-total-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 100%;
  letter-spacing: -0.5px;
  color: var(--text-dark);
}

.referral__stats-button img {
  position: relative;
  top: -2px;
}

.referral__stats-list {
  display: flex;
  justify-content: space-between;
  column-gap: 8px;
}

.referral__stats-deposit,
.referral__stats-referral {
  display: flex;
  align-items: center;
  column-gap: 12px;
}

.referral__stats-icon {
  width: 46px;
  height: 46px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px;
}

.referral__stats-deposit .referral__stats-icon {
  background-color: var(--lime);
}

html[data-theme="dark"] .referral__stats-deposit .referral__stats-icon {
  background-color: var(--green-soft);
}

.referral__stats-referral .referral__stats-icon {
  background-color: var(--orange-light);
}

html[data-theme="dark"] .referral__stats-referral .referral__stats-icon {
  background-color: var(--orange-soft);
}

.referral__stats-title {
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  line-height: 100%;
  letter-spacing: -0.5px;
  color: var(--gray);
}

.referral__stats-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 100%;
  letter-spacing: -0.5px;
  color: var(--text-dark);
}

.referral-right__history-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.referral-right__history-top h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 100%;
  letter-spacing: -0.5px;
  color: var(--text-dark);
}

.referral-right__history-button {
  height: 44px;
  padding: 0 20px;
  font-size: 16px;
}

.history__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  column-gap: 8px;
}

.history__item:not(:last-child) {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-light);
}

html[data-theme="dark"] .history__item:not(:last-child) {
  border-bottom-color: #2a2e39;
}

.history__item-content {
  display: flex;
  align-items: center;
  column-gap: 8px;
}

.history__item-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
}

.history__item-avatar img {
  width: 100%;
}

.history__item-info {
  margin-top: -1px;
}

.history__item-top {
  display: flex;
  align-items: center;
  column-gap: 8px;
  margin-bottom: 6px;
}

.history__item-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 100%;
  letter-spacing: -0.5px;
  color: var(--text-dark);
}

.history__item-date {
  font-size: 13px;
  font-weight: 500;
  line-height: 12px;
  letter-spacing: -0.5px;
  color: var(--gray);
}

.history__item-text {
  width: fit-content;
  height: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 6px;
  border-radius: 3px;
  background-color: var(--gray-light);
  font-size: 12px;
  font-weight: 700;
  line-height: 12px;
  letter-spacing: -0.5px;
  text-transform: uppercase;
  color: var(--gray);
}

html[data-theme="dark"] .history__item-text {
  background-color: #2a2e39;
}

.history__item-action {
  height: 26px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 700;
  line-height: 100%;
  letter-spacing: -0.5px;
  color: var(--white);
}

.history__item-action[data-action="buy"] {
  background-color: var(--green-light);
}

.history__item-action[data-action="ref"] {
  background-color: var(--orange-dark);
}

.history__item-action img {
  width: 16px;
  height: 16px;
}

.history__item-action[data-action="ref"] img {
  filter: brightness(0) invert(1);
}

.referral__apply {
  position: relative;
  width: 100%;
  height: 90px;
  border-radius: 16px;
  background-color: var(--bg-color);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.referral__apply::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    url("../../assets/bg.svg") no-repeat,
    var(--bg-color);
  opacity: 0.2;
  pointer-events: none;
}

html[data-theme="dark"] .referral__apply::before {
  background:
    url("../../assets/bg.svg") no-repeat,
    var(--bg-color);
}

.referral__apply::after {
  content: "";
  position: absolute;
  bottom: -36px;
  left: 8px;
  width: 202px;
  height: 135px;
  background: url("../../assets/images/gift.png") no-repeat center;
  background-size: 100%;
  transform: rotate(-5deg);
}

.referral__apply-inner {
  position: relative;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  column-gap: 40px;
  padding: 18px 20px 18px 210px;
}

.referral__apply-info {
  max-width: 480px;
  flex: 1;
  font-size: 22px;
  font-weight: 700;
  line-height: 120%;
  letter-spacing: -0.5px;
  color: var(--text-dark);
}

.referral__apply-info span {
  color: var(--blue);
}

.referral__apply-form {
  max-width: calc(490px - 20px);
  width: 100%;
}

.referral__apply-form form {
  display: flex;
  justify-content: space-between;
  column-gap: 16px;
}

.referral__apply-form label {
  position: relative;
}

.referral__apply-form img {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.referral__apply-form input {
  min-width: 290px;
  width: 100%;
  height: 50px;
  padding: 0 16px 0 44px;
  border: 0;
  border-radius: 10px;
  outline: 0;
  background-color: var(--gray-light);
  font-size: 15px;
  font-weight: 600;
  line-height: 100%;
  letter-spacing: -0.5px;
  color: var(--text-dark);
}

html[data-theme="dark"] .referral__apply-form input {
  background-color: #2c3242;
}

.referral__apply-form input::placeholder {
  color: var(--gray);
}

.referral__apply-form input:focus-within {
  box-shadow: var(--focus-ring);
}

.referral__apply-form .custom-button {
  flex: 1;
}

.referral__apply-inner .success-badge {
  margin-right: 6px;
}

@media (max-width: 767px) {
  .referral-main {
    margin-bottom: 12px;
  }

  .referral-main__wrapper {
    flex-direction: column;
    column-gap: 0;
    row-gap: 12px;
  }

  .referral-main__left {
    width: 100%;
    padding: 16px;
    order: 1;
  }

  .referral-main__left::before {
    background:
      url("../../assets/bg.svg") no-repeat,
      var(--bg-color);
    transform: scaleX(-1);
  }

  .referral-left__title {
    margin-bottom: 16px;
  }

  .referral-left__title h1 {
    margin: 0;
    font-size: 24px;
  }

  .referral-left__title-badge img {
    width: 28px;
    height: 20px;
  }

  .referral-left__title-badge strong {
    height: 30px;
    padding: 0 8px;
    border-radius: 5px;
    font-size: 24px;
  }

  .referral-left__benefits {
    row-gap: 12px;
    margin-bottom: 24px;
  }

  .referral-left__benefits-item img {
    width: 20px;
    height: 20px;
  }

  .referral-left__benefits-item span {
    font-size: 15px;
    line-height: 110%;
  }

  .referral-left__benefits-item span strong {
    height: 20px;
    margin: -2px 0;
    padding: 0 4px;
    font-size: 15px;
  }

  .referral-left__how {
    margin-bottom: 18px;
  }

  .referral-left__how h2 {
    margin-bottom: 12px;
    font-size: 18px;
  }

  .referral-left__how-list {
    flex-direction: column;
    align-items: flex-start;
    column-gap: 0;
    row-gap: 12px;
  }

  .referral-left__how-item {
    align-items: center;
    column-gap: 8px;
  }

  .referral-code {
    column-gap: 0;
  }

  .referral-code__ref {
    width: 100%;
    padding: 0 58px 0 16px;
  }

  .referral-code__button {
    position: absolute;
    right: 0;
    width: 50px;
    padding: 0;
  }

  .referral-code__button span {
    display: none;
  }

  .referral__apply {
    height: auto;
    order: 2;
  }

  .referral__apply::before {
    background-position: 75%;
    transform: scaleX(-1);
  }

  .referral__apply::after {
    left: unset;
    right: -15px;
    width: 190px;
    height: 130px;
    transform: rotate(-8deg);
  }

  .referral__apply-inner {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
    column-gap: 0;
    row-gap: 12px;
    z-index: 1;
  }

  .referral__apply[data-referral-applied="true"] .referral__apply-inner {
    row-gap: 10px;
  }

  .referral__apply-info {
    max-width: unset;
    font-size: 18px;
  }

  .referral__apply-info span {
    display: inline-flex;
  }

  .referral__apply-form {
    max-width: unset;
  }

  .referral__apply-form form {
    flex-direction: column;
    column-gap: 0;
    row-gap: 12px;
  }

  .referral__apply-form .custom-button {
    width: max-content;
    flex: 0 0 auto;
    padding: 0 28.5px;
  }

  .referral-main__right {
    width: 100%;
    row-gap: 24px;
    padding: 12px;
    order: 3;
  }

  .referral__stats-total {
    height: 60px;
    column-gap: 8px;
    margin-bottom: 8px;
    padding: 7px 7px 7px 14px;
  }

  .referral__stats-total-title {
    font-size: 12px;
  }

  .referral__stats-total-value {
    font-size: 18px;
  }

  .referral__stats-button {
    height: 46px;
    padding: 0 16px;
  }

  .referral__stats-list {
    justify-content: flex-start;
  }

  .referral__stats-deposit,
  .referral__stats-referral {
    min-width: 152px;
    column-gap: 8px;
  }

  .referral__stats-icon {
    width: 40px;
    height: 40px;
  }

  .referral__stats-title {
    font-size: 12px;
    font-weight: 600;
  }

  .referral__stats-value {
    font-size: 18px;
  }

  .referral-main__right::after {
    bottom: 74px;
    height: 95px;
  }

  .referral-right__history {
    padding-bottom: 62px;
  }

  .referral-right__history-top h2 {
    font-size: 18px;
  }

  .referral-right__history-button {
    position: absolute;
    bottom: 12px;
    left: 12px;
    width: calc(100% - 24px);
    height: 46px;
  }

  .history__item-text {
    font-size: 10px;
  }
}

@media (max-width: 525px) {
  .referral-main__left::before {
    background-position: 75%;
  }
}

@media (max-width: 400px) {
  .referral-left__title h1 {
    max-width: 260px;
  }

  .referral__apply-info {
    max-width: 280px;
  }
}
