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

.transactions {
  @include mixins.pageBase;
  height: auto !important;
  background:
    radial-gradient(
      circle at top right,
      rgba(255, 140, 66, 0.05),
      transparent 35%
    ),
    #101012;

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

  &__transactions {
    border: 1px solid variables.$col-border-lining;
    background: #19191b;
    padding: 1rem 1rem;
    border-radius: 10px;
    margin-top: 1.5rem;
    width: 100%;
    display: flex;
    flex-direction: column;

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

    &__tab {
      background: variables.$col-active-btn-bg;
      border: 1px solid variables.$col-border-lining;
      border-radius: 6px;
      margin-bottom: 1.5rem;
      display: flex;
      justify-content: space-between;
      padding: 0.5rem 0.7rem;
      align-items: center;
      font-size: 0.8rem;
      font-weight: 500;
      flex-wrap: nowrap;
      overflow-x: auto;
      gap: 20px;
      width: 100%;

      @media only screen and (max-width: 1000px) {
        width: 100%;
        padding: 0.5rem 0.6rem !important;
      }

      &--item {
        text-align: center;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        font-weight: 500;
        flex: 0 0 150px;
        color: variables.$col-white;

        &--active {
          background: variables.$col-orange;
          color: variables.$col-dark;
          border-radius: 6px;
          padding: 0.5rem 1rem;
          cursor: pointer;
          font-size: 0.8rem;
          font-weight: 500;

          @media only screen and (max-width: 1000px) {
            flex: 0 0 160px;
            text-align: center;
          }
        }
      }
    }

    /* Pagination */
    &__pagination {
      margin-top: 1rem;
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100%;
    }
  }

  // 🔽 Filter Button
  .filterToggleBtn {
    background: variables.$col-active-btn-bg;
    color: variables.$col-white;
    font-weight: 500;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border: 1px solid variables.$col-border-lining;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;

    &:hover {
      background: rgba(255, 140, 66, 0.1);
      border-color: variables.$col-orange;
      color: variables.$col-orange;
    }

    @media only screen and (max-width: 1000px) {
      width: 100%;
      justify-content: center;
      margin-top: .5rem !important;
    }

    svg {
      font-size: 0.9rem;
    }
  }

  // 🔽 Date Range Filter Styling
  .filterSection {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
    flex-wrap: wrap;

    input[type="date"] {
      background: #1e1e1e;
      color: #fff;
      border: 1px solid variables.$col-border-lining;
      padding: 0.45rem 1rem;
      border-radius: 6px;
      font-size: 0.85rem;
      font-family: inherit;
      transition: border 0.2s ease;

      &:focus {
        border-color: variables.$col-orange;
        outline: none;
      }

      &::-webkit-calendar-picker-indicator {
        filter: invert(1);
      }

      @media only screen and (max-width: 1000px) {
        flex: 1 1 100%;
      }
    }

    button {
      background: variables.$col-orange;
      color: variables.$col-dark;
      font-weight: 500;
      padding: 0.5rem 1.2rem;
      border-radius: 6px;
      border: none;
      cursor: pointer;
      transition: all ease-in-out 0.3s;
      font-size: 0.8rem;

      &:hover {
        background: #ff8c42;
      }

      @media only screen and (max-width: 1000px) {
        flex: 1 1 100%;
      }
    }
  }
}

