/* Modern Button System */

/* Base button styling */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: var(--leading-none);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  min-height: 44px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

/* Button Sizes - Pill Style */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  min-height: 36px;
  border-radius: var(--radius-full);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  min-height: 52px;
  border-radius: var(--radius-full);
}

.btn-xl {
  padding: var(--space-5) var(--space-10);
  font-size: var(--text-xl);
  min-height: 60px;
  border-radius: var(--radius-full);
}

/* Primary Button */
.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: var(--font-semibold);
}

.btn-primary:hover {
  background: var(--secondary-green);
  border-color: var(--secondary-green);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Secondary Button */
.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border-color: var(--gray-300);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline:active {
  transform: translateY(0);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

/* Danger Button */
.btn-danger {
  background: var(--error);
  color: var(--white);
  border-color: var(--error);
  box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-danger:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Success Button */
.btn-success {
  background: var(--success);
  color: var(--white);
  border-color: var(--success);
  box-shadow: var(--shadow-sm);
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-success:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Button Modifiers */
.btn-block {
  width: 100%;
  display: flex;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-lg);
}

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

.btn-icon.btn-sm {
  width: 36px;
  height: 36px;
}

.btn-icon.btn-lg {
  width: 52px;
  height: 52px;
}

.btn-icon svg {
  width: 24px;
  height: 24px;
}

/* Floating WhatsApp Button */
.whatsapp-button {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(0, 166, 81, 0.35);
  z-index: var(--z-40);
  transition: transform var(--transition), box-shadow var(--transition);
}

.whatsapp-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(0, 166, 81, 0.4);
}

.whatsapp-button:focus {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.whatsapp-button__icon {
  font-size: 1.5rem;
  line-height: 1;
}

.whatsapp-button__label {
  display: none;
}

@media (max-width: 640px) {
  .whatsapp-button {
    bottom: var(--space-10);
    right: var(--space-4);
  }
}

body.mobile-nav-open .whatsapp-button,
body.modal-open .whatsapp-button {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-button,
  .whatsapp-button:hover {
    transition: none;
    transform: none;
  }
}

/* Button Groups */
.btn-group {
  display: flex;
  gap: var(--space-2);
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
}

.btn-group .btn:last-child {
  border-top-right-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.btn-group .btn:not(:first-child):not(:last-child) {
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

/* Loading State */
.btn-loading {
  position: relative;
  color: transparent;
}

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

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

/* Responsive Button Groups */
@media (max-width: 640px) {
  .btn-group {
    flex-direction: column;
  }
  
  .btn-group .btn {
    border-radius: var(--radius-lg);
  }
  
  .btn-group .btn:not(:first-child):not(:last-child) {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
  }
}
