﻿/* Component: Buttons - Unified Modern Premium Design
   All buttons share the same base styling with consistent spacing, shadows, and interactions.
   Variants only differ in color scheme, not in structure or behavior. */

:root {
  /* Button tokens - unified for all variants */
  --btn-radius: 0.75rem;
  --btn-padding-y: 0.75rem;
  --btn-padding-x: 1.5rem;
  --btn-font-size: 0.95rem;
  --btn-font-weight: 600;
  --btn-line-height: 1.5;
  --btn-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  /* Primary gradient colors - softer */
  --btn-primary-from: #818cf8;
  --btn-primary-to: #a78bfa;
  --btn-primary-hover-from: #6366f1;
  --btn-primary-hover-to: #8b5cf6;
  /* Unified shadow system - dezenter */
  --btn-shadow-rest: 0 2px 8px rgba(129, 140, 248, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
  --btn-shadow-hover: 0 8px 24px rgba(129, 140, 248, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
  --btn-shadow-active: 0 1px 3px rgba(129, 140, 248, 0.1), 0 0 0 0 rgba(0, 0, 0, 0);
}

:root[data-theme='light'] {
  --btn-primary-from: #2563eb;
  --btn-primary-to: #0ea5e9;
  --btn-primary-hover-from: #1d4ed8;
  --btn-primary-hover-to: #0284c7;
  --btn-shadow-rest: 0 10px 24px rgba(37, 99, 235, 0.16), 0 3px 8px rgba(15, 23, 42, 0.06);
  --btn-shadow-hover: 0 18px 34px rgba(37, 99, 235, 0.22), 0 6px 14px rgba(15, 23, 42, 0.08);
  --btn-shadow-active: 0 6px 14px rgba(37, 99, 235, 0.14), 0 0 0 0 rgba(0, 0, 0, 0);
}

/* Base button - unified design for all variants */
.btn, a.btn {
  /* Layout & Spacing */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: var(--btn-padding-y) var(--btn-padding-x);
  /* Typography */
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  line-height: var(--btn-line-height);
  text-decoration: none;
  white-space: nowrap;
  /* Visual */
  border-radius: var(--btn-radius);
  border: none;
  background: transparent;
  color: inherit;
  /* Interaction */
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  transition: var(--btn-transition);
  /* Positioning */
  position: relative;
  overflow: hidden;
  /* Initial state */
  box-shadow: var(--btn-shadow-rest);
  transform: translateY(0) scale(1);
}

/* Unified hover state - applies to all buttons */
.btn:hover:not(:disabled):not([aria-disabled="true"]) {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--btn-shadow-hover);
}

/* Unified active state */
.btn:active:not(:disabled):not([aria-disabled="true"]) {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--btn-shadow-active);
}

/* Unified focus state */
.btn:focus {
  outline: none;
  box-shadow: var(--btn-shadow-hover), 0 0 0 3px rgba(129, 140, 248, 0.15);
}

/* Vibrant CTA - Extra prominent */
.btn-vibrant {
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: white !important;
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
  animation: pulse-light 3s infinite;
}

.btn-vibrant:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 15px 35px rgba(99, 102, 241, 0.5);
  animation: none;
}

:root[data-theme='light'] .btn-vibrant {
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.24), 0 6px 16px rgba(14, 165, 233, 0.12);
}

:root[data-theme='light'] .btn-vibrant:hover,
:root[data-theme='light'] .btn-vibrant:focus {
  background: linear-gradient(135deg, #1d4ed8 0%, #0284c7 100%);
  color: #ffffff !important;
  box-shadow: 0 20px 40px rgba(37, 99, 235, 0.3), 0 8px 18px rgba(14, 165, 233, 0.16);
}

@keyframes pulse-light {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.6); }
  70% { box-shadow: 0 0 0 15px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* === SIZE VARIANTS === */
/* Unified sizing - maintains proportions across all variants */

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: calc(var(--btn-radius) - 0.125rem);
}

/* === STATES === */

/* Disabled / aria-disabled - unified across all variants */
.btn:disabled,
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  pointer-events: none;
}

.btn:disabled::before,
.btn[disabled]::before,
.btn[aria-disabled="true"]::before {
  display: none;
}

/* === ACCESSIBILITY === */

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn {
    border: 2px solid currentColor;
  }
}