// Skeleton Transaction Cards
.transactions__card--skeleton {
  background: #1d1d1d;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 0.6rem;
  margin-bottom: 0.75rem;
  width: 100%;
  animation: pulse 4s infinite ease-in-out;

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

  .skeleton__line {
    height: 6px;
    border-radius: 4px;
    margin-bottom: 0.6rem;
    background: linear-gradient(90deg, #2c2c2c 25%, #3a3a3a 50%, #2c2c2c 75%);
    background-size: 400% 100%;
    animation: shimmer 5s infinite linear;
  }

  .skeleton__line:nth-child(1) {
    width: 40%;
    height: 8px;
  }

  .skeleton__line:nth-child(2) {
    width: 60%;
  }

  .skeleton__line:nth-child(3) {
    width: 80%;
  }
}

// Animations
@keyframes shimmer {
  0% { background-position: -400% 0; }
  100% { background-position: 400% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}


.card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(10px);
  padding: 1.7rem 2rem;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  color: variables.$col-white;
  gap: 3rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease-in-out;
  margin-bottom: 1.1rem;

  @media (max-width: 1000px) {
    gap: 1.5rem;
    padding: 1.5rem 1.5rem;
  }

  &:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  }

  &::before {
    content: "";
    position: absolute;
    width: 200%;
    height: 100%;
    background: linear-gradient(
      120deg,
      rgba(255, 140, 66, 0.2),
      rgba(255, 215, 0, 0.05),
      rgba(0, 255, 255, 0.1)
    );
    top: -10%;
    left: -50%;
    transform: rotate(25deg);
    pointer-events: none;
  }

  &__left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1;

    .card__title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;

      h4 {
        font-size: 0.85rem;
        font-weight: 500;
        letter-spacing: 0.5px;
      }

      span {
        cursor: pointer;
        font-size: 1rem;
        display: flex;
        align-items: center;
        color: #ffb800;
        transition: transform 0.2s ease;
        position: fixed;
        left: 7rem;

        &:hover {
          transform: scale(1.15);
        }
      }
    }

    .card__amount {
      font-size: 1.2rem;
      font-weight: 700;
      color: #fff;
      letter-spacing: 1px;
      margin-top: 0.3rem;
    }

    .card__subtitle {
      font-size: 0.85rem;
      opacity: 0.65;
      margin-top: 0.25rem;
      letter-spacing: 0.5px;
    }
  }

  &__right {
    display: flex;
    gap: 0.8rem;
    z-index: 1;

    @media (max-width: 1000px) {
      width: 100%;
      justify-content: flex-end;
      gap: 0.5rem;
    }

    .actionBtn {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      font-weight: 500;
      font-size: 0.85rem;
      padding: 0.65rem 1rem;
      border-radius: 12px;
      border: none;
      text-decoration: none;
      cursor: pointer;
      transition: all 0.25s ease;
      backdrop-filter: blur(5px);
      background: rgba(255, 255, 255, 0.05);
      color: #fff;

      svg {
        font-size: 1rem;
      }

      &:hover {
        background: rgba(255, 140, 66, 0.15);
        color: #fff;
        transform: translateY(-2px);
      }

      &.fund {
        border: 1px solid #ff8c42;
        box-shadow: 0 0 12px rgba(255, 140, 66, 0.3);
        color: #ff8c42;
      }
      &.withdraw {
        border: 1px solid #ff5c5c;
        box-shadow: 0 0 12px rgba(255, 92, 92, 0.3);
        color: #ff5c5c;

        @media (max-width: 1000px) {
          display: none; // hide on mobile
        }
      }
      &.transfer {
        border: 1px solid #00d4ff;
        box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
        color: #00d4ff;

        @media (max-width: 1000px) {
          display: none; // hide on mobile
        }
      }
    }
  }

  /* Skeleton loader for mobile and desktop */
  .skeleton {
    background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.05) 25%,
      rgba(255, 255, 255, 0.15) 50%,
      rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 8px;
  }

  /* Mobile-specific skeleton: one main button */
  @media (max-width: 1000px) {
    .skeleton-btn {
      width: 120px;
      height: 36px;
      border-radius: 12px;
    }
  }

  @keyframes shimmer {
    0% {
      background-position: -200% 0;
    }
    100% {
      background-position: 200% 0;
    }
  }
}


.card__amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  margin-top: 0.3rem;
  
  .amountValue {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    white-space: nowrap; // prevent wrapping on mobile
  }

  .currency {
    font-size: 1.2rem;
    font-weight: 600;
  }
}
