@use "../../../../styles/abstracts/variables" as *;
@use "../../../../styles/abstracts/mixins" as *;

.savings {
  @include pageBase;

  & {
    width: 100%;
    overflow-x: hidden;
  }

  &--savings {
    h4 {
      margin-top: 1rem;
      color: $col-white;
      font-size: .9rem;
      font-weight: 400;
      opacity: .95;
      padding-bottom: .8rem;
    }

    &--card {
      background: #1b1b1b;
      padding: 1.5rem;
      border-radius: 6px;
      color: #fff;

      &--top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid $col-border-lining;
        margin-bottom: 0.4rem;

        @media only screen and (max-width: 1000px) {
          flex-direction: column;
          align-items: flex-start;
        }

        h2 {
          font-size: 0.95rem;
          padding-bottom: 0.5rem;
          opacity: 0.85;
        }

        h1 {
          font-size: 0.9rem;
          padding-bottom: 0.5rem;
        }
      }

      &--details {
        display: flex;
        align-items: center;
        justify-content: space-between;

        @media only screen and (max-width: 1000px) {
          flex-direction: column;
          align-items: flex-start;
        }

        h5 {
          font-size: 0.85rem;
          opacity: 0.85;
          line-height: 2.2;
        }
      }

      &--progress {
        margin-top: 1.5rem;

        p {
          font-size: 0.85rem;
          opacity: 0.9;
          margin-bottom: 0.4rem;
        }

        .progress-bar {
          width: 100%;
          height: 8px;
          background-color: #2e2e2e;
          border-radius: 8px;
          overflow: hidden;
        }

        .progress-fill {
          height: 100%;
          background-color: $col-orange;
          transition: width 0.4s ease-in-out;
          border-radius: 8px 0 0 8px;
        }
      }
    }
  }

  &__summary__content {
    padding: 1.5rem 2rem;
    border-radius: 10px;
    background: linear-gradient(to right, rgba(20, 19, 22, 0.9), rgba(49, 42, 20, 0.9)),
      url("/assets/images/waves.svg");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    position: relative;
    margin-bottom: 2rem;

    @media only screen and (max-width: 1000px) {
      padding: 1.2rem;
      margin-top: 1rem;
    }

    &__thumbnail {
      position: absolute;
      bottom: 1rem;
      right: 0.5rem;

      @media only screen and (max-width: 1000px) {
        height: 60px;
        width: 60px;
      }
    }

    &__left {
      display: flex;
      justify-content: space-between;
      align-content: flex-end;

      &--amount {
        &--text {
          display: flex;
          gap: 15px;

          span {
            font-size: 1.2rem;
            cursor: pointer;
            color: $col-white;
          }
        }

        h2 {
          color: $col-white;
          font-weight: 500;
          font-size: 1rem;
          padding-bottom: 1rem;

          @media only screen and (max-width: 1000px) {
            font-size: 1rem;
            font-weight: 600;
          }
        }

        h1 {
          font-weight: 500;
          color: $col-white;
          font-size: 1.2rem;

          @media only screen and (max-width: 1000px) {
            font-size: 1.1rem;
            font-weight: 600;
          }
        }

        p {
          color: $col-white;
          font-weight: 600;
          font-size: 0.8rem;
          opacity: 0.85;
          padding-top: 0.2rem;

          @media only screen and (max-width: 1000px) {
            font-size: 0.75rem;
          }
        }
      }

      &__helper {
        display: flex;
        gap: 20px;
        padding-top: 1rem;
        align-items: flex-end;

        &--fund {
          background: transparent;
          border: 1px solid #ff8c42;
          color: #ff8c42;
          transition: all 0.2s ease-in-out;
          box-shadow: 0 0 8px rgba(255, 140, 66, 0.3);
          padding: 0.6rem 1rem;
          border-radius: 6px;
          font-weight: 500;
          font-size: 0.75rem;

          &:hover {
            background: rgba(255, 140, 66, 0.1);
          }

          span {
            display: flex;
            align-items: center;
          }

          @media only screen and (max-width: 1000px) {
            padding: 0.6rem 1rem;
          }
        }

        &--withdraw,
        &--btc {
          @extend .savings__summary__content__left__helper--fund;

          @media only screen and (max-width: 1000px) {
            display: none;
          }
        }
      }
    }
  }

  button {
    margin-top: 2rem;
    background: $col-orange;
    color: $col-dark;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all ease-in 0.5s;

    &:hover {
      background-color: #e66a00;
      box-shadow: 0 0 6px rgba(255, 122, 0, 0.4);
    }

    @media only screen and (max-width: 1000px) {
      width: 100%;
      margin-bottom: 2rem;
    }
  }

  // Skeleton styles
  .savings-card-skeleton {
    background-color: #1b1b1b;
    border-radius: 8px;
    padding: 2rem;
    height: 200px;
    margin-bottom: 2rem;
    animation: pulse 1.6s infinite ease-in-out;
  }

  .transactions-skeleton {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .transaction-skeleton {
    height: 70px;
    background-color: #1b1b1b;
    border-radius: 6px;
    animation: pulse 1.6s infinite ease-in-out;
  }

  @keyframes pulse {
    0% {
      background-color: #1b1b1b;
    }
    50% {
      background-color: #2a2a2a;
    }
    100% {
      background-color: #1b1b1b;
    }
  }
}
