/* Custom styles for 20-20-20 Eye Rule Website */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Animation classes */
.fade-in {
  animation: fadeIn 0.6s ease-out;
}

.pulse-animation {
  animation: pulse 2s infinite;
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

/* Timer display enhancements */
#timer-display {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

#timer-display.warning {
  color: #f59e0b;
  animation: pulse 1s infinite;
}

#timer-display.danger {
  color: #ef4444;
  animation: pulse 0.5s infinite;
}

/* Button hover effects */
.btn-hover-effect {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-hover-effect::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.btn-hover-effect:hover::before {
  left: 100%;
}

/* Modal animations */
.modal-enter {
  animation: fadeIn 0.3s ease-out;
}

.modal-content-enter {
  animation: fadeIn 0.3s ease-out 0.1s both;
}

/* Sticky footer show/hide */
.sticky-footer-show {
  transform: translateY(0) !important;
}

/* Progress bar for timer */
.progress-ring {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.progress-ring-circle {
  stroke-dasharray: 251.2;
  stroke-dashoffset: 251.2;
  transition: stroke-dashoffset 1s linear;
  stroke: #3b82f6;
  stroke-width: 4;
  fill: transparent;
}

/* Responsive design improvements */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem !important;
  }

  .hero-subtitle {
    font-size: 1.125rem !important;
  }

  #timer-display {
    font-size: 3rem !important;
  }

  .modal-content {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
  }
}

/* Loading states */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

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

/* Success states */
.success-message {
  color: #10b981;
  background: #d1fae5;
  border: 1px solid #a7f3d0;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

.error-message {
  color: #ef4444;
  background: #fee2e2;
  border: 1px solid #fecaca;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Focus states for accessibility */
button:focus,
input:focus,
a:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .sticky-footer,
  #timer-alert-modal,
  #exit-intent-modal,
  header {
    display: none !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .bg-gradient-to-br,
  .bg-gradient-to-r {
    background: #1e40af !important;
  }

  .text-yellow-300,
  .text-yellow-400,
  .bg-yellow-400 {
    background: #facc15 !important;
    color: #000000 !important;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
