/***************************************************************************************************************
* MMRISK PREMIUM BUTTON COMPONENTS
* Tesla/Apple-inspired button styles with micro-interactions
* 
* This file contains comprehensive button styles that follow the design system guidelines
* with consistent use of spacing, colors, and transitions for a premium feel.
***************************************************************************************************************/

/*==============================================
* BASE BUTTON STYLES
* Foundation for all button variants
===============================================*/

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  z-index: 1;
  white-space: nowrap;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.25);
}

/* Button with icon styles */
.btn i, .btn svg {
  margin-left: var(--space-2);
  font-size: 1.1em;
  transition: transform 0.3s ease;
}

.btn.icon-left i, .btn.icon-left svg {
  margin-left: 0;
  margin-right: var(--space-2);
}

.btn:hover i, .btn:hover svg {
  transform: translateX(3px);
}

.btn.icon-left:hover i, .btn.icon-left:hover svg {
  transform: translateX(-3px);
}

/*==============================================
* PREMIUM BUTTON VARIANTS
* Tesla/Apple-inspired button designs
===============================================*/

/* Primary Button - Bold and vibrant - only for main CTAs */
.btn-primary {
  color: var(--color-text-white);
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  box-shadow: 0 6px 16px rgba(var(--color-primary-rgb), 0.25);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(var(--color-primary-rgb), 0.2);
}

/* Secondary Button - Main interactive elements */
.btn-secondary {
  color: var(--color-text-dark);
  background-color: var(--color-text-white);
  border-color: var(--color-gray-200);
}

.btn-secondary:hover, .btn-secondary:focus {
  background-color: #f5f5f5;
  border-color: var(--color-gray-300);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}



/* Dark Button - High contrast */
.btn-dark {
  color: var(--color-text-white);
  background-color: var(--color-text-dark);
  border-color: var(--color-text-dark);
}

.btn-dark:hover, .btn-dark:focus {
  background-color: #000;
  border-color: #000;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.btn-dark:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Light Button - For dark backgrounds */
.btn-light {
  color: var(--color-text-dark);
  background-color: var(--color-text-white);
  border-color: transparent;
}

.btn-light:hover, .btn-light:focus {
  background-color: #f5f5f5;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.btn-light:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Text Button - No background */
.btn-text {
  color: var(--color-text);
  background-color: transparent;
  border-color: transparent;
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.btn-text:hover, .btn-text:focus {
  color: var(--color-text-dark);
  background-color: rgba(0, 0, 0, 0.03);
  transform: translateY(-2px);
}

.btn-text:active {
  transform: translateY(0);
}

/* Ghost Button - Subtle hover effect */
.btn-ghost {
  color: var(--color-text);
  background-color: transparent;
  border-color: transparent;
}

.btn-ghost:hover, .btn-ghost:focus {
  color: var(--color-text-dark);
  background-color: rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.btn-ghost:active {
  transform: translateY(0);
}



/*==============================================
* BUTTON SIZES
* Consistent sizing based on design system
===============================================*/

.btn-xs {
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
}

.btn-sm {
  padding: calc(var(--space-1) + 1px) var(--space-3);
  font-size: calc(var(--font-size-xs) + 1px);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-base);
  border-radius: var(--radius-md);
}

.btn-xl {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-lg);
  font-weight: var(--font-weight-semibold);
}

/*==============================================
* BUTTON STATES
* Various interactive states
===============================================*/

/* Disabled state */
.btn:disabled, .btn.disabled {
  opacity: 0.65;
  pointer-events: none;
  box-shadow: none !important;
  transform: none !important;
}

/* Loading state */
.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: calc(50% - 8px);
  left: calc(50% - 8px);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: currentColor;
  animation: button-loading-spinner 0.6s linear infinite;
}

@keyframes button-loading-spinner {
  from {
    transform: rotate(0turn);
  }
  to {
    transform: rotate(1turn);
  }
}

/*==============================================
* BUTTON GROUPS
* For related buttons
===============================================*/

.btn-group {
  display: inline-flex;
  position: relative;
}

.btn-group .btn {
  position: relative;
  flex: 1 1 auto;
  border-radius: 0;
}

.btn-group .btn:hover {
  z-index: 1;
}

.btn-group .btn:focus {
  z-index: 3;
}

.btn-group .btn:active {
  z-index: 2;
}

.btn-group .btn:not(:first-child) {
  margin-left: -1px;
}

.btn-group .btn:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.btn-group .btn:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

/*==============================================
* RESPONSIVE BUTTONS
* Adaptations for different screen sizes
===============================================*/

@media (max-width: 768px) {
  .btn-responsive {
    display: block;
    width: 100%;
  }
  
  .btn-group.responsive {
    display: flex;
    flex-direction: column;
  }
  
  .btn-group.responsive .btn {
    margin-left: 0;
    margin-top: -1px;
    border-radius: 0;
  }
  
  .btn-group.responsive .btn:first-child {
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
  
  .btn-group.responsive .btn:last-child {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
  }
}
