/*
 * Button Enhancement System
 * Smooth animations and micro-interactions
 */

/* Core Button Styles */

.btn-simple {
  /* Reset conflicting styles */
  will-change: transform, box-shadow, background;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  transform: translateZ(0) translateY(0);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 32px;
  min-height: 48px;
  
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  
  border-radius: 10px;
  border-width: 2px;
  border-style: solid;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* Primary Button */

.btn-simple.btn-primary {
  color: #00ff88 !important;
  border-color: rgba(0, 255, 136, 0.4);
  background: linear-gradient(
    135deg,
    rgba(0, 255, 136, 0.03) 0%,
    rgba(0, 255, 136, 0.01) 100%
  ) !important;
  box-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.2),
    inset 0 0 20px rgba(0, 255, 136, 0.02);
}

.btn-simple.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 0%,
    transparent 40%,
    rgba(0, 255, 136, 0.15) 50%,
    transparent 60%,
    transparent 100%
  );
  transform: translateX(-100%) skewX(-15deg);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: -1;
}

.btn-simple.btn-primary::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  background: linear-gradient(135deg, #00ff88, #00d9ff);
  opacity: 0;
  z-index: -2;
  transition: opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: blur(12px);
}

.btn-simple.btn-primary:hover {
  color: #ffffff !important;
  border-color: rgba(0, 255, 136, 0.8);
  background: linear-gradient(
    135deg,
    rgba(0, 255, 136, 0.12) 0%,
    rgba(0, 217, 255, 0.08) 100%
  ) !important;
  transform: translateY(-3px) translateZ(0) scale(1.02);
  box-shadow: 
    0 8px 24px rgba(0, 255, 136, 0.35),
    0 4px 12px rgba(0, 255, 136, 0.25),
    inset 0 0 30px rgba(0, 255, 136, 0.08);
}

.btn-simple.btn-primary:hover::before {
  transform: translateX(100%) skewX(-15deg);
}

.btn-simple.btn-primary:hover::after {
  opacity: 0.6;
}

.btn-simple.btn-primary:active {
  transform: translateY(-1px) translateZ(0) scale(0.98);
  transition-duration: 0.1s;
  box-shadow: 
    0 4px 12px rgba(0, 255, 136, 0.25),
    0 2px 6px rgba(0, 255, 136, 0.15),
    inset 0 0 20px rgba(0, 255, 136, 0.12);
}

.btn-simple.btn-primary:focus-visible {
  outline: 3px solid rgba(0, 255, 136, 0.5);
  outline-offset: 4px;
}

/* Info Button */

.btn-simple.btn-info {
  color: #1d8cf8 !important;
  border-color: rgba(29, 140, 248, 0.4);
  background: linear-gradient(
    135deg,
    rgba(29, 140, 248, 0.03) 0%,
    rgba(29, 140, 248, 0.01) 100%
  ) !important;
  box-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.2),
    inset 0 0 20px rgba(29, 140, 248, 0.02);
}

/* Shimmer effect overlay */
.btn-simple.btn-info::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 0%,
    transparent 40%,
    rgba(29, 140, 248, 0.15) 50%,
    transparent 60%,
    transparent 100%
  );
  transform: translateX(-100%) skewX(-15deg);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: -1;
}

/* Glow layer */
.btn-simple.btn-info::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1d8cf8, #00d9ff);
  opacity: 0;
  z-index: -2;
  transition: opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: blur(12px);
}

.btn-simple.btn-info:hover {
  color: #ffffff !important;
  border-color: rgba(29, 140, 248, 0.8);
  background: linear-gradient(
    135deg,
    rgba(29, 140, 248, 0.12) 0%,
    rgba(0, 217, 255, 0.08) 100%
  ) !important;
  transform: translateY(-3px) translateZ(0) scale(1.02);
  box-shadow: 
    0 8px 24px rgba(29, 140, 248, 0.35),
    0 4px 12px rgba(29, 140, 248, 0.25),
    inset 0 0 30px rgba(29, 140, 248, 0.08);
}

.btn-simple.btn-info:hover::before {
  transform: translateX(100%) skewX(-15deg);
}

.btn-simple.btn-info:hover::after {
  opacity: 0.6;
}

.btn-simple.btn-info:active {
  transform: translateY(-1px) translateZ(0) scale(0.98);
  transition-duration: 0.1s;
  box-shadow: 
    0 4px 12px rgba(29, 140, 248, 0.25),
    0 2px 6px rgba(29, 140, 248, 0.15),
    inset 0 0 20px rgba(29, 140, 248, 0.12);
}

/* Focus state for accessibility */
.btn-simple.btn-info:focus-visible {
  outline: 3px solid rgba(29, 140, 248, 0.5);
  outline-offset: 4px;
}

/* Icon & Image Handling */

.btn-simple img {
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: brightness(1) drop-shadow(0 0 0 transparent);
}

.btn-simple:hover img {
  transform: scale(1.1) translateY(-1px);
  filter: brightness(1.2) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.btn-simple i,
.btn-simple .tim-icons {
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-simple:hover i,
.btn-simple:hover .tim-icons {
  transform: scale(1.1) translateY(-1px);
}

/* Loading State */

.btn-simple.loading {
  pointer-events: none;
  position: relative;
  color: transparent !important;
}

.btn-simple.loading::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: button-spin 0.8s linear infinite;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
}

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

/* Disabled State */

.btn-simple:disabled,
.btn-simple.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

/* Button Groups */

.btn-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.btn-wrapper .btn-simple {
  flex: 0 1 auto;
}

.btn-wrapper:hover .btn-simple:not(:hover) {
  opacity: 0.7;
  transform: scale(0.98) translateZ(0);
}

/* Mobile Optimizations */

@media (max-width: 768px) {
  .btn-simple {
    padding: 12px 24px;
    font-size: 0.8125rem;
    min-height: 44px;
  }
  
  .btn-simple {
    transition: all 0.25s ease-out;
  }
  
  .btn-simple:hover {
    transform: translateY(-2px) translateZ(0) scale(1.01);
  }
  
  .btn-wrapper {
    gap: 12px;
  }
}

@media (max-width: 576px) {
  .btn-simple {
    padding: 10px 20px;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
  }
  
  .btn-wrapper {
    flex-direction: column;
    width: 100%;
  }
  
  .btn-wrapper .btn-simple {
    width: 100%;
    max-width: 320px;
  }
}

/* Reduced Motion */

@media (prefers-reduced-motion: reduce) {
  .btn-simple,
  .btn-simple::before,
  .btn-simple::after,
  .btn-simple img,
  .btn-simple i,
  .btn-simple .tim-icons {
    transition: none;
    animation: none;
  }
  
  .btn-simple:hover {
    transform: none;
  }
}

/* High Contrast Mode */

@media (prefers-contrast: high) {
  .btn-simple {
    border-width: 3px;
  }
  
  .btn-simple.btn-primary {
    border-color: #00ff88;
  }
  
  .btn-simple.btn-info {
    border-color: #1d8cf8;
  }
}

/* Dark Mode Refinements */

@media (prefers-color-scheme: dark) {
  .btn-simple::after {
    filter: blur(16px);
  }
}

/* Interaction Feedback */

/* Subtle pulse on focus for keyboard navigation */
@keyframes button-focus-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 currentColor;
  }
  50% {
    box-shadow: 0 0 0 4px currentColor;
  }
}

.btn-simple:focus-visible {
  animation: button-focus-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.btn-simple {
  position: relative;
  overflow: hidden;
}

.btn-simple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-simple:active::after {
  width: 300px;
  height: 300px;
  transition: width 0s, height 0s;
}

/* Touch Device Optimizations */

@media (hover: none) and (pointer: coarse) {
  /* Larger tap targets for mobile */
  .btn-simple {
    min-height: 48px;
    padding: 14px 28px;
  }
  
  .btn-simple:hover {
    transform: none;
    box-shadow: 
      0 1px 2px rgba(0, 0, 0, 0.2),
      inset 0 0 20px rgba(0, 255, 136, 0.02);
  }
  
  .btn-simple:active {
    transform: scale(0.96);
  }
}

/* Print Styles */

@media print {
  .btn-simple {
    border: 2px solid currentColor !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  
  .btn-simple::before,
  .btn-simple::after {
    display: none !important;
  }
}
