/* FitCoin MVP - Component Styles */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transform: translateZ(0); /* Enable hardware acceleration */
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn:not(:disabled):hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:not(:disabled):active {
  transform: translateY(0) scale(0.98);
  transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Button ripple effect */
.btn::before {
  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.3s ease-out, height 0.3s ease-out;
  pointer-events: none;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

/* Button variants */
.btn-primary {
  background: var(--gradient-primary);
  color: var(--color-white);
  box-shadow: var(--shadow-md);
}

.btn-primary:not(:disabled):hover {
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--gradient-secondary);
  color: var(--color-white);
  box-shadow: var(--shadow-md);
}

.btn-accent {
  background: var(--gradient-warm);
  color: var(--color-white);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: var(--color-white);
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.btn-outline:not(:disabled):hover {
  background: var(--color-primary);
  color: var(--color-white);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  box-shadow: none;
}

.btn-ghost:not(:disabled):hover {
  background: var(--color-surface-alt);
  color: var(--color-text-primary);
}

/* Button sizes */
.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: var(--space-lg) var(--space-xl);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-lg);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  padding: var(--space-md);
  border-radius: var(--radius-full);
}

/* Cards */
.card {
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-lg);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(0); /* Hardware acceleration */
  will-change: transform, box-shadow; /* Optimize for animations */
}

.card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px) scale(1.01);
  border-color: var(--color-border-subtle);
}

/* Card entrance animation */
.card {
  animation: cardFadeIn 0.6s ease-out;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0;
}

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin: 0;
}

.card-body {
  margin-bottom: var(--space-md);
}

.card-footer {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
}

/* Card variants */
.card-interactive {
  cursor: pointer;
}

.card-gradient {
  background: var(--gradient-primary);
  color: var(--color-white);
}

.card-gradient .card-title,
.card-gradient .card-subtitle {
  color: var(--color-white);
}

/* Progress Components */
.progress-circle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.progress-circle svg {
  transform: rotate(-90deg);
}

.progress-circle-text {
  position: absolute;
  text-align: center;
  font-weight: var(--font-weight-bold);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  transform: translateZ(0); /* Hardware acceleration */
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progress-bar-lg {
  height: 12px;
}

.progress-bar-sm {
  height: 6px;
}

/* Input Components */
.input-group {
  margin-bottom: var(--space-md);
}

.input-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
}

.input {
  width: 100%;
  padding: var(--space-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background: var(--color-white);
  transition: var(--transition-base);
}

.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(6, 150, 175, 0.1);
}

.input::placeholder {
  color: var(--color-text-tertiary);
}

/* Range Slider */
.range-slider {
  width: 100%;
  margin: var(--space-md) 0;
}

.range-input {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-border-light);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.range-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-md);
}

.range-value {
  display: flex;
  justify-content: center;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  margin-top: var(--space-sm);
}

/* Icons */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 24px;
}

.icon-sm {
  width: 16px;
  height: 16px;
  font-size: 16px;
}

.icon-lg {
  width: 32px;
  height: 32px;
  font-size: 32px;
}

.icon-xl {
  width: 48px;
  height: 48px;
  font-size: 48px;
}

/* Avatar */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: var(--color-white);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: var(--font-size-sm);
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: var(--font-size-xl);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.badge-secondary {
  background: var(--color-secondary);
  color: var(--color-white);
}

.badge-accent {
  background: var(--color-accent);
  color: var(--color-white);
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

/* Alert/Notification */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.alert-success {
  background: rgba(78, 205, 196, 0.1);
  color: var(--color-success);
  border-left: 4px solid var(--color-success);
}

.alert-warning {
  background: rgba(255, 217, 61, 0.1);
  color: var(--color-warning);
  border-left: 4px solid var(--color-warning);
}

.alert-error {
  background: rgba(255, 107, 107, 0.1);
  color: var(--color-error);
  border-left: 4px solid var(--color-error);
}

/* Dark theme specific alert adjustments */
[data-theme="dark"] .alert-success {
  background: rgba(78, 205, 196, 0.2);
}

[data-theme="dark"] .alert-warning {
  background: rgba(255, 217, 61, 0.2);
}

[data-theme="dark"] .alert-error {
  background: rgba(255, 107, 107, 0.2);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.9) translateY(20px);
  transition: var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* Loading Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border-light);
  border-top: 2px solid var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
  transform: translateZ(0); /* Hardware acceleration */
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spinner-lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

/* Skeleton Loading Animation */
.skeleton {
  background: linear-gradient(90deg, var(--color-border-light) 25%, var(--color-border) 50%, var(--color-border-light) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-xs);
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-text.long {
  width: 100%;
}

/* Loading state for buttons */
.btn.loading {
  position: relative;
  color: transparent;
  cursor: not-allowed;
  pointer-events: none;
}

.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: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Coin Animation */
.coin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--gradient-warm);
  color: var(--color-white);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow-md);
  position: relative;
}

