/* Animations CSS for PromptZap - Elite UI/UX Design System */

/* ============================================
   TYPOGRAPHY SYSTEM
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ============================================
   LEGACY COLOR REFERENCES
   Maintained for backward compatibility
   New code should use variables.css
   ============================================ */
:root {
    /* Brand Identity - mapped to new coral/amber system */
    --brand-primary: var(--accent-coral, #F77F00);
    --brand-secondary: var(--accent-amber, #FCBF49);
    --brand-gradient: linear-gradient(135deg, var(--accent-coral, #F77F00) 0%, var(--accent-amber, #FCBF49) 100%);

    /* Semantic Colors (maintained from original) */
    --success: var(--color-success, #10B981);
    --warning: var(--color-warning, #F59E0B);
    --error: var(--color-error, #EF4444);
    --info: var(--color-info, #06B6D4);

    /* Dark Theme - mapped to new warm backgrounds */
    --bg-canvas: var(--bg-primary, #003049);
    --bg-surface: var(--bg-secondary, #023e58);
    --bg-surface-raised: var(--bg-card, #064a6b);
    --bg-interactive: var(--bg-card, #064a6b);

    /* Text Colors - mapped to new warm text colors */
    --text-tertiary: var(--text-secondary, #8FBDD3);

    /* Type Scale - use new variables.css typography */
    --text-xs: var(--text-tiny, 0.75rem);
    --text-sm: var(--text-small, 0.875rem);
    --text-base: var(--text-body, 1rem);
    --text-lg: var(--text-h3, 1.25rem);
    --text-xl: var(--text-h2, 1.5rem);
    --text-2xl: var(--text-h1, 2.5rem);
    --text-3xl: var(--text-hero, clamp(3rem, 8vw, 5.5rem));
}

/* ============================================
   MOTION DESIGN (Physics-Based Animation)
   ============================================ */

/* Sparkle animation - one-time 1.2s pulse */
@keyframes sparkle {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Shimmer effect for button hover */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 1s ease-out;
}

.shimmer:hover::before {
    left: 100%;
}

/* Button Shimmer Animation */
@keyframes shimmer-sweep {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.animate-shimmer-sweep {
    animation: shimmer-sweep 1s ease-out;
}

/* Ripple effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Zen fade - for non-active elements */
.zen-fade {
    opacity: 0.3;
    transition: opacity 0.3s ease-in-out;
}

/* Confetti pieces */
.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent-coral);
    animation: confetti-fall 3s ease-out forwards;
}

.confetti-piece:nth-child(2n) {
    background: var(--accent-amber);
}

.confetti-piece:nth-child(3n) {
    background: var(--color-success);
}

.confetti-piece:nth-child(4n) {
    background: var(--color-warning);
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Pulse glow for Generate button */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(247, 127, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(247, 127, 0, 0.6);
    }
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ============================================
   MOMENTUM-BASED ANIMATIONS
   ============================================ */

/* Output Reveal (Momentum-based slide) */
@keyframes slideUpMomentum {
    0% {
        transform: translateY(100%) scale(0.9);
        opacity: 0;
    }
    60% {
        transform: translateY(-2%) scale(1.01);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.animate-slideUpMomentum {
    animation: slideUpMomentum 600ms cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom;
}

/* Fade-in Stagger for AI Suggestions */
@keyframes fadeInStagger {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.animate-fadeInStagger {
    animation: fadeInStagger 400ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fadeIn {
    animation: fadeIn 300ms ease-out;
}

/* Float Animation (for empty state icon) */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Input Focus Animation */
@keyframes inputFocus {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(247, 127, 0, 0.1);
    }
    100% {
        transform: scale(1.01);
        box-shadow:
            0 0 0 4px rgba(247, 127, 0, 0.1),
            0 8px 32px rgba(247, 127, 0, 0.15);
    }
}

/* Button Scale Animation */
@keyframes buttonActive {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.98);
    }
    100% {
        transform: scale(1);
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Smooth transitions */
.transition-smooth {
    transition: all 400ms cubic-bezier(0.4, 0.0, 0.2, 1);
}

.transition-momentum {
    transition: all 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Glass morphism effect */
.glass {
    background: rgba(26, 27, 34, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Gradient border glow */
.gradient-border-glow {
    position: relative;
}

.gradient-border-glow::before {
    content: '';
    position: absolute;
    inset: -0.5px;
    border-radius: inherit;
    padding: 0.5px;
    background: linear-gradient(135deg, var(--accent-coral), var(--accent-amber));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.gradient-border-glow:focus-within::before {
    opacity: 0.2;
}

/* ============================================
   COMPONENT STYLES
   ============================================ */

/* Textarea responsive sizing */
.textarea-responsive {
    min-height: 200px;
    max-height: 600px;
}

/* Thin scrollbar utility */
.scrollbar-thin {
    scrollbar-width: thin;
}

/* ============================================
   NAVIGATION COMPONENTS
   ============================================ */

/* Navigation Link Base Styles */
.nav-link {
    position: relative;
    transition: color 0.2s ease;
    padding-bottom: 8px;
    /* Ensure vertical alignment matches non-nav-link items */
    display: inline-flex;
    align-items: center;
    height: 100%;
}

/* Active Navigation Link with Warm Gradient Underline */
.nav-link-active::after {
    content: '';
    position: absolute;
    bottom: -28px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-coral, #F77F00) 0%, var(--accent-amber, #FCBF49) 100%);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(247, 127, 0, 0.4);
}

/* Auth State Transitions */
#signin-link,
#mobile-signin-link {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#signin-link.hidden,
#mobile-signin-link.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

#user-menu,
#mobile-user-menu {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Note: User dropdown styles are now in /static/css/user-dropdown.css */
/* Removed conflicting dropdown CSS from this file to prevent !important overrides */

#user-menu:not(.hidden),
#mobile-user-menu:not(.hidden) {
    animation: fadeSlideIn 0.3s ease forwards;
}

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

#user-name,
#mobile-user-name {
    transition: opacity 0.2s ease;
}

#user-name:not(.hidden),
#mobile-user-name:not(.hidden) {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   iOS SPRING ANIMATIONS
   ============================================ */

/* iOS-style press feedback */
@keyframes ios-press {
    0% { transform: scale(1); }
    50% { transform: scale(0.96); }
    100% { transform: scale(1); }
}

.animate-ios-press {
    animation: ios-press 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* iOS-style appear with scale */
@keyframes ios-appear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.animate-ios-appear {
    animation: ios-appear 0.3s cubic-bezier(0.33, 1, 0.68, 1) forwards;
}

/* iOS bottom sheet slide up */
@keyframes ios-sheet-up {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-ios-sheet-up {
    animation: ios-sheet-up 0.35s cubic-bezier(0.33, 1, 0.68, 1) forwards;
}

/* iOS haptic feedback simulation */
@keyframes ios-haptic {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-1px); }
    75% { transform: translateX(1px); }
}

.animate-ios-haptic {
    animation: ios-haptic 0.1s ease-in-out;
}

/* iOS scale bounce */
@keyframes ios-bounce {
    0% { transform: scale(0.9); opacity: 0; }
    60% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

.animate-ios-bounce {
    animation: ios-bounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Smooth opacity transitions for iOS */
.ios-transition {
    transition: all 0.2s cubic-bezier(0.33, 1, 0.68, 1);
}

/* iOS-style focus glow */
.ios-focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(247, 127, 0, 0.15);
}

/* Segmented control transition */
.ios-segmented-transition {
    transition: background 0.2s cubic-bezier(0.33, 1, 0.68, 1),
                color 0.2s cubic-bezier(0.33, 1, 0.68, 1),
                box-shadow 0.2s cubic-bezier(0.33, 1, 0.68, 1);
}

/* ============================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ============================================ */
@media (max-width: 768px) {
    /* Disable heavy animations on mobile for performance */
    .animate-pulse-glow {
        animation: none !important;
    }

    .animate-float {
        animation: none !important;
    }

    /* Keep essential animations but make them snappier */
    .animate-fadeInUp,
    .animate-fadeIn,
    .animate-slideUpMomentum {
        animation-duration: 0.25s !important;
    }

    /* Disable ambient glow backgrounds on mobile */
    .fixed.inset-0.pointer-events-none.bg-gradient-to-br {
        display: none !important;
    }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .ios-segmented-control__item,
    .ios-card,
    .ios-input,
    .ios-transition,
    #magicWandBtn {
        transition: none !important;
        animation: none !important;
    }

    .animate-ios-press,
    .animate-ios-appear,
    .animate-ios-sheet-up,
    .animate-ios-haptic,
    .animate-ios-bounce {
        animation: none !important;
    }
}

