/* Button Components (Modern) - Custom Design */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro", sans-serif;
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  /* Custom crisp edges - slightly angular */
  clip-path: polygon(
    0 0,
    calc(100% - 4px) 0,
    100% 4px,
    100% 100%,
    4px 100%,
    0 calc(100% - 4px)
  );
  transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.12s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.15s ease;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.btn:hover::before {
  opacity: 1;
}

.btn:focus {
  outline: none;
}

.btn:focus-visible {
  outline: 2px solid #5B8DEF;
  outline-offset: 3px;
}

/* Primary Button - Bold, confident, with strong shadow */
.btn-primary {
  background: linear-gradient(135deg, #5B8DEF 0%, #4A7AD8 100%);
  color: var(--ui-text);
  box-shadow: 
    0 4px 12px rgba(91, 141, 239, 0.45),
    0 2px 4px rgba(74, 122, 216, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4A7AD8 0%, #3D6BC4 100%);
  box-shadow: 
    0 6px 16px rgba(91, 141, 239, 0.55),
    0 3px 6px rgba(74, 122, 216, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-2px) scale(1.02);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 
    0 2px 6px rgba(91, 141, 239, 0.5),
    0 1px 2px rgba(74, 122, 216, 0.4),
    inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Secondary Button - Outlined with subtle glow */
.btn-secondary {
  background-color: transparent;
  color: #5B8DEF;
  border: 2px solid #5B8DEF;
  box-shadow: 
    0 0 0 0 rgba(91, 141, 239, 0),
    inset 0 0 0 0 rgba(91, 141, 239, 0);
  position: relative;
}

.btn-secondary::after {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 2px solid #5B8DEF;
  opacity: 0;
  filter: blur(4px);
  transition: opacity 0.2s ease;
}

.btn-secondary:hover {
  background-color: rgba(91, 141, 239, 0.1);
  border-color: #6B9DFF;
  color: #6B9DFF;
  transform: translateY(-1px);
}

.btn-secondary:hover::after {
  opacity: 0.6;
}

.btn-secondary:active {
  transform: translateY(0) scale(0.98);
  background-color: rgba(74, 140, 255, 0.15);
}

/* Ghost Button - Minimal, text-focused */
.btn-ghost {
  background-color: transparent;
  color: var(--ui-muted);
  border: none;
  padding: 10px 16px;
  position: relative;
}

.btn-ghost::after {
  content: "";
  position: absolute;
  bottom: 6px;
  left: 16px;
  right: 16px;
  height: 2px;
  background-color: #5B8DEF;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-ghost:hover {
  color: var(--ui-text);
  background-color: rgba(255, 255, 255, 0.04);
}

.btn-ghost:hover::after {
  transform: scaleX(1);
}

.btn-ghost:active {
  transform: scale(0.96);
  background-color: rgba(255, 255, 255, 0.08);
}

/* Destructive Button - Warning with intensity */
.btn-destructive {
  background: linear-gradient(135deg, #D85C5C 0%, #C44A4A 100%);
  color: var(--ui-text);
  box-shadow: 
    0 4px 12px rgba(216, 92, 92, 0.45),
    0 2px 4px rgba(196, 74, 74, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.btn-destructive:hover {
  background: linear-gradient(135deg, #C44A4A 0%, #B03D3D 100%);
  box-shadow: 
    0 6px 16px rgba(216, 92, 92, 0.55),
    0 3px 6px rgba(196, 74, 74, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transform: translateY(-2px) scale(1.02);
}

.btn-destructive:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 
    0 2px 6px rgba(216, 92, 92, 0.5),
    0 1px 2px rgba(196, 74, 74, 0.4),
    inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Action Button - Small, simple, for positive actions */
.btn-action {
  padding: 6px 14px;
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  background-color: #7BADFF;
  color: var(--ui-text);
  box-shadow: 
    0 2px 6px rgba(123, 173, 255, 0.3),
    0 1px 2px rgba(123, 173, 255, 0.2);
  clip-path: polygon(
    0 0,
    calc(100% - 3px) 0,
    100% 3px,
    100% 100%,
    3px 100%,
    0 calc(100% - 3px)
  );
}

.btn-action:hover {
  background-color: #6B9DFF;
  box-shadow: 
    0 3px 8px rgba(123, 173, 255, 0.4),
    0 1px 3px rgba(123, 173, 255, 0.3);
  transform: translateY(-1px) scale(1.01);
}

.btn-action:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 
    0 1px 4px rgba(123, 173, 255, 0.3),
    0 1px 2px rgba(123, 173, 255, 0.2);
}

.btn-action:focus-visible {
  outline: 2px solid #7BADFF;
  outline-offset: 2px;
}

/* Icon Button - Subtle, appears on hover */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  background-color: transparent;
  color: var(--ui-muted);
  opacity: 0.5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  clip-path: none;
  position: relative;
  transition: opacity 0.2s ease, 
              background-color 0.2s ease,
              transform 0.12s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon::before {
  display: none;
}

.btn-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.2s ease, height 0.2s ease;
}

.btn-icon:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--ui-text);
  transform: scale(1.1);
}

.btn-icon:hover::after {
  width: 100%;
  height: 100%;
}

.btn-icon:active {
  transform: scale(0.95);
  background-color: rgba(255, 255, 255, 0.12);
}

.btn-icon:focus-visible {
  outline: 2px solid #5B8DEF;
  outline-offset: 2px;
  opacity: 1;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  position: relative;
  z-index: 1;
}

/* Loading State */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}

.btn-loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Save Button Ready State - Attention-grabbing animation */
.btn-save-ready {
  position: relative;
  animation: save-button-bounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55),
             save-button-pulse 2s ease-in-out 0.6s infinite;
  box-shadow: 
    0 4px 12px rgba(91, 141, 239, 0.45),
    0 2px 4px rgba(74, 122, 216, 0.35),
    0 0 0 0 rgba(91, 141, 239, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-save-ready::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(91, 141, 239, 0.3);
  transform: translate(-50%, -50%);
  animation: save-button-ripple 2s ease-out 0.6s infinite;
  pointer-events: none;
}

@keyframes save-button-bounce {
  0% {
    transform: translateY(0) scale(1);
  }
  25% {
    transform: translateY(-8px) scale(1.05);
  }
  50% {
    transform: translateY(0) scale(1);
  }
  75% {
    transform: translateY(-4px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes save-button-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 
      0 4px 12px rgba(91, 141, 239, 0.45),
      0 2px 4px rgba(74, 122, 216, 0.35),
      0 0 0 0 rgba(91, 141, 239, 0.7),
      inset 0 1px 0 rgba(255, 255, 255, 0.25);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 
      0 6px 20px rgba(91, 141, 239, 0.6),
      0 3px 8px rgba(74, 122, 216, 0.5),
      0 0 0 8px rgba(91, 141, 239, 0),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
}

@keyframes save-button-ripple {
  0% {
    width: 0;
    height: 0;
    opacity: 0.8;
  }
  50% {
    width: 200px;
    height: 200px;
    opacity: 0.4;
  }
  100% {
    width: 300px;
    height: 300px;
    opacity: 0;
  }
}

/* Submit Button Animation - Before form submission */
.btn-submit-animating {
  position: relative;
  animation: submit-button-highlight 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 4px 12px rgba(91, 141, 239, 0.45),
    0 2px 4px rgba(74, 122, 216, 0.35),
    0 0 0 0 rgba(91, 141, 239, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-submit-animating::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(91, 141, 239, 0.4);
  transform: translate(-50%, -50%);
  animation: submit-button-ripple 1.2s ease-out;
  pointer-events: none;
}

@keyframes submit-button-highlight {
  0% {
    transform: scale(1);
    box-shadow: 
      0 4px 12px rgba(91, 141, 239, 0.45),
      0 2px 4px rgba(74, 122, 216, 0.35),
      0 0 0 0 rgba(91, 141, 239, 0.7),
      inset 0 1px 0 rgba(255, 255, 255, 0.25);
  }
  30% {
    transform: scale(1.08) translateY(-4px);
    box-shadow: 
      0 8px 24px rgba(91, 141, 239, 0.6),
      0 4px 8px rgba(74, 122, 216, 0.5),
      0 0 0 4px rgba(91, 141, 239, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  60% {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 
      0 6px 20px rgba(91, 141, 239, 0.65),
      0 3px 6px rgba(74, 122, 216, 0.55),
      0 0 0 6px rgba(91, 141, 239, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  100% {
    transform: scale(1.02);
    box-shadow: 
      0 4px 12px rgba(91, 141, 239, 0.45),
      0 2px 4px rgba(74, 122, 216, 0.35),
      0 0 0 8px rgba(91, 141, 239, 0),
      inset 0 1px 0 rgba(255, 255, 255, 0.25);
  }
}

@keyframes submit-button-ripple {
  0% {
    width: 0;
    height: 0;
    opacity: 0.8;
  }
  50% {
    width: 150px;
    height: 150px;
    opacity: 0.4;
  }
  100% {
    width: 250px;
    height: 250px;
    opacity: 0;
  }
}

