/* Tailwind imports */
@tailwind base;
@tailwind components;
@tailwind utilities;

html {
    scroll-behavior: smooth;
}

.hidden {
    display: none;
}

/* Checkmark animation for submission success */
.checkmark {
    width: 52px;
    height: 52px;
    stroke: #4CAF50;
    stroke-width: 2;
    stroke-linecap: round;
    animation: scaleUp 0.3s ease-in-out;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: drawCircle 0.6s ease-in-out forwards;
}

.checkmark-check {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: drawCheck 0.3s ease-in-out 0.6s forwards;
}

@keyframes scaleUp {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

@keyframes drawCircle {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes drawCheck {
    to {
        stroke-dashoffset: 0;
    }
}

/* Locked section styles */
.locked-section {
    position: relative;
    overflow: hidden;
    pointer-events: none;
}

.locked-section::after {
    content: "Coming Soon";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1.25rem;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.locked-section:hover::after {
    opacity: 1;
}

/* Accessibility and focus styles */
button:focus, input:focus, textarea:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Example video hover effect */
.example-video:hover img {
    transform: scale(1.05);
    transition: transform 0.3s ease-in-out;
}

.example-video {
    overflow: hidden;
}

/* Suggestion button styles */
.suggestion-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.suggestion-btn:hover {
    text-decoration: underline;
}

/* Animation for fade-in effect */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Spinner animation */
.spin {
    animation: spin 1s linear infinite;
}

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

/* Enhance widget and tooltip styles */
#enhance-widget {
    animation: fade-in 0.3s ease-out;
}

#enhance-backdrop {
    transition: opacity 0.3s ease-in-out;
}

#enhance-widget .relative {
    transform: translateY(0);
    animation: slide-up 0.3s ease-out;
}

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

#enhance-tooltip.show {
    display: block;
    animation: fade-out 1s ease-in-out forwards;
}

#enhance-tooltip {
    transition: opacity 0.2s ease-in-out;
}

@keyframes fade-out {
    0% { opacity: 1; }
    99% { opacity: 1; }
    100% { opacity: 0; display: none; }
}

/* Prompt input highlight */
#prompt.highlight {
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.3);
    transition: all 0.3s ease-in-out;
}

/* Sparkle button effect */
.sparkle-button {
    position: relative;
    overflow: hidden;
}

.sparkle-button::before,
.sparkle-button::after {
    content: '✨';
    position: absolute;
    color: #facc15;
    font-size: 0.75rem;
    opacity: 0;
    animation: sparkle 2s infinite;
}

.sparkle-button::before {
    top: -0.5rem;
    left: 0.5rem;
    animation-delay: 0.5s;
}

.sparkle-button::after {
    bottom: -0.5rem;
    right: 0.5rem;
    animation-delay: 1s;
}

@keyframes sparkle {
    0% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0); }
}

/* Enhanced prompt container styles */
#enhanced-prompt-container {
    position: relative;
    padding: 1rem;
    border: 2px solid #14b8a6;
    border-radius: 0.5rem;
    background: linear-gradient(to bottom, #f0fdfa, #ffffff);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    max-height: 6rem;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.5;
    color: #1f2937;
    transition: all 0.3s ease-in-out;
    animation: prompt-appear 0.5s ease-out;
}

#enhanced-prompt-container:not(.hidden) {
    display: block;
}

#enhanced-prompt-container:hover {
    border-color: #0d9488;
    box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.15);
}

#enhanced-prompt-container::before {
    content: '✨';
    position: absolute;
    top: -0.75rem;
    left: 0.5rem;
    font-size: 1.25rem;
    color: #14b8a6;
}

@keyframes prompt-appear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Button spinner styles */
.button-spinner {
    width: 1.25rem;
    height: 1.25rem;
    color: #14b8a6;
}

/* Loader overlay styles */
.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loader-spinner {
    width: 2.5rem;
    height: 2.5rem;
    color: #14b8a6;
    animation: spin 1s linear infinite;
}

/* Slow spin for coin icon */
.animate-spin-slow {
  animation: spin 3s linear infinite;
}

/* Progress bar transition */
#progress-bar {
  transition: width 0.5s ease-in-out;
}

/* Video player styling */
#video-player-container video {
  max-height: 400px;
  border-radius: 8px;
  margin: 0 auto;
}

/* Disable pause control (note: CSS can't fully disable pause, handled in JS) */
#video-player::-webkit-media-controls {
  /* Hide pause button if possible, but relies on JS for full control */
}

/* Dashboard link hover effect */
#dashboard-link:hover {
  text-decoration: underline;
}

/* Credits container animation */
#credits-count {
  transition: color 0.3s ease-in-out;
}

#credits-count.low {
  color: #ef4444; /* Red for low credits */
}

/* Fade-in for dynamic elements */
.animate-fade-in {
  animation: fade-in 0.5s ease-out forwards;
}

/* Typing animation for progress text */
#progress-text {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid #2563eb; /* Cursor effect */
  animation: typing 1.5s steps(40, end), blink-caret 0.5s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: #2563eb; }
}

/* Ensure progress text resets for new text */
#progress-text.animate-typing {
  animation: typing 1.5s steps(40, end), blink-caret 0.5s step-end infinite;
}

/* Prevent progress text from scrolling or overflowing */
#progress-text {
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden; /* Hide overflow */
    text-overflow: ellipsis; /* Add ellipsis if text overflows */
    max-width: 100%; /* Ensure it fits within its container */
}

/* Style the Play Again button */
#play-again-btn {
    display: none; /* Hidden by default, shown via JS */
    z-index: 10; /* Ensure it appears above the video */
}

/* Ensure video player container is positioned relatively for absolute positioning of Play Again button */
#video-player-container {
    position: relative;
}

#modalCloseBtn {
    font-size: 2rem;
    font-weight: bold;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.2s ease;
    z-index: 60;
}
#modalCloseBtn:hover {
    color: #2563eb;
    transform: scale(1.2);
}
#modalCloseBtn:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

#video-carousel {
    transition: transform 0.5s ease-in-out;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
}
#video-carousel::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari */
}
#prev-video-btn, #next-video-btn {
    opacity: 0.8;
    transition: opacity 0.3s ease, transform 0.2s ease;
}
#prev-video-btn:hover, #next-video-btn:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}
#prev-video-btn:focus, #next-video-btn:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
#prev-video-btn:disabled, #next-video-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
@media (max-width: 768px) {
    #video-carousel {
        auto-cols-[100%]; /* Show one video at a time on mobile */
    }
    #prev-video-btn, #next-video-btn {
        padding: 8px;
    }
}
