/**
 * Button Component - Based on Original ProRank Unified Design
 * 
 * Premium button system with gradients, animations, and hover effects
 * From the original prorank-unified.css design
 * 
 * @module components/buttons
 * @since 3.0.0
 */

/* ============================================
   BASE BUTTON
   Foundation button styles - all buttons extend this
   ============================================ */

.prorank-button,
[class*="ProrankButton"] {
  /* Layout */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  
  /* Sizing */
  padding: 8px 16px;
  min-height: 36px;
  
  /* Typography */
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  
  /* Appearance */
  border-radius: 6px;
  border: none;
  cursor: pointer;
  
  /* Transitions */
  transition: var(--prorank-transition);
  
  /* Reset */
  background: none;
  color: inherit;
  font-family: inherit;
}

/* Focus states for accessibility */
.prorank-button:focus-visible {
  outline: 2px solid var(--prorank-primary);
  outline-offset: 2px;
}

/* Disabled state */
.prorank-button:disabled,
.prorank-button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   BUTTON VARIANTS
   Different button styles for different actions
   ============================================ */

/* Primary button - Main CTAs */
.prorank-button--primary,
.prorank-button-primary,
.prorank-button.is-primary,
.components-button.is-primary {
  background: var(--prorank-primary);
  color: white;
  border: none;
}

.prorank-button--primary:hover,
.prorank-button-primary:hover,
.prorank-button.is-primary:hover,
.components-button.is-primary:hover {
  background: var(--prorank-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.prorank-button--primary:active {
  transform: translateY(0);
}

/* Secondary button - Secondary actions (Blue) */
.prorank-button--secondary,
.prorank-button-secondary,
.prorank-button.is-secondary,
.components-button.is-secondary {
  background: #2563eb;
  color: white;
  border: none;
}

.prorank-button--secondary:hover,
.prorank-button-secondary:hover,
.components-button.is-secondary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Accent button - Special/Premium features */
.prorank-button--accent {
  background: var(--prorank-accent);
  color: white;
  border-color: var(--prorank-accent);
}

.prorank-button--accent:hover {
  background: #e55a2b; /* Darker orange */
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

/* Success button */
.prorank-button--success {
  background: var(--prorank-success);
  color: white;
  border-color: var(--prorank-success);
}

.prorank-button--success:hover {
  background: #059669; /* Darker green */
}

/* Danger/Delete button */
.prorank-button--danger,
.prorank-button-danger {
  background: var(--prorank-error);
  color: white;
  border-color: var(--prorank-error);
}

.prorank-button--danger:hover,
.prorank-button-danger:hover {
  background: #dc2626; /* Darker red */
}

/* Ghost button - Minimal style */
.prorank-button--ghost {
  background: transparent;
  color: var(--prorank-primary);
  border-color: transparent;
}

.prorank-button--ghost:hover {
  background: var(--prorank-bg-secondary);
}

/* Link button - Text only */
.prorank-button--link,
.components-button.is-link {
  background: transparent;
  color: var(--prorank-primary);
  border: none;
  padding: 0;
  text-decoration: underline;
  min-height: auto;
}

.prorank-button--link:hover {
  color: var(--prorank-primary-dark);
}

/* ============================================
   BUTTON SIZES
   Different sizes for different contexts
   ============================================ */

.prorank-button--small {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 30px;
}

.prorank-button--large {
  padding: 14px 28px;
  font-size: 16px;
  min-height: 48px;
}

.prorank-button--full {
  width: 100%;
}

/* ============================================
   BUTTON WITH ICONS
   Buttons containing icons
   ============================================ */

.prorank-button__icon {
  font-size: 16px;
  line-height: 1;
}

.prorank-button--icon-only {
  padding: 8px;
  min-width: 38px;
}

.prorank-button--icon-only .prorank-button__icon {
  margin: 0;
}

/* Loading state */
.prorank-button--loading {
  position: relative;
  color: transparent;
}

.prorank-button--loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
}

/* ============================================
   BUTTON GROUPS
   Multiple buttons grouped together
   ============================================ */

.prorank-button-group {
  display: inline-flex;
  gap: 8px;
}

.prorank-button-group--attached {
  gap: 0;
}

.prorank-button-group--attached .prorank-button {
  border-radius: 0;
  margin-left: -1px;
}

.prorank-button-group--attached .prorank-button:first-child {
  border-radius: 6px 0 0 6px;
  margin-left: 0;
}

.prorank-button-group--attached .prorank-button:last-child {
  border-radius: 0 6px 6px 0;
}

/* ============================================
   WORDPRESS COMPATIBILITY
   Override WordPress button styles
   ============================================ */

.wrap .prorank-button {
  text-decoration: none;
  font-size: 14px;
}

/* Override WordPress primary button */
.wp-core-ui .prorank-button--primary {
  background: var(--prorank-primary) !important;
  border-color: var(--prorank-primary) !important;
  color: white !important;
  text-shadow: none !important;
  box-shadow: none !important;
}

.wp-core-ui .prorank-button--primary:hover {
  background: var(--prorank-primary-dark) !important;
  border-color: var(--prorank-primary-dark) !important;
}