/* ============================================
   TAGNIFIC - ANIMATIONS
   Keyframes, transitions, and loading states
   ============================================ */

/* Spinner/Loader */
.loader {
    border: 2px solid var(--slate-200);
    border-top: 2px solid var(--brand-600);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    animation: spin 0.8s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Card Fade Slide Up */
.card-anim {
    animation: fadeSlideUp 0.3s ease-out forwards;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Enter Animation */
.modal-enter {
    animation: modalIn 0.2s ease-out forwards;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Fade In */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Pulse Animation */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Bounce */
.bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }

    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

/* Shake (for errors) */
.shake {
    animation: shake 0.5s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Slide In From Right */
.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide Out To Right */
.slide-out-right {
    animation: slideOutRight 0.3s ease-in;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Glow Effect */
.glow {
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(16, 185, 129, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg,
            var(--slate-200) 25%,
            var(--slate-100) 50%,
            var(--slate-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

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

    100% {
        background-position: -200% 0;
    }
}

/* Transition Utilities */
.transition-all {
    transition: all var(--transition-base);
}

.transition-colors {
    transition: color var(--transition-base),
        background-color var(--transition-base),
        border-color var(--transition-base);
}

.transition-transform {
    transition: transform var(--transition-base);
}

.transition-opacity {
    transition: opacity var(--transition-base);
}

/* ============================================
   THEME INPUT ANIMATIONS
   Eye-catching animations for the theme field
   ============================================ */

/* Theme input wrapper - add padding for glow */
.theme-input-wrapper {
    padding: 4px;
    margin: -4px;
}

/* Glowing border animation */
.theme-glow-border {
    position: absolute;
    inset: 2px;
    background: linear-gradient(45deg,
        #14b8a6, #06b6d4, #06b6d4, #0891b2,
        #14b8a6, #06b6d4, #06b6d4);
    background-size: 300% 300%;
    border-radius: 14px;
    z-index: 0;
    opacity: 0.6;
    animation: theme-glow-rotate 4s ease-in-out infinite;
    filter: blur(4px);
}

@keyframes theme-glow-rotate {
    0%, 100% {
        background-position: 0% 50%;
        opacity: 0.4;
    }
    50% {
        background-position: 100% 50%;
        opacity: 0.7;
    }
}

/* Theme icon pulse animation */
.theme-icon-pulse {
    animation: theme-icon-pulse 2s ease-in-out infinite;
}

@keyframes theme-icon-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.8;
    }
}

/* Animated placeholder with typewriter effect */
.theme-placeholder {
    animation: theme-placeholder-cycle 8s ease-in-out infinite;
}

@keyframes theme-placeholder-cycle {
    0%, 20% {
        content: "Describe your theme...";
        opacity: 0.7;
    }
    25%, 45% {
        opacity: 0;
    }
    50%, 70% {
        opacity: 0.7;
    }
    75%, 95% {
        opacity: 0;
    }
}

/* Hide placeholder when input has value or is focused */
.theme-input:focus + .theme-placeholder,
.theme-input:not(:placeholder-shown) + .theme-placeholder {
    opacity: 0 !important;
    transform: translateY(-50%) translateX(10px);
}

/* Theme input focus state */
.theme-input:focus {
    outline: none;
}

.theme-input-wrapper:focus-within .theme-glow-border {
    opacity: 0.9;
    filter: blur(4px);
    animation: theme-glow-intense 1.5s ease-in-out infinite;
}

@keyframes theme-glow-intense {
    0%, 100% {
        background-position: 0% 50%;
        opacity: 0.7;
    }
    50% {
        background-position: 100% 50%;
        opacity: 1;
    }
}

/* Fade in animation for hint */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-5px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Shimmer effect for empty state */
.theme-input:placeholder-shown + .theme-placeholder::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(20, 184, 166, 0.2),
        transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* ============================================
   THEME FLIP CARD ANIMATION
   Flips to reveal input field
   ============================================ */

.theme-flip-container {
    perspective: 1000px;
    position: relative;
}

.theme-flip-front,
.theme-flip-back {
    backface-visibility: hidden;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-flip-front {
    position: relative;
    transform: rotateX(0deg);
}

.theme-flip-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transform: rotateX(180deg);
}

/* When expanded - show input */
.theme-flip-container.expanded .theme-flip-front {
    transform: rotateX(-180deg);
}

.theme-flip-container.expanded .theme-flip-back {
    transform: rotateX(0deg);
    position: relative;
}

/* Auto-flip hint animation - subtle bounce to draw attention */
.theme-flip-front.hint-flip {
    animation: hintFlip 0.5s ease-in-out;
}

@keyframes hintFlip {
    0%, 100% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(15deg);
    }
}

/* Wiggle animation for attention */
.theme-flip-front.wiggle {
    animation: wiggleAttention 0.6s ease-in-out;
}

@keyframes wiggleAttention {
    0%, 100% {
        transform: rotateX(0deg) scale(1);
    }
    25% {
        transform: rotateX(5deg) scale(1.02);
    }
    50% {
        transform: rotateX(-3deg) scale(1.03);
    }
    75% {
        transform: rotateX(3deg) scale(1.02);
    }
}

/* Pulse glow when collapsed to draw attention */
.theme-flip-container:not(.expanded) .theme-flip-front {
    animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(20, 184, 166, 0);
    }
    50% {
        box-shadow: 0 0 15px 3px rgba(20, 184, 166, 0.3);
    }
}

/* ============================================
   SPLASH SCREEN
   Cosmic intro animation with theme support
   ============================================ */

#splash-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    animation: splashFadeOut 0.6s ease-in 3.2s forwards;
}

/* Background — dark cosmic gradient (default since dark theme is default) */
.splash-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 20% 50%, #042f2e 0%, #0f172a 50%, #020617 100%);
}

/* Star field overlay */
.splash-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(1.5px 1.5px at 10% 20%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 25% 55%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1.5px 1.5px at 40% 15%, rgba(255,255,255,0.25), transparent),
        radial-gradient(1px 1px at 55% 75%, rgba(255,255,255,0.35), transparent),
        radial-gradient(2px 2px at 70% 30%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 85% 65%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1.5px 1.5px at 15% 85%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 92% 10%, rgba(255,255,255,0.25), transparent),
        radial-gradient(1px 1px at 50% 45%, rgba(255,255,255,0.15), transparent),
        radial-gradient(1.5px 1.5px at 35% 90%, rgba(255,255,255,0.2), transparent);
    animation: splashStarsTwinkle 3s ease-in-out infinite;
}

