/**
 * QR Generator PRO - Premium Animations
 * Animaciones fluidas y modernas para una UX excepcional
 */

/* ============================================
   KEYFRAMES - Animaciones Base
   ============================================ */

/* Entrada de iconos - Bounce In */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-20px);
    }

    50% {
        opacity: 1;
        transform: scale(1.05) translateY(0);
    }

    70% {
        transform: scale(0.95);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* QR Preview - Rotate & Scale */
@keyframes qrAppear {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
        filter: blur(10px);
    }

    60% {
        transform: scale(1.1) rotate(10deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: blur(0);
    }
}

/* Pulse Effect - Botón Generar */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(0, 157, 178, 0.3);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 30px rgba(0, 212, 170, 0.5), 0 0 0 10px rgba(0, 212, 170, 0.1);
    }
}

/* Shake - Validación de errores */
@keyframes shake {

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

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

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

/* Gradient Shift - Fondos animados */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

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

/* Fade In Up - Elementos que aparecen */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Slide In Right - Paneles laterales */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

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

/* Loading Spinner */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Glow Effect */
@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(0, 212, 170, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(0, 212, 170, 0.8), 0 0 30px rgba(0, 157, 178, 0.6);
    }
}

/* ============================================
   APLICAR ANIMACIONES
   ============================================ */

/* Tabs - Bounce In con delay escalonado */
.tab-btn {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation-fill-mode: both;
}

.tab-btn:nth-child(1) {
    animation-delay: 0.05s;
}

.tab-btn:nth-child(2) {
    animation-delay: 0.1s;
}

.tab-btn:nth-child(3) {
    animation-delay: 0.15s;
}

.tab-btn:nth-child(4) {
    animation-delay: 0.2s;
}

.tab-btn:nth-child(5) {
    animation-delay: 0.25s;
}

.tab-btn:nth-child(6) {
    animation-delay: 0.3s;
}

/* Tab icons - Rotate on hover */
.tab-btn svg {
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.tab-btn:hover svg {
    transform: rotate(15deg) scale(1.1);
}

.tab-btn.active svg {
    animation: bounceIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Type Options - Hover effect */
.type-option {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.type-option:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 157, 178, 0.2);
}

.type-option:active {
    transform: translateY(-2px) scale(1.02);
}

/* Style Presets - Scale & Glow */
.preset-btn {
    transition: all 0.3s ease;
}

.preset-btn:hover {
    transform: translateY(-3px);
    animation: glow 2s infinite;
}

.preset-btn.active {
    animation: pulse 2s infinite;
}

.preset-btn .preset-preview {
    transition: transform 0.3s ease;
}

.preset-btn:hover .preset-preview {
    transform: rotate(5deg) scale(1.1);
}

/* Color Pickers - Smooth transitions */
.color-picker {
    transition: all 0.3s ease;
}

.color-picker:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-hex {
    transition: all 0.3s ease;
}

.color-hex:focus {
    transform: translateY(-2px);
}

/* Toggle Buttons - Bounce */
.gradient-toggle-btn,
.transparent-toggle-btn {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.gradient-toggle-btn:hover,
.transparent-toggle-btn:hover {
    transform: scale(1.15) rotate(5deg);
}

.gradient-toggle-btn.active {
    animation: pulse 1.5s infinite;
}

.transparent-toggle-btn.active {
    animation: glow 2s infinite;
}

/* Range Slider - Smooth movement */
.range-slider {
    transition: all 0.2s ease;
}

.range-slider::-webkit-slider-thumb {
    transition: all 0.2s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 157, 178, 0.4);
}

.range-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 157, 178, 0.4);
}

/* Size Preset Buttons */
.size-preset-btn {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.size-preset-btn:hover {
    transform: translateY(-3px) scale(1.05);
}

.size-preset-btn.active {
    animation: pulse 2s infinite;
}

/* Upload Button - Hover & Active */
.upload-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.upload-btn:hover::before {
    width: 300px;
    height: 300px;
}

.upload-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 157, 178, 0.4);
}

.upload-btn:active {
    transform: translateY(-1px);
}

/* Remove Logo Button - Spin on hover */
.remove-logo-btn {
    transition: all 0.3s ease;
}