.coin::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, transparent 50%);
}

.coin-earned {
  animation: coinBounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes coinBounce {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  50% {
    transform: scale(1.3) rotate(180deg);
  }
  75% {
    transform: scale(0.9) rotate(270deg);
  }
  100% {
    transform: scale(1) rotate(360deg);
    opacity: 1;
  }
}

/* Success checkmark animation */
@keyframes checkmark {
  0% {
    height: 0;
    width: 0;
    opacity: 1;
  }
  20% {
    height: 0;
    width: 7px;
  }
  40% {
    height: 14px;
    width: 7px;
  }
  100% {
    height: 14px;
    width: 7px;
    opacity: 1;
  }
}

.success-checkmark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: block;
  stroke-width: 2;
  stroke: var(--color-success);
  stroke-miterlimit: 10;
  box-shadow: inset 0px 0px 0px var(--color-success);
  animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
  position: relative;
}

.success-checkmark::after {
  content: '';
  width: 5px;
  height: 10px;
  position: absolute;
  left: 8px;
  top: 5px;
  border: solid var(--color-success);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  animation: checkmark 0.2s ease-in-out 0.7s forwards;
}

@keyframes fill {
  100% {
    box-shadow: inset 0px 0px 0px 20px var(--color-success);
  }
}

@keyframes scale {
  0%, 100% {
    transform: none;
  }
  50% {
    transform: scale3d(1.1, 1.1, 1);
  }
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: calc(var(--space-2xl) + 60px); /* Account for bottom nav */
  right: var(--space-lg);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: var(--color-white);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xl);
  transition: var(--transition-base);
  z-index: var(--z-fixed);
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

/* Ripple Effect */
.ripple {
  position: relative;
  overflow: hidden;
}

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

.ripple:active::before {
  width: 300px;
  height: 300px;
}

/* Validation Error Styles */
.validation-error {
  display: none;
  color: var(--color-error);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  margin-top: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  animation: errorFadeIn 0.3s ease-out;
}

@keyframes errorFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dark theme adjustments for validation errors */
[data-theme="dark"] .validation-error {
  background-color: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Input validation states */
.input-group.has-error input,
.input-group.has-error .slider {
  border-color: var(--color-error);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.input-group.has-success input,
.input-group.has-success .slider {
  border-color: var(--color-success);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.2);
}

/* User Testing & Feedback Widget */
.feedback-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: var(--z-overlay);
}

.feedback-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  transform: translateZ(0);
}

.feedback-trigger:hover {
  transform: scale(1.05) translateZ(0);
  box-shadow: var(--shadow-xl);
}

.feedback-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-lg);
}

.feedback-modal-content {
  background: var(--color-background);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2xl);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.feedback-header h3 {
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.feedback-close {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: var(--font-size-lg);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: color 0.2s ease;
}

.feedback-close:hover {
  color: var(--color-text-primary);
}

.feedback-body {
  padding: var(--space-lg);
}

.feedback-rating {
  margin-bottom: var(--space-lg);
}

.feedback-rating label {
  display: block;
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-sm);
}

.rating-stars {
  display: flex;
  gap: var(--space-xs);
}

.rating-stars .star {
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  font-size: var(--font-size-xl);
  cursor: pointer;
  transition: color 0.2s ease;
  padding: var(--space-xs);
}

.rating-stars .star:hover,
.rating-stars .star.active {
  color: #f59e0b;
}

.feedback-text {
  margin-bottom: var(--space-lg);
}

.feedback-text label {
  display: block;
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-sm);
}

.feedback-text textarea {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background: var(--color-background);
  resize: vertical;
  transition: border-color 0.2s ease;
}

.feedback-text textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(6, 150, 175, 0.2);
}

.feedback-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .feedback-widget {
    bottom: 80px; /* Above bottom nav */
    right: 16px;
  }

  .feedback-trigger {
    padding: var(--space-sm);
    font-size: var(--font-size-xs);
  }

  .feedback-modal {
    padding: var(--space-md);
  }

  .feedback-actions {
    flex-direction: column;
  }
}

/* Enhanced Navigation Styles */
.nav-back-btn,
.nav-home-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0 var(--space-xs);
}

.nav-back-btn:hover,
.nav-home-btn:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.nav-back-btn:active,
.nav-home-btn:active {
  transform: translateY(0);
}

.nav-back-btn {
  margin-left: 0;
}

.nav-home-btn {
  margin-right: var(--space-sm);
}

/* Breadcrumbs */
.breadcrumbs {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-xs) var(--space-md);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  z-index: var(--z-sticky);
}

.breadcrumb-trail {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
}

.breadcrumb-trail i {
  font-size: 8px;
  margin: 0 var(--space-xs);
  opacity: 0.7;
}

/* Make header logo clickable */
.header-logo {
  transition: transform 0.2s ease;
}

.header-logo:hover {
  transform: scale(1.05);
}

/* Adjust header layout for navigation buttons */
.app-header {
  position: relative;
  padding-bottom: var(--space-md);
}

