/**
 * Button Styles - סגנונות כפתורים
 * כל הסגנונות של כפתורים שצריכים להיות זמינים בכל מקום
 */

/* ========================================
   BASE BUTTON STYLES - סגנונות כפתור בסיסיים
   ======================================== */

.button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
  white-space: nowrap;
  border-radius: var(--radius-md) !important;

  &:focus-visible {
    outline: 4px solid var(--color-focus-outline);
  }

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
  }
}

/* ========================================
   BUTTON SIZES - גדלי כפתורים
   ======================================== */

.button-sm,
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.button-lg,
.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: 1.125rem;
  border-radius: var(--radius-lg);
}

/* ========================================
   BUTTON VARIANTS - וריאציות כפתורים
   ======================================== */

/* Primary Button - מעודכן עם מצבים מ-Figma */
.button-primary,
.btn-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  height: auto;
  color: var(--color-white);
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md) !important;
  /* מצב רגיל - Default State */
  &:not(:disabled) {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
  }

  /* מצב hover - עכבר מעל */
  &:hover:not(:disabled) {
    background-color: var(--color-primary-hover) !important;
  }

  /* מצב active - לחיצה */
  &:active:not(:disabled) {
    background-color: #a81a4e; /* גוון עוד יותר כהה */
    box-shadow: 0 2px 4px rgba(216, 36, 102, 0.2);
  }

  /* מצב focus - מקלדת */
  &:focus-visible {
  }

  /* מצב disabled - לא זמין - מעודכן לפי Figma */
  &:disabled {
    background-color: #d3d9de; /* var(--greyscale/surface/disabled) */
    border-color: #d3d9de;
    color: #98a6b3; /* var(--greyscale/text/disabled) */
    cursor: not-allowed;
    pointer-events: none;
    opacity: 1; /* הסרת opacity כדי לשמור על הצבעים המדויקים */
    transform: none;
    box-shadow: none;
  }

  /* אנימציית טעינה */
  &.loading {
    color: transparent;
    pointer-events: none;

    &::after {
      content: "";
      position: absolute;
      top: 50%;
      left: 50%;
      width: 20px;
      height: 20px;
      margin-top: -10px;
      margin-left: -10px;
      border: 2px solid var(--color-white);
      border-radius: 50%;
      border-top-color: transparent;
      animation: spin 1s linear infinite;
    }
  }

  /* אפקט ripple */
  &::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
  }

  &:active:not(:disabled)::before {
    width: 300px;
    height: 300px;
  }
}

/* Outline Button - מעודכן עם מצבים מ-Figma */
.button-secondary,
.btn-secondary {
  background-color: transparent !important;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  position: relative;
  overflow: hidden;
  height: 45px;
  
  &:hover:not(:disabled) {
    background-color: transparent;
    color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(216, 36, 102, 0.3);
  }

  &:active:not(:disabled) {
    background-color: #c01e5a;
    color: var(--color-white);
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(216, 36, 102, 0.2);
  }

  &:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
  }

  &:disabled {
    background-color: transparent;
    border-color: #d3d9de; /* var(--greyscale/surface/disabled) */
    color: #98a6b3; /* var(--greyscale/text/disabled) */
    cursor: not-allowed;
    pointer-events: none;
    opacity: 1; /* הסרת opacity כדי לשמור על הצבעים המדויקים */
    transform: none;
    box-shadow: none;
  }
}

/* Ghost Button */
.button-ghost,
.btn-ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--color-primary);

  &:hover:not(:disabled) {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
  }
}

/* Danger Button */
.button-danger,
.btn-danger {
  background-color: var(--color-error);
  border-color: var(--color-error);
  color: var(--color-white);

  &:hover:not(:disabled) {
    background-color: #dc2626;
    border-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  }
}

/* Success Button - מעודכן עם מצבים מ-Figma */
.button-success,
.btn-success {
  background-color: var(--color-success);
  border-color: var(--color-success);
  color: var(--color-white);
  position: relative;
  overflow: hidden;

  &:hover:not(:disabled) {
    background-color: #059669;
    border-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  }

  &:active:not(:disabled) {
    background-color: #047857;
    border-color: #047857;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
  }

  &:focus-visible {
    outline: 3px solid var(--color-success);
    outline-offset: 2px;
  }

  &:disabled {
    background-color: #d3d9de; /* var(--greyscale/surface/disabled) */
    border-color: #d3d9de;
    color: #98a6b3; /* var(--greyscale/text/disabled) */
    cursor: not-allowed;
    pointer-events: none;
    opacity: 1; /* הסרת opacity כדי לשמור על הצבעים המדויקים */
    transform: none;
    box-shadow: none;
  }
}

