/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

@import url("/assets/catppuccin-theme-49fa71ee.css");

/* Real-time Game Update Animations */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes pulse-slow {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.02);
  }
}

.pulse {
  animation: pulse 0.6s ease-in-out;
}

.status-updating {
  animation: pulse-slow 2s ease-in-out infinite;
}

.status-complete {
  background-color: rgba(166, 227, 161, 0.15) !important;
}

.status-complete span {
  color: var(--ctp-green) !important;
}

.status-error {
  background-color: rgba(243, 139, 168, 0.15) !important;
}

.status-error span {
  color: var(--ctp-red) !important;
}

/* Flash Message Animations */
@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(400px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-slide-in-right {
  animation: slide-in-right 0.3s ease-out forwards;
}

/* iOS PWA Viewport Fixes */
:root {
  /* Define safe area inset variables for iOS notch devices */
  --safe-area-inset-top: env(safe-area-inset-top);
  --safe-area-inset-right: env(safe-area-inset-right);
  --safe-area-inset-bottom: env(safe-area-inset-bottom);
  --safe-area-inset-left: env(safe-area-inset-left);
}

/* Game Results Page Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

.animate-slide-in-up {
  animation: slideInUp 0.4s ease-out forwards;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease-out forwards;
}

/* Game Card Hover Effects */
.game-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

/* Period Button Active State */
.period-button {
  transition: all 0.2s ease-out;
}

.period-button.active {
  background-color: var(--ctp-blue) !important;
  color: var(--ctp-base) !important;
  box-shadow: 0 2px 8px rgba(137, 180, 250, 0.3);
}

.period-button:not(.active):hover {
  background-color: rgba(137, 180, 250, 0.1);
  color: var(--ctp-text);
}

/* Period Content Transitions */
.period-content {
  transition: opacity 0.3s ease-out;
}

.period-content.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Stat Card Animations */
.card {
  animation: slideInUp 0.4s ease-out forwards;
  animation-delay: calc(var(--animation-order, 0) * 0.05s);
}

/* Stagger Animation for Grid Items */
.grid > * {
  animation: slideInUp 0.4s ease-out forwards;
  opacity: 0;
}

.grid > *:nth-child(1) { animation-delay: 0.05s; }
.grid > *:nth-child(2) { animation-delay: 0.1s; }
.grid > *:nth-child(3) { animation-delay: 0.15s; }
.grid > *:nth-child(4) { animation-delay: 0.2s; }
.grid > *:nth-child(5) { animation-delay: 0.25s; }
.grid > *:nth-child(6) { animation-delay: 0.3s; }
.grid > *:nth-child(7) { animation-delay: 0.35s; }
.grid > *:nth-child(8) { animation-delay: 0.4s; }
.grid > *:nth-child(9) { animation-delay: 0.45s; }

/* Smooth Transitions for Interactive Elements */
button, .btn, select, input {
  transition: all 0.2s ease-out;
}

button:active, .btn:active {
  transform: scale(0.98);
}

/* Focus Ring Enhancement */
select:focus, input:focus {
  outline: none;
  border-color: var(--ctp-blue);
  box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.2);
}

/* Badge Pulse Animation for Active Filters */
@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.badge.animate-fade-in {
  animation: fadeIn 0.3s ease-out, badgePulse 0.5s ease-out;
}

/* Fix viewport height for iOS PWA */
html {
  height: 100%;
  /* Fallback for browsers that don't support dvh */
  height: 100vh;
  /* Use dynamic viewport height which accounts for browser chrome */
  height: 100dvh;
}

body {
  min-height: 100%;
  /* Fallback */
  min-height: 100vh;
  /* Dynamic viewport height - adjusts when keyboard appears/disappears */
  min-height: 100dvh;
  /* Ensure width doesn't exceed viewport */
  max-width: 100vw;
  overflow-x: hidden;
  /* Add safe area padding for iOS notch devices */
  padding-top: var(--safe-area-inset-top);
  padding-right: var(--safe-area-inset-right);
  padding-bottom: var(--safe-area-inset-bottom);
  padding-left: var(--safe-area-inset-left);
}