/* Cosmic glow center pulse */
.splash-bg::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(20, 184, 166, 0.12) 0%, rgba(20, 184, 166, 0.06) 40%, transparent 70%);
    animation: splashCosmicPulse 3s ease-in-out infinite;
}

@keyframes splashStarsTwinkle {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes splashCosmicPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.4); opacity: 0.9; }
}

/* Floating particles */
.splash-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.splash-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: splashFloat 4s ease-in-out infinite;
}

.splash-particle:nth-child(1) { top: 12%; left: 8%; animation-delay: 0s; width: 3px; height: 3px; }
.splash-particle:nth-child(2) { top: 30%; left: 82%; animation-delay: 0.5s; }
.splash-particle:nth-child(3) { top: 68%; left: 18%; animation-delay: 1s; width: 3px; height: 3px; }
.splash-particle:nth-child(4) { top: 22%; left: 92%; animation-delay: 1.5s; }
.splash-particle:nth-child(5) { top: 78%; left: 58%; animation-delay: 0.7s; width: 3px; height: 3px; }
.splash-particle:nth-child(6) { top: 88%; left: 32%; animation-delay: 1.2s; }
.splash-particle:nth-child(7) { top: 48%; left: 42%; animation-delay: 0.3s; }
.splash-particle:nth-child(8) { top: 55%; left: 72%; animation-delay: 0.9s; width: 3px; height: 3px; }

@keyframes splashFloat {
    0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); }
    20% { opacity: 0.7; }
    50% { opacity: 1; transform: translateY(-30px) scale(1.3); }
    80% { opacity: 0.5; }
}

/* Splash content */
.splash-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

/* Tagline — subtle fade in + slide up */
.splash-tagline {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 300;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 1.25rem;
    opacity: 0;
    transform: translateY(15px);
    animation: splashTaglineIn 0.8s ease-out 0.4s forwards;
}

@media (min-width: 768px) {
    .splash-tagline {
        font-size: 0.85rem;
        letter-spacing: 0.4em;
    }
}

/* Brand name — scale from small to big */
.splash-brand {
    font-family: 'Inter', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    letter-spacing: -0.025em;
    line-height: 1;
    opacity: 0;
    transform: scale(0.15);
    filter: blur(8px);
    animation: splashBrandIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.9s forwards;
}

@media (min-width: 768px) {
    .splash-brand {
        font-size: 5rem;
    }
}

.splash-brand span {
    background: linear-gradient(135deg, #10b981, #2dd4bf, #06b6d4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Accent line */
.splash-line {
    width: 0;
    height: 2px;
    margin: 1.5rem auto 0;
    background: linear-gradient(90deg, transparent, #2dd4bf, #06b6d4, transparent);
    border-radius: 1px;
    animation: splashLineExpand 0.6s ease-out 1.8s forwards;
}

/* Splash keyframes */
@keyframes splashTaglineIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes splashBrandIn {
    to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

@keyframes splashLineExpand {
    to {
        width: 140px;
    }
}

@keyframes splashFadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}

/* Mobile menu slide in */
.animate-slideIn {
    animation: slideInFromLeft 0.25s ease-out forwards;
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}