.remove-logo-btn:hover {
    transform: scale(1.15) rotate(90deg);
}

/* Generate Button - PULSE EFFECT */
.btn-generate {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.btn-generate::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300%;
    height: 300%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translate(-50%, -50%) rotate(45deg);
    transition: all 0.6s;
}

.btn-generate:hover::before {
    transform: translate(-50%, -50%) rotate(45deg) translateX(100%);
}

.btn-generate:hover {
    animation: pulse 1.5s infinite;
    transform: translateY(-2px);
}

.btn-generate:active {
    transform: translateY(0) scale(0.98);
}

.btn-generate.generating {
    pointer-events: none;
}

.btn-generate.generating svg {
    animation: spin 1s linear infinite;
}

/* QR Preview - Appear Animation */
#qrCanvas.generated {
    animation: qrAppear 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#qrCanvas:hover {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

/* QR Placeholder - Pulse */
.qr-placeholder {
    animation: fadeInUp 0.6s ease;
}

.qr-placeholder svg {
    animation: pulse 3s infinite ease-in-out;
}

/* Download Buttons - Scale & Slide */
.download-btn {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: slideInRight 0.5s ease;
    animation-fill-mode: both;
}

.download-btn:nth-child(1) {
    animation-delay: 0.1s;
}

.download-btn:nth-child(2) {
    animation-delay: 0.15s;
}

.download-btn:nth-child(3) {
    animation-delay: 0.2s;
}

.download-btn:nth-child(4) {
    animation-delay: 0.25s;
}

.download-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 157, 178, 0.3);
}

.download-btn:active {
    transform: translateY(-2px) scale(1.02);
}

.download-btn svg {
    transition: transform 0.3s ease;
}

.download-btn:hover svg {
    transform: scale(1.2) rotate(-5deg);
}

/* Quick Actions - Fade In */
.action-btn {
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease;
    animation-fill-mode: both;
}

.action-btn:nth-child(1) {
    animation-delay: 0.3s;
}

.action-btn:nth-child(2) {
    animation-delay: 0.35s;
}

.action-btn:hover {
    transform: translateY(-3px) scale(1.05);
}

/* Features List - Stagger entrance */
.feature-item {
    animation: fadeInUp 0.5s ease;
    animation-fill-mode: both;
}

.feature-item:nth-child(1) {
    animation-delay: 0.4s;
}

.feature-item:nth-child(2) {
    animation-delay: 0.45s;
}

.feature-item:nth-child(3) {
    animation-delay: 0.5s;
}

.feature-item:nth-child(4) {
    animation-delay: 0.55s;
}

.feature-item svg {
    transition: transform 0.3s ease;
}

.feature-item:hover svg {
    transform: scale(1.2) rotate(10deg);
}

/* Form Inputs - Focus animation */
.form-input,
.form-textarea,
.form-select {
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    transform: translateY(-2px);
}

/* Panels - Slide in */
.qr-config-panel {
    animation: fadeInUp 0.6s ease;
}

.qr-preview-panel {
    animation: slideInRight 0.6s ease;
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

/* Error State - Shake */
.form-input.error,
.form-textarea.error {
    animation: shake 0.5s ease;
    border-color: #e53e3e;
}

/* Success State - Glow */
.form-input.success {
    animation: glow 1s ease;
    border-color: #00d4aa;
}

/* Loading State */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(0, 212, 170, 0.3);
    border-top-color: #00d4aa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Gradient Background Animation */
.hero {
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
}

/* ============================================
   MOBILE ANIMATIONS
   ============================================ */

@media (max-width: 768px) {

    /* Reducir intensidad en móvil para mejor performance */
    .tab-btn,
    .type-option,
    .download-btn,
    .feature-item {
        animation-duration: 0.4s;
    }

    /* Desactivar algunas animaciones pesadas */
    .hero {
        animation: none;
    }

    .btn-generate:hover {
        animation: none;
        transform: translateY(-2px);
    }

    /* Animaciones táctiles más sutiles */
    .tab-btn:active,
    .type-option:active,
    .download-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   PRINT
   ============================================ */

@media print {
    * {
        animation: none !important;
        transition: none !important;
    }
}