/* ============================================
   Button Component System
   Complete button styles with all variants
   ============================================ */

/* ============================================
   Base Button Styles
   ============================================ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  margin: var(--space-1) var(--space-2);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: 1.5;
  font-family: inherit;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: var(--transition-all-base);
  position: relative;
  overflow: hidden;
  
  /* Default style (secondary) */
  background: var(--glass-white-10);
  color: var(--text-primary);
  border-color: var(--glass-white-20);
}

.button:hover {
  text-decoration: none;
  background: var(--glass-white-15);
  border-color: var(--glass-white-30);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.button:active {
  transform: translateY(0);
  box-shadow: none;
}

.button:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--glass-white-30);
}

/* ============================================
   Button Variants
   ============================================ */

/* Primary Button - Green gradient (main CTA) */
.button-primary {
  background: var(--gradient-cta);
  color: white;
  border: 1px solid rgba(34, 197, 94, 0.4);
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.button-primary:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 1) 0%, rgba(22, 163, 74, 1) 100%);
  border-color: rgba(34, 197, 94, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.button-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.button-primary:focus {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
}

/* Secondary Button - Glass morphism */
.button-secondary {
  background: var(--glass-white-10);
  color: var(--text-primary);
  border: 1px solid var(--glass-white-20);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
}

.button-secondary:hover {
  background: var(--glass-white-15);
  border-color: var(--glass-white-30);
}

/* Success/CTA Button - Alias for primary */
.button-success,
.button-cta,
.button-gradient-green {
  background: var(--gradient-cta);
  color: white;
  border: 1px solid rgba(34, 197, 94, 0.4);
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.button-success:hover,
.button-cta:hover,
.button-gradient-green:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 1) 0%, rgba(22, 163, 74, 1) 100%);
  border-color: rgba(34, 197, 94, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.button-success:focus,
.button-cta:focus,
.button-gradient-green:focus {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
}

/* Danger Button */
.button-danger {
  background: var(--color-danger);
  color: white;
  border-color: transparent;
}

.button-danger:hover {
  background: #d91e48;
  box-shadow: var(--shadow-md);
}

/* Warning Button */
.button-warning {
  background: var(--color-warning);
  color: #000;
  border-color: transparent;
}

.button-warning:hover {
  background: #e0a800;
  box-shadow: var(--shadow-md);
}

/* Info Button */
.button-info {
  background: var(--color-info);
  color: white;
  border-color: transparent;
}

.button-info:hover {
  background: #0baccc;
  box-shadow: var(--shadow-md);
}

/* Outline Variants */
.button-outline-primary,
.button-outline {
  background: transparent;
  color: var(--brand-primary);
  border: 2px solid var(--brand-primary);
}

.button-outline-primary:hover,
.button-outline:hover {
  background: var(--glass-brand);
  color: var(--brand-primary-light);
  border-color: var(--brand-primary-light);
}

.button-outline-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--glass-white-20);
}

.button-outline-secondary:hover {
  background: var(--glass-white-10);
  color: var(--text-primary);
  border-color: var(--glass-white-30);
}

/* Ghost Button - No border */
.button-ghost {
  background: transparent;
  color: var(--text-primary);
  border: none;
  box-shadow: none;
}

.button-ghost:hover {
  background: var(--glass-white-10);
  transform: none;
}

/* Link Button - Looks like a link */
.button-link {
  background: transparent;
  color: var(--brand-primary);
  border: none;
  box-shadow: none;
  padding: 0;
  font-weight: var(--font-normal);
  text-decoration: underline;
}

.button-link:hover {
  color: var(--brand-primary-light);
  transform: none;
}

/* Glass/Translucent Button */
.button-glass,
.button-translucent {
  background: var(--glass-white-20);
  color: var(--text-primary);
  border: 1px solid var(--glass-white-30);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
}

.button-glass:hover,
.button-translucent:hover {
  background: var(--glass-white-30);
  border-color: var(--glass-white-30);
}

/* ============================================
   Button Sizes
   ============================================ */

.button-xs {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.button-sm,
.button-small {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}

.button-lg,
.button-large {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}

.button-xl {
  padding: var(--space-5) var(--space-10);
  font-size: var(--text-xl);
  border-radius: var(--radius-xl);
  min-width: 200px;
}

/* ============================================
   Button States
   ============================================ */

/* Disabled State */
.button:disabled,
.button-disabled,
.button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

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

.button-loading:hover {
    transform: none;
    box-shadow: none;
}

/* Spinner styles */
.button-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: button-spin 0.8s linear infinite;
    vertical-align: middle;
}

/* Success checkmark */
.button-checkmark {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: middle;
}

/* Success state */
.button-success {
    background: #10b981 !important;
    border-color: #10b981 !important;
    color: white !important;
    pointer-events: none;
}

.button-success .button-checkmark {
    color: white;
}

/* Error state */
.button-error {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: white !important;
    pointer-events: none;
}

.button-error .button-error-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: middle;
    color: white;
}

/* Translucent button spinner */
.button-translucent .button-spinner {
    border-color: rgba(0, 0, 0, 0.2);
    border-top-color: currentColor;
}

/* Secondary button spinner */
.button-secondary .button-spinner {
    border-color: rgba(129, 140, 248, 0.3);
    border-top-color: #818cf8;
}

/* Spinner animation */
@keyframes button-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Size adjustments for spinner */
.button-small .button-spinner {
    width: 12px;
    height: 12px;
    margin-right: 6px;
}

.button-large .button-spinner {
    width: 16px;
    height: 16px;
    margin-right: 10px;
}

/* Ensure proper alignment */
.button-loading span {
    vertical-align: middle;
}

/* Active/Selected State */
.button-active,
.button.active {
  background: var(--brand-primary);
  color: var(--text-on-brand);
  border-color: var(--brand-primary);
}

/* ============================================
   Button Modifiers
   ============================================ */

/* Full Width - takes full width of container */
.button-full-width,
.button-block,
.button-full {
  width: 100%;
  display: flex;
  margin: 0; /* Reset margin for full width buttons */
}

/* Round Button */
.button-round {
  border-radius: var(--radius-full);
}

/* Square Button (for icons) */
.button-square {
  padding: var(--space-3);
  aspect-ratio: 1;
}

/* Icon Button */
.button-icon {
  padding: var(--space-2);
  min-width: auto;
}

.button-icon svg {
  width: 20px;
  height: 20px;
}

/* Buttons naturally display inline with spacing via margin */
/* No need for button-group wrapper */

/* ============================================
   Icon Animations
   ============================================ */

.button .icon-right {
  margin-left: var(--space-2);
  transition: transform var(--transition-base);
}

.button:hover .icon-right {
  transform: translateX(3px);
}

.button .icon-left {
  margin-right: var(--space-2);
  transition: transform var(--transition-base);
}

.button:hover .icon-left {
  transform: translateX(-3px);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
  .button {
    padding: var(--space-2) var(--space-5);
    font-size: var(--text-sm);
  }
  
  .button-lg,
  .button-large {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
  }
  
  /* Responsive button behavior handled by button-mobile-full class */
}

@media (max-width: 480px) {
  /* Full width buttons on mobile */
  .button-mobile-full {
    width: 100%;
  }
}/* HTMX Loading States */
.htmx-indicator {
  display: none !important;
}

.htmx-request .htmx-indicator {
  display: inline-block !important;
}

.htmx-request .button-text {
  display: none !important;
}
