/**
 * Custom CSS Styles for QR Generator
 * Supports Dark and Light Mode
 * 
 * @package QR Generator
 */

/* =====================================================
   Rainbow Text & Hero Animations
   ===================================================== */

/* Rainbow gradient animation for "Beautiful" text */
@keyframes rainbow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.rainbow-text {
    background: linear-gradient(90deg,
            #ff0000,
            #ff7f00,
            #ffff00,
            #00ff00,
            #0000ff,
            #4b0082,
            #9400d3,
            #ff0000);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbow 3s linear infinite;
}

/* Fade in up animation */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fade-in-up 0.8s ease-out forwards;
}

/* Fade in animation */
@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-fade-in {
    opacity: 0;
    animation: fade-in 0.6s ease-out forwards;
}

/* Slow bounce animation */
@keyframes bounce-slow {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.animate-bounce-slow {
    animation: bounce-slow 2s ease-in-out infinite;
}

/* =====================================================
   Light Mode Base Styles
   ===================================================== */

/* Range Slider - Light Mode */
.slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e5e7eb;
    border-radius: 999px;
    outline: none;
    transition: background 0.3s ease;
}

/* Range Slider - Dark Mode */
:is(.dark) .slider {
    background: rgba(255, 255, 255, 0.1);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 15px rgba(139, 92, 246, 0.5);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.4);
}

/* =====================================================
   Dropzone Styles
   ===================================================== */
.dropzone {
    transition: all 0.3s ease;
}

.dropzone.dragover {
    border-color: #8b5cf6 !important;
    background-color: rgba(139, 92, 246, 0.1) !important;
    transform: scale(1.01);
}

.dropzone.dragover * {
    pointer-events: none;
}

/* =====================================================
   Color Picker Enhancement
   ===================================================== */
input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    border: none;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 0.5rem;
}

/* =====================================================
   Theme Toggle Animations
   ===================================================== */

/* Slow spinning animation for sun icon */
@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-spin-slow {
    animation: spin-slow 8s linear infinite;
}

/* Moon wobble and glow animation */
@keyframes moon-float {

    0%,
    100% {
        transform: rotate(-5deg) translateY(0px);
        filter: drop-shadow(0 0 4px rgba(165, 180, 252, 0.6)) drop-shadow(0 0 8px rgba(129, 140, 248, 0.4));
    }

    25% {
        transform: rotate(5deg) translateY(-2px);
        filter: drop-shadow(0 0 8px rgba(165, 180, 252, 0.8)) drop-shadow(0 0 15px rgba(129, 140, 248, 0.6));
    }

    50% {
        transform: rotate(-3deg) translateY(-1px);
        filter: drop-shadow(0 0 12px rgba(165, 180, 252, 1)) drop-shadow(0 0 20px rgba(129, 140, 248, 0.8));
    }

    75% {
        transform: rotate(4deg) translateY(-3px);
        filter: drop-shadow(0 0 6px rgba(165, 180, 252, 0.7)) drop-shadow(0 0 12px rgba(129, 140, 248, 0.5));
    }
}

.animate-pulse-glow {
    animation: moon-float 3s ease-in-out infinite;
}

/* =====================================================
   Scrollbar Styles
   ===================================================== */

/* Light Mode Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Dark Mode Scrollbar */
:is(.dark)::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

:is(.dark)::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.5);
}

:is(.dark)::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.7);
}

/* =====================================================
   Glassmorphism Enhancement
   ===================================================== */
.glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* =====================================================
   Interactive Elements
   ===================================================== */

/* Button Press Effect */
button:active:not(:disabled) {
    transform: scale(0.98);
}

/* Smooth Transitions for All Interactive Elements */
button,
input,
a {
    transition: all 0.2s ease;
}

/* Focus Ring Override */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

/* =====================================================
   Animations
   ===================================================== */

/* Loading Animation */
@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.loading-ring {
    animation: pulse-ring 1.25s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Toast Visible State */
.toast-visible {
    transform: translateY(0) !important;
    opacity: 1 !important;
}

/* QR Canvas Animation */
#qr-canvas {
    transition: opacity 0.3s ease;
}

/* Logo Preview Animation */
#logo-preview img {
    animation: fadeIn 0.3s ease-out;
}

/* =====================================================
   Text & Selection Styles
   ===================================================== */

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Selection Color - Light Mode */
::selection {
    background: rgba(139, 92, 246, 0.3);
    color: #1f2937;
}

/* Selection Color - Dark Mode */
:is(.dark) ::selection {
    background: rgba(139, 92, 246, 0.4);
    color: white;
}

/* =====================================================
   Card Effects
   ===================================================== */

/* Card Hover Effect */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

/* Light Mode Card Shadow on Hover */
.hover-lift:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Dark Mode Card Shadow on Hover */
:is(.dark) .hover-lift:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* =====================================================
   Theme Toggle Animation
   ===================================================== */
#theme-toggle {
    position: relative;
    overflow: hidden;
}

#theme-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 9999px;
}

:is(.dark) #theme-toggle::before {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    opacity: 0.2;
}