/**
 * SublioStore Design & Animation Enhancements v1.2.1
 * Micro-interactions, Parallax, Advanced Animations
 */

/* ========================================
   MICRO-INTERACTIONS
   ======================================== */

/* Button Ripple Effect */
.btn, .category-btn, .plan-select-btn {
    position: relative;
    overflow: hidden;
}

.btn::before, .category-btn::before, .plan-select-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;
}

.btn:active::before, .category-btn:active::before, .plan-select-btn:active::before {
    width: 300px;
    height: 300px;
}

/* Interactive Icon Bounce */
.fas, .fab {
    transition: transform 0.3s ease;
}

.btn:hover .fas,
.btn:hover .fab,
.category-card:hover .fas,
.category-card:hover .fab {
    transform: scale(1.2) rotate(5deg);
    animation: iconBounce 0.6s ease;
}

@keyframes iconBounce {
    0%, 100% { transform: scale(1.2) rotate(5deg); }
    50% { transform: scale(1.3) rotate(-5deg); }
}

/* Card Tilt on Hover */
.category-card,
.plan-card,
.review-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover,
.plan-card:hover,
.review-card:hover {
    transform: perspective(1000px) rotateX(2deg) rotateY(-2deg) translateY(-5px);
}

/* Input Focus Glow */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3),
                0 0 20px rgba(99, 102, 241, 0.2);
    transform: scale(1.02);
    transition: all 0.3s ease;
}

/* Checkbox/Radio Custom Animation */
input[type="checkbox"],
input[type="radio"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-green);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background: var(--primary-green);
    border-color: var(--primary-green);
    animation: checkBounce 0.3s ease;
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
}

@keyframes checkBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Tooltip Animations */
[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

[data-tooltip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

/* Loading Spinner Enhancement */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top-color: var(--primary-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Pulse Effect for Notifications */
.notification {
    animation: notificationSlide 0.5s ease, pulse 2s ease infinite;
}

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

/* ========================================
   PARALLAX EFFECTS
   ======================================== */

/* Hero Parallax Background */
.hero {
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, 
        rgba(99, 102, 241, 0.15) 0%, 
        rgba(139, 92, 246, 0.1) 25%,
        transparent 50%);
    animation: parallaxRotate 30s linear infinite;
    pointer-events: none;
}

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

/* Floating Elements */
.floating {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.floating-delayed {
    animation: float 8s ease-in-out infinite;
    animation-delay: 2s;
}

/* Parallax Layers */
.parallax-layer {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ========================================
   ADVANCED SCROLL ANIMATIONS
   ======================================== */

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-green), var(--secondary-green));
    z-index: 9999;
    transition: width 0.1s ease;
}

/* Scroll to Top Button Enhanced */
#scrollTopBtn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-green), var(--secondary-green));
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    z-index: 1000;
}

#scrollTopBtn.show {
    opacity: 1;
    visibility: visible;
}

#scrollTopBtn:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

#scrollTopBtn:active {
    transform: translateY(-3px) scale(1.05);
}

/* ========================================
   TEXT ANIMATIONS
   ======================================== */

/* Gradient Text Animation */
.gradient-text {
    background: linear-gradient(45deg, 
        var(--primary-green), 
        var(--secondary-green), 
        #d946ef,
        var(--primary-green));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 5s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Typing Effect */
.typing-text {
    overflow: hidden;
    border-right: 2px solid var(--primary-green);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
}

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

@keyframes blink {
    from, to { border-color: transparent; }
    50% { border-color: var(--primary-green); }
}

/* ========================================
   LOADING STATES
   ======================================== */

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.05) 25%, 
        rgba(255,255,255,0.1) 50%, 
        rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

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

/* Progress Bar Animation */
.progress-bar {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-green), var(--secondary-green));
    border-radius: 10px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255,255,255,0.3), 
        transparent);
    animation: progressShine 2s ease infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ========================================
   MODAL ENHANCEMENTS
   ======================================== */

/* Modal Backdrop Blur */
.modal.active {
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* ========================================
   IMAGE EFFECTS
   ======================================== */

/* Image Zoom on Hover */
.image-zoom {
    overflow: hidden;
    border-radius: 15px;
}

.image-zoom img {
    transition: transform 0.5s ease;
}

.image-zoom:hover img {
    transform: scale(1.1) rotate(2deg);
}

/* Image Lazy Load Fade In */
img[data-src] {
    opacity: 0;
    transition: opacity 0.5s ease;
}

img[data-src].loaded {
    opacity: 1;
}

/* ========================================
   MOBILE ENHANCEMENTS
   ======================================== */

/* Touch Feedback */
@media (hover: none) and (pointer: coarse) {
    .btn:active,
    .category-card:active,
    .plan-card:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* Pull to Refresh Indicator */
.pull-to-refresh {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    opacity: 0;
    transition: opacity 0.3s ease, top 0.3s ease;
}

.pull-to-refresh.active {
    top: 20px;
    opacity: 1;
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* GPU Acceleration */
.category-card,
.plan-card,
.review-card,
.btn {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   SPECIAL EFFECTS
   ======================================== */

/* Confetti Animation for Success */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--primary-green);
    animation: confetti-fall 3s linear forwards;
    pointer-events: none;
    z-index: 10000;
}

/* Glow Pulse for Important Elements */
.glow-pulse {
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.8),
                    0 0 30px rgba(139, 92, 246, 0.6);
    }
}

/* Typewriter Effect for Hero */
.typewriter {
    overflow: hidden;
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: 0.1em;
    animation: typewriter 4s steps(40, end);
}

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