/* Dark theme adjustments */
[data-theme="dark"] .nav-back-btn,
[data-theme="dark"] .nav-home-btn {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme="dark"] .breadcrumbs {
  background: var(--color-surface);
  border-color: var(--color-border);
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .nav-back-btn,
  .nav-home-btn {
    width: 32px;
    height: 32px;
    margin: 0 var(--space-xs);
  }

  .breadcrumbs {
    bottom: -24px;
    padding: var(--space-xs) var(--space-sm);
  }

  .breadcrumb-trail {
    font-size: 10px;
  }

  .app-header {
    padding-bottom: var(--space-sm);
  }
}

/* Focus states for accessibility */
.nav-back-btn:focus,
.nav-home-btn:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Animation for button appearance */
@keyframes navButtonSlideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.nav-back-btn,
.nav-home-btn {
  animation: navButtonSlideIn 0.3s ease-out;
}

/* Badge System Styles */
.badge-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: calc(var(--z-modal) + 1);
  animation: badgeModalFadeIn 0.5s ease-out;
}

@keyframes badgeModalFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(4px);
  }
}

.badge-modal-content {
  background: var(--color-background);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-2xl);
  animation: badgeSlideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

@keyframes badgeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.badge-celebration {
  margin-bottom: var(--space-xl);
}

.badge-icon {
  font-size: 4rem;
  margin-bottom: var(--space-md);
  display: block;
  animation: badgeIconBounce 1s ease-out;
  position: relative;
}

@keyframes badgeIconBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0) scale(1);
  }
  40% {
    transform: translateY(-20px) scale(1.1);
  }
  60% {
    transform: translateY(-10px) scale(1.05);
  }
}

/* Badge rarity styles */
.badge-icon.common {
  filter: drop-shadow(0 0 8px rgba(156, 163, 175, 0.5));
}

.badge-icon.uncommon {
  filter: drop-shadow(0 0 12px rgba(34, 197, 94, 0.6));
}

.badge-icon.rare {
  filter: drop-shadow(0 0 16px rgba(59, 130, 246, 0.7));
}

.badge-icon.legendary {
  filter: drop-shadow(0 0 20px rgba(147, 51, 234, 0.8));
  animation: badgeIconBounce 1s ease-out, badgeGlow 2s ease-in-out infinite;
}

@keyframes badgeGlow {
  0%, 100% {
    filter: drop-shadow(0 0 20px rgba(147, 51, 234, 0.8));
  }
  50% {
    filter: drop-shadow(0 0 30px rgba(147, 51, 234, 1));
  }
}

.badge-celebration h2 {
  color: var(--color-primary);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--space-sm) 0;
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

.badge-celebration h3 {
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin: 0 0 var(--space-sm) 0;
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.badge-celebration p {
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  margin: 0 0 var(--space-md) 0;
  animation: fadeInUp 0.8s ease-out 0.5s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.badge-reward {
  background: linear-gradient(135deg, var(--color-secondary), var(--color-primary));
  color: white;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-base);
  display: inline-block;
  margin-bottom: var(--space-lg);
  animation: fadeInUp 0.8s ease-out 0.6s both, coinShine 2s ease-in-out infinite;
}

@keyframes coinShine {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(6, 150, 175, 0.3);
  }
  50% {
    box-shadow: 0 4px 25px rgba(6, 150, 175, 0.5);
  }
}

/* Badge modal background effects */
.badge-modal-content::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(6, 150, 175, 0.1) 0%, transparent 70%);
  animation: rotateBackground 10s linear infinite;
  pointer-events: none;
}

@keyframes rotateBackground {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Badge grid for achievements screen */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-md);
  padding: var(--space-lg);
}

.badge-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.badge-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}

.badge-card.earned {
  border-color: var(--color-success);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(6, 150, 175, 0.1));
}

.badge-card.locked {
  opacity: 0.6;
}

.badge-card-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  display: block;
}

.badge-card.locked .badge-card-icon {
  filter: grayscale(100%);
}

.badge-card h4 {
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  margin: 0 0 var(--space-xs) 0;
}

.badge-card p {
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  margin: 0;
  line-height: 1.3;
}

.badge-progress {
  margin-top: var(--space-sm);
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.badge-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-full);
  transition: width 0.5s ease-out;
}

/* Dark theme adjustments */
[data-theme="dark"] .badge-modal-content {
  border: 1px solid var(--color-border);
}

[data-theme="dark"] .badge-card {
  background: var(--color-background);
}

[data-theme="dark"] .badge-card.earned {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(6, 150, 175, 0.15));
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .badge-modal-content {
    width: 95%;
    padding: var(--space-lg);
  }

  .badge-icon {
    font-size: 3rem;
  }

  .badges-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-sm);
    padding: var(--space-md);
  }

  .badge-card {
    padding: var(--space-sm);
  }

  .badge-card-icon {
    font-size: 1.5rem;
  }
}