/* Global Button CSS Variables */
:root {
  /* Button Colors */
  --button-primary-bg: var(--color-secondary);
  --button-primary-bg-hover: var(--color-secondary-hover);
  --button-primary-bg-disabled: var(--color-secondary-disabled);
  --button-primary-text: white;
  
  --button-secondary-bg: var(--color-gray-disabled);
  --button-secondary-bg-hover: var(--color-gray);
  --button-secondary-bg-disabled: var(--color-gray-disabled);
  --button-secondary-text: var(--color-text);
  
  --button-danger-bg: #dc3545;
  --button-danger-bg-hover: #c82333;
  --button-danger-bg-disabled: #dc3545;
  --button-danger-text: white;
  
  --button-success-bg: #28a745;
  --button-success-bg-hover: #218838;
  --button-success-bg-disabled: #28a745;
  --button-success-text: white;
  
  --button-warning-bg: #ffc107;
  --button-warning-bg-hover: #e0a800;
  --button-warning-bg-disabled: #ffc107;
  --button-warning-text: #212529;
  
  /* Button Sizes */
  --button-sm-padding: 8px 12px;
  --button-sm-font-size: 12px;
  --button-sm-icon-size: 14px;
  
  --button-md-padding: 10px 20px;
  --button-md-font-size: 14px;
  --button-md-icon-size: 16px;
  
  --button-lg-padding: 12px 24px;
  --button-lg-font-size: 16px;
  --button-lg-icon-size: 18px;
  
  /* Button Border Radius */
  --button-border-radius: 30px;
  
  /* Button Transitions */
  --button-transition: all 0.2s ease;
}

/* Base Button Styles */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--button-border-radius);
  font-family: var(--font-family);
  font-weight: 500;
  cursor: pointer;
  transition: var(--button-transition);
  text-decoration: none;
  outline: none;
  position: relative;
  white-space: nowrap;
  user-select: none;
}

.button:focus {
  box-shadow: 0 0 0 2px rgba(var(--color-secondary-rgb), 0.3);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.button.loading {
  cursor: not-allowed;
  opacity: 0.7;
}

.button.loading .buttonIcon {
  animation: spin 1s linear infinite;
}

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

/* Button Variants */
.buttonPrimary {
  background: var(--button-primary-bg);
  color: var(--button-primary-text);
}

.buttonPrimary:hover:not(:disabled) {
  background: var(--button-primary-bg-hover);
}

.buttonSecondary {
  background: var(--button-secondary-bg);
  color: var(--button-secondary-text);
}

.buttonSecondary:hover:not(:disabled) {
  background: var(--color-secondary-hover);
  color: white;
}

.buttonDanger {
  background: var(--button-danger-bg);
  color: var(--button-danger-text);
}

.buttonDanger:hover:not(:disabled) {
  background: var(--button-danger-bg-hover);
}

.buttonSuccess {
  background: var(--button-success-bg);
  color: var(--button-success-text);
}

.buttonSuccess:hover:not(:disabled) {
  background: var(--button-success-bg-hover);
}

.buttonWarning {
  background: var(--button-warning-bg);
  color: var(--button-warning-text);
}

.buttonWarning:hover:not(:disabled) {
  background: var(--button-warning-bg-hover);
}

/* Button Sizes */
.buttonSm {
  padding: var(--button-sm-padding);
  font-size: var(--button-sm-font-size);
}

.buttonSm .buttonIcon {
  font-size: var(--button-sm-icon-size);
}

.buttonMd {
  padding: var(--button-md-padding);
  font-size: var(--button-md-font-size);
}

.buttonMd .buttonIcon {
  font-size: var(--button-md-icon-size);
}

.buttonLg {
  padding: var(--button-lg-padding);
  font-size: var(--button-lg-font-size);
}

.buttonLg .buttonIcon {
  font-size: var(--button-lg-icon-size);
}

/* Icon Styles */
.buttonIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.buttonIconLeft {
  order: -1;
}

.buttonIconRight {
  order: 1;
}

/* Loading Spinner */
.buttonSpinner {
  width: 1em;
  height: 1em;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Upload Button Specific Styles */
.uploadButton {
  position: relative;
}

.hiddenInput {
  display: none;
}

/* Spinner Icon for Upload Button */
.spinnerIcon {
  width: 1em;
  height: 1em;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
  .buttonSm {
    padding: 4px 8px;
    font-size: 11px;
  }
  
  .buttonMd {
    padding: 8px 16px;
    font-size: 13px;
  }
  
  .buttonLg {
    padding: 10px 20px;
    font-size: 15px;
  }
}