<template>
  <button 
    :class="[
      'base-button',
      variant,
      {
        'active': active,
        'disabled': disabled
      }
    ]"
    :disabled="disabled"
    @click="handleClick"
    v-bind="$attrs"
  >
    <slot />
  </button>
</template>

<script setup>
defineOptions({
  inheritAttrs: false
})

const props = defineProps({
  variant: {
    type: String,
    default: 'default',
    validator: (value) => ['default', 'icon', 'primary'].includes(value)
  },
  active: {
    type: Boolean,
    default: false
  },
  disabled: {
    type: Boolean,
    default: false
  }
})

const emit = defineEmits(['click'])

const handleClick = (event) => {
  if (!props.disabled) {
    emit('click', event)
  }
}
</script>

<style scoped>
.base-button {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  outline: none;
  position: relative;
  overflow: hidden;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

.base-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.base-button:hover::before {
  left: 100%;
}

.base-button:hover {
  background: var(--accent-primary);
  color: white;
  transform: translateY(-3px);
  box-shadow: 
    0 8px 20px rgba(59, 130, 246, 0.4),
    0 4px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.base-button:active {
  transform: translateY(1px);
  box-shadow: 
    0 2px 6px rgba(0, 0, 0, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.base-button.default {
  border-radius: 12px;
  padding: 12px 20px;
}

.base-button.icon {
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.base-button.icon:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 
    0 8px 20px rgba(59, 130, 246, 0.4),
    0 4px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.base-button.primary {
  border-radius: 12px;
  padding: 12px 20px;
  background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: 
    0 6px 16px rgba(59, 130, 246, 0.3),
    0 3px 6px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.base-button.primary:hover {
  background: linear-gradient(45deg, var(--accent-secondary), var(--accent-primary));
  transform: translateY(-3px) scale(1.02);
  box-shadow: 
    0 8px 24px rgba(59, 130, 246, 0.4),
    0 4px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

.base-button.active {
  background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary)) !important;
  color: white !important;
  box-shadow: 
    0 6px 18px rgba(59, 130, 246, 0.5),
    0 3px 6px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1) !important;
}

.base-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.base-button.disabled:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
  box-shadow: 
    0 2px 6px rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.02);
}

/* Animation enhancement */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.base-button.active {
  animation: pulse 2s infinite;
}
</style>