/* ==== 
 --------- (3.01) buttons styles start ---------
 ==== */

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

// Base button styles using modern design system
.btn {
  @include button-base;
  @include focus-visible;
  
  // Legacy styles for backward compatibility
  padding: var(--space-4) var(--space-10);
  font-weight: var(--font-weight-semibold);
  border: 1px solid var(--secondary-300);
  border-radius: var(--radius-lg);
  color: var(--secondary-600);
  position: relative;
  overflow: hidden;
  text-transform: none;
  z-index: 1;
  letter-spacing: 0.5px;
  
  &::before {
    content: "";
    position: absolute;
    inset: 0px;
    width: 0px;
    transition: var(--transition-default);
    background-color: var(--primary-600);
    z-index: -1;
  }

  &:hover:not(:disabled) {
    border-color: var(--primary-600);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    
    &::before {
      width: 100%;
    }
  }

  &:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
  }

  &:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-600), 0.1);
  }
  
  // Button variants
  &.btn-primary {
    background-color: var(--primary-600);
    border-color: var(--primary-600);
    color: var(--white);
    
    &::before {
      background-color: var(--primary-700);
    }
    
    &:hover:not(:disabled) {
      background-color: var(--primary-700);
      border-color: var(--primary-700);
    }
  }
  
  &.btn-secondary {
    background-color: var(--secondary-100);
    border-color: var(--secondary-200);
    color: var(--secondary-700);
    
    &::before {
      background-color: var(--secondary-200);
    }
    
    &:hover:not(:disabled) {
      background-color: var(--secondary-200);
      border-color: var(--secondary-300);
      color: var(--secondary-800);
    }
  }
  
  &.btn-outline {
    background-color: transparent;
    border-color: var(--primary-600);
    color: var(--primary-600);
    
    &::before {
      background-color: var(--primary-600);
    }
    
    &:hover:not(:disabled) {
      background-color: var(--primary-600);
      color: var(--white);
    }
  }
  
  &.btn-ghost {
    background-color: transparent;
    border-color: transparent;
    color: var(--secondary-600);
    
    &::before {
      background-color: var(--secondary-100);
    }
    
    &:hover:not(:disabled) {
      background-color: var(--secondary-100);
      color: var(--secondary-800);
    }
  }
  
  // Button sizes
  &.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
    border-radius: var(--radius-md);
  }
  
  &.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
    border-radius: var(--radius-xl);
  }
  
  &.btn-xl {
    padding: var(--space-5) var(--space-10);
    font-size: var(--text-xl);
    border-radius: var(--radius-2xl);
  }
  
  // Button states
  &.btn-loading {
    position: relative;
    color: transparent;
    
    &::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 16px;
      height: 16px;
      margin: -8px 0 0 -8px;
      border: 2px solid currentColor;
      border-top-color: transparent;
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }
  }
  
  &.btn-disabled,
  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
  }
}

// Modern animated button with improved accessibility
.btn-anim {
  @include flex-center;
  @include focus-visible;
  
  width: 170px;
  height: 170px;
  border: 1px solid var(--white);
  border-radius: 50%;
  color: var(--white);
  font-weight: var(--font-weight-semibold);
  position: relative;
  overflow: hidden;
  gap: var(--space-4);
  z-index: 1;
  padding: 0;
  transition: var(--transition-default);
  
  span {
    position: absolute;
    z-index: -1;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--primary-600);
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1), 
                padding-top 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  &:hover:not(:disabled) {
    color: var(--white);
    border-color: var(--primary-600);
    transform: scale(1.05);
    
    span {
      width: calc(100% * 2.25);
      padding-top: calc(100% * 2.25);
    }
  }
  
  &:active:not(:disabled) {
    transform: scale(0.98);
  }
  
  // Responsive sizing
  @include mobile-only {
    width: 140px;
    height: 140px;
    font-size: var(--text-sm);
  }
}

// Alternative button style with modern improvements
.alter-btn {
  @include flex-center;
  @include focus-visible;
  
  padding: var(--space-16) var(--space-10);
  width: 200px;
  height: 200px;
  border-radius: 50%;
  display: inline-flex;
  flex-wrap: wrap;
  row-gap: var(--space-2);
  border: 1px solid var(--white);
  color: var(--white);
  justify-content: flex-start;
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-lg);
  transition: var(--transition-default);
  
  &:hover:not(:disabled) {
    color: var(--secondary-800);
    border-color: var(--primary-600);
    background-color: var(--white);
    transform: scale(1.05);
  }
  
  &:active:not(:disabled) {
    transform: scale(0.98);
  }
  
  // Responsive sizing
  @include mobile-only {
    width: 160px;
    height: 160px;
    padding: var(--space-12) var(--space-8);
    font-size: var(--text-base);
  }
}

// Light variant of animated button
.btn-anim-light {
  @include focus-visible;
  
  border: 1px solid var(--secondary-800);
  color: var(--secondary-800);
  background-color: var(--white);
  
  span {
    background-color: var(--primary-600);
  }
  
  &:hover:not(:disabled) {
    border-color: var(--primary-600);
    color: var(--white);
    background-color: var(--primary-600);
  }
}

