/* css/quiz-transitions.css */
/* Quiz hat selection and transition animations for Witty Lids */

/* ===================================== */
/* HAT OPTION BASE STYLING & HOVER */
/* ===================================== */

.hat-option {
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
  }
  
  /* Standardized hover highlight: use site-wide dark ink */
  .hat-option:hover {
    border-color: var(--ink);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  }
  
  /* ===================================== */
  /* SELECTION ANIMATION STATES */
  /* ===================================== */
  
  /* Selected hat: enlarge, glow, and add checkmark (ink color) */
  .hat-option.selected {
    transform: scale(1.08) translateY(-4px);
    border-color: var(--ink);
    box-shadow: 0 0 25px rgba(0, 27, 46, 0.25);
    z-index: 10;
    background: #f8f9fb; /* Subtle neutral tint aligned with ink */
  }
  
  /* Non-selected hats: fade out and shrink slightly */
  .hat-option.fading {
    opacity: 0.3;
    transform: scale(0.95);
    filter: grayscale(50%);
  }
  
  /* ===================================== */
  /* CHECKMARK OVERLAY FOR SELECTED HAT */
  /* ===================================== */
  
  /* Selected checkmark badge uses ink for consistency */
  .hat-option.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--ink);
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    animation: checkmarkPop 0.4s ease-out;
    box-shadow: 0 2px 8px rgba(0, 27, 46, 0.25);
  }
  
  @keyframes checkmarkPop {
    0% {
      transform: scale(0) rotate(0deg);
      opacity: 0;
    }
    50% {
      transform: scale(1.3) rotate(180deg);
    }
    100% {
      transform: scale(1) rotate(360deg);
      opacity: 1;
    }
  }
  
  /* ===================================== */
  /* CONTAINER TRANSITION ANIMATIONS */
  /* ===================================== */
  
  /* Slide transition (primary option) */
  .hat-options-container.transitioning-out {
    animation: slideOutDown 0.7s ease-in-out forwards;
  }
  
  .hat-options-container.transitioning-in {
    animation: slideInUp 0.7s ease-in-out forwards;
  }
  
  @keyframes slideOutDown {
    0% {
      transform: translateY(0);
      opacity: 1;
    }
    100% {
      transform: translateY(40px);
      opacity: 0;
    }
  }
  
  @keyframes slideInUp {
    0% {
      transform: translateY(40px);
      opacity: 0;
    }
    100% {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  /* ===================================== */
  /* ALTERNATIVE FADE TRANSITION */
  /* ===================================== */
  
  .hat-options-container.fade-out {
    animation: fadeOut 0.5s ease-in-out forwards;
  }
  
  .hat-options-container.fade-in {
    animation: fadeIn 0.5s ease-in-out forwards;
  }
  
  @keyframes fadeOut {
    to { 
      opacity: 0; 
      transform: scale(0.98);
    }
  }
  
  @keyframes fadeIn {
    from { 
      opacity: 0; 
      transform: scale(0.98);
    }
    to { 
      opacity: 1; 
      transform: scale(1);
    }
  }
  
  /* ===================================== */
  /* MOBILE RESPONSIVENESS */
  /* ===================================== */
  
  @media (max-width: 768px) {
    /* Reduce scaling effects on mobile for better performance */
    .hat-option.selected {
      transform: scale(1.05) translateY(-2px);
    }
    
    .hat-option.selected::after {
      width: 22px;
      height: 22px;
      font-size: 14px;
    }
    
    /* Smaller transition distances on mobile */
    @keyframes slideOutDown {
      100% {
        transform: translateY(20px);
        opacity: 0;
      }
    }
    
    @keyframes slideInUp {
      0% {
        transform: translateY(20px);
        opacity: 0;
      }
    }
  }
  
  /* ===================================== */
  /* LOADING STATE COMPATIBILITY */
  /* ===================================== */
  
  /* Ensure transitions don't interfere with loading states */
  .hat-options-container[data-loading="true"] .hat-option {
    pointer-events: none;
  }
  
  .hat-options-container[data-loading="true"] .hat-option.selected,
  .hat-options-container[data-loading="true"] .hat-option.fading {
    /* Maintain selection state during transitions */
    transition: none;
  }