/* ========================================
   BUTTON GROUPS - קבוצות כפתורים
   ======================================== */

.button-group,
.btn-group {
  display: inline-flex;
  border-radius: var(--radius-md);
  overflow: hidden;

  .button,
  .btn {
    border-radius: 0;
    border-right-width: 0;

    &:first-child {
      border-top-left-radius: var(--radius-md);
      border-bottom-left-radius: var(--radius-md);
    }

    &:last-child {
      border-top-right-radius: var(--radius-md);
      border-bottom-right-radius: var(--radius-md);
      border-right-width: 1px;
    }
  }
}

/* ========================================
   ICON BUTTONS - כפתורים עם אייקונים
   ======================================== */

.button-icon,
.btn-icon {
  padding: var(--space-2);
  width: 2.5rem;
  height: 2.5rem;

  &.button-sm,
  &.btn-sm {
    width: 2rem;
    height: 2rem;
    padding: var(--space-1);
  }

  &.button-lg,
  &.btn-lg {
    width: 3rem;
    height: 3rem;
    padding: var(--space-3);
  }
}

/* ========================================
   LOADING STATE - מצב טעינה
   ======================================== */

.button-loading,
.btn-loading {
  position: relative;
  color: transparent;

  &::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin-top: -0.5rem;
    margin-left: -0.5rem;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
  }
}

/* ========================================
   BUTTON SPECIAL STATES - מצבים מיוחדים
   ======================================== */

/* כפתור עם טעינה - Loading State */
.button.loading,
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;

  &::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
  }
}

/* כפתור עם אפקט pulse */
.button.pulse,
.btn.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(216, 36, 102, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(216, 36, 102, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(216, 36, 102, 0);
  }
}

/* כפתור עם אפקט glow */
.button.glow,
.btn.glow {
  box-shadow: 0 0 20px rgba(216, 36, 102, 0.5);

  &:hover:not(:disabled) {
    box-shadow: 0 0 30px rgba(216, 36, 102, 0.8);
  }
}

/* כפתור עם אפקט gradient */
.button.gradient,
.btn.gradient {
  background: linear-gradient(135deg, var(--color-primary) 0%, #e91e63 100%);
  border: none;

  &:hover:not(:disabled) {
    background: linear-gradient(135deg, #c01e5a 0%, #d81b60 100%);
  }
}

/* כפתור עם אפקט 3D */
.button.three-d,
.btn.three-d {
  box-shadow: 0 4px 0 #a81a4e, 0 6px 10px rgba(0, 0, 0, 0.1);

  &:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #a81a4e, 0 3px 5px rgba(0, 0, 0, 0.1);
  }
}

/* כפתור עם אפקט shimmer */
.button.shimmer,
.btn.shimmer {
  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.4),
      transparent
    );
    transition: left 0.5s;
  }

  &:hover:not(:disabled)::before {
    left: 100%;
  }
}

/* כפתור עם אפקט bounce */
.button.bounce,
.btn.bounce {
  &:hover:not(:disabled) {
    animation: bounce 0.6s ease;
  }
}

@keyframes bounce {
  0%,
  20%,
  60%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  80% {
    transform: translateY(-5px);
  }
}

/* ========================================
   DISABLED BUTTON CLASS - קלאס כפתור disabled
   ======================================== */

/* קלאס מיוחד לכפתור disabled - עקבי עם Figma */
.btn.disabled,
.button.disabled {
  background-color: #d3d9de !important; /* var(--greyscale/surface/disabled) */
  border-color: #d3d9de !important;
  color: #98a6b3 !important; /* var(--greyscale/text/disabled) */
  cursor: not-allowed !important;
  pointer-events: none !important;
  opacity: 1 !important;
  transform: none !important;
  box-shadow: none !important;
}

/* ========================================
   RESPONSIVE BUTTONS - כפתורים רספונסיביים
   ======================================== */

@media (max-width: 640px) {
  .button,
  .btn {
    width: 100%;
    justify-content: center;
  }

  .button-group,
  .btn-group {
    width: 100%;

    .button,
    .btn {
      flex: 1;
    }
  }

  /* התאמה למובייל עבור כפתורי Figma */
  .button-figma-primary,
  .btn-figma-primary {
    padding: 10px 24px;
    font-size: 18px;
  }
}