// Modern line button with improved animations
.btn-line {
  @include focus-visible;
  
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.5px;
  color: var(--secondary-600);
  position: relative;
  background: none;
  border: none;
  padding: var(--space-2) 0;
  cursor: pointer;
  transition: var(--transition-colors);
  
  &::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 2px;
    background-color: var(--secondary-300);
    transition: var(--transition-default);
  }
  
  &::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-600);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  &:hover:not(:disabled) {
    color: var(--primary-600);
    
    &::before {
      width: 0;
      left: 100%;
    }
    
    &::after {
      width: 100%;
    }
  }
  
  &:active:not(:disabled) {
    color: var(--primary-700);
  }
}

// Modern button variants
.btn-gradient {
  @include button-base;
  @include focus-visible;
  
  background: linear-gradient(135deg, var(--primary-600), var(--primary-400));
  border: none;
  color: var(--white);
  position: relative;
  overflow: hidden;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
  }
  
  &:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-500));
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    
    &::before {
      left: 100%;
    }
  }
}

.btn-glass {
  @include button-base;
  @include focus-visible;
  @include glassmorphism(0.1, 10px);
  
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
  backdrop-filter: blur(10px);
  
  &:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
  }
}

.btn-floating {
  @include button-base;
  @include focus-visible;
  @include shadow-elevation(3);
  
  border-radius: var(--radius-full);
  width: 56px;
  height: 56px;
  padding: 0;
  
  &:hover:not(:disabled) {
    @include shadow-elevation(4);
    transform: translateY(-4px) scale(1.05);
  }
  
  &:active:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
  }
}

.btn-icon {
  @include button-base;
  @include focus-visible;
  
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-lg);
  
  i {
    font-size: var(--text-lg);
  }
  
  &:hover:not(:disabled) {
    transform: scale(1.1);
  }
}

// Legacy angle button with modern improvements
.btn-angle {
  position: relative;
  font-weight: 400;
  padding: 6px 24px;
  font-size: 16px;
  text-align: center;
  justify-content: center;
  gap: 0px;
  &::before {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    top: 0px;
    left: 0px;
    border-left: 1px solid white;
    border-top: 1px solid white;
    transition: var(--transition);
  }

  &::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    top: 0px;
    right: 0px;
    border-right: 1px solid white;
    border-top: 1px solid white;
    transition: var(--transition);
  }

  span {
    display: inline-block;
  }

  span::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    bottom: 0px;
    right: 0px;
    border-right: 1px solid white;
    border-bottom: 1px solid white;
    transition: var(--transition);
  }

  span::before {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    bottom: 0px;
    left: 0px;
    border-left: 1px solid white;
    border-bottom: 1px solid white;
    transition: var(--transition);
  }
  &:hover {
    &::after,
    &::before,
    span::after,
    span::before {
      width: calc(50% + 0px);
      height: calc(50% + 0px);
      border-color: var(--enterprise-blue);
    }
  }
}

// scroll to top with progress
.progress-wrap {
  position: fixed;
  right: 30px;
  bottom: 30px;
  height: 50px;
  width: 50px;
  cursor: pointer;
  display: block;
  border-radius: 50px;
  background-color: #1f1f1f;
  box-shadow: inset 0 0 0 8px #1f1f1f;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: all 200ms linear;
  z-index: 999;
  overflow: hidden;

  span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 34px;
    height: 34px;
    background-color: var(--white);
    border-radius: 50%;
    overflow: hidden;
    &::after {
      content: "\f176";
      font-family: "Font Awesome 6 Free";
      font-weight: 900;
      position: absolute;
      text-align: center;
      line-height: 34px;
      font-size: 16px;
      border-radius: 50%;
      color: var(--black);
      left: 50%;
      top: 50%;
      transform: translate(-50%, 200%);
      height: 34px;
      width: 34px;
      cursor: pointer;
      display: block;
      z-index: 1;
      transition: all 200ms linear;
    }

    &::before {
      content: "\f176";
      font-family: "Font Awesome 6 Free";
      font-weight: 900;
      text-align: center;
      line-height: 34px;
      position: absolute;
      font-size: 16px;
      border-radius: 50%;
      color: var(--black);
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      height: 34px;
      width: 34px;
      cursor: pointer;
      display: block;
      z-index: 2;
      transition: all 200ms linear;
    }
  }

  &:hover {
    span {
      &::before {
        transform: translate(-50%, -200%);
      }
      &::after {
        transform: translate(-50%, -50%);
      }
    }
  }

  path {
    fill: none;
  }

  .progress-circle {
    path {
      stroke: var(--enterprise-blue);
      stroke-width: 4;
      box-sizing: content-box;
    }
  }
}

.active-progress {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

// Animations
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

// Button group utilities
.btn-group {
  display: inline-flex;
  border-radius: var(--radius-lg);
  overflow: hidden;
  
  .btn {
    border-radius: 0;
    border-right-width: 0;
    
    &:first-child {
      border-top-left-radius: var(--radius-lg);
      border-bottom-left-radius: var(--radius-lg);
    }
    
    &:last-child {
      border-top-right-radius: var(--radius-lg);
      border-bottom-right-radius: var(--radius-lg);
      border-right-width: 1px;
    }
    
    &:only-child {
      border-radius: var(--radius-lg);
      border-right-width: 1px;
    }
  }
}

// Responsive button adjustments
@include mobile-only {
  .btn {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-sm);
  }
  
  .btn-anim {
    width: 120px;
    height: 120px;
    font-size: var(--text-sm);
  }
  
  .alter-btn {
    width: 140px;
    height: 140px;
    padding: var(--space-8) var(--space-6);
  }
}

/* ==== 
 --------- (3.01) buttons styles end ---------
 ==== */
