/* =====================================================
   RAITLY VISUAL ENHANCEMENTS
   Micro-interactions, animations, and premium effects
   ===================================================== */

/* ========== MODAL FIXES (Nuke Approach) ========== */
.modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 1000 !important;
    /* Force cover even if parent has transform */
    width: 200vw !important;
    height: 200vh !important;
    top: -50vh !important;
    left: -50vw !important;
}

.quick-view-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 2147483640 !important;
    /* Top of everything */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* Ensure modal content stays ABOVE backdrop when both are inside .quick-view-modal */
.quick-view-modal .modal-content,
.quick-view-modal .qv-card,
.quick-view-modal .tool-detail-card,
.quick-view-modal .modal-content-wrapper {
    position: relative !important;
    z-index: 1001 !important;
    /* Higher than .modal-backdrop (1000) */
}

.quick-view-modal.active {
    display: flex !important;
}

/* Hide "You've seen all the tools!" message */
.end-of-results,
.end-of-tools,
#paginationWrapper,
#loadMoreContainer {
    display: none !important;
}

/* ========== MICRO-INTERACTIONS ========== */

/* Enhanced Card Hover */
.tool-card-v2,
.tool-card-minimal {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease,
        border-color 0.3s ease;
}

.tool-card-v2:hover,
.tool-card-minimal:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

/* Image Zoom on Card Hover */
.tool-card-v2:hover .card-image img,
.tool-card-minimal:hover .card-image-wrapper img {
    transform: scale(1.08);
}

/* ========== CTA BUTTON PULSE ========== */
@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.5);
    }

    50% {
        box-shadow: 0 0 20px 10px rgba(139, 92, 246, 0);
    }
}

.btn-primary-pulse,
.cta-pulse {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ========== GLASSMORPHISM EFFECTS ========== */
.glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
}

html.dark .glass-card {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

/* ========== SMOOTH THEME TRANSITION ========== */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

html * {
    transition: background-color 0.3s ease,
        border-color 0.3s ease,
        color 0.15s ease;
}

/* ========== SKELETON LOADING ========== */
.skeleton-card {
    background: var(--bg-secondary, #f1f5f9);
    border-radius: 16px;
    padding: 16px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-image {
    width: 100%;
    height: 160px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    border-radius: 12px;
    margin-bottom: 16px;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-title {
    height: 20px;
    width: 70%;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    border-radius: 8px;
    margin-bottom: 12px;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-text {
    height: 14px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    border-radius: 6px;
    margin-bottom: 8px;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-text:last-child {
    width: 50%;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes skeleton-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

html.dark .skeleton-card {
    background: rgba(30, 41, 59, 0.5);
}

html.dark .skeleton-image,
html.dark .skeleton-title,
html.dark .skeleton-text {
    background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
    background-size: 200% 100%;
}

/* ========== FLOATING ANIMATIONS ========== */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* ========== GRADIENT TEXT ========== */
.gradient-text {
    background: linear-gradient(135deg, #8B5CF6, #EC4899, #F59E0B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== RIPPLE EFFECT ========== */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
    opacity: 0;
}

/* ========== BADGE ANIMATIONS ========== */
@keyframes badge-bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.badge-new,
.badge-trending,
.badge-hot {
    animation: badge-bounce 2s ease-in-out infinite;
}

/* ========== SCROLL REVEAL ========== */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== STAGGER ANIMATION ========== */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-item.animated {
    animation: stagger-in 0.5s ease forwards;
}

@keyframes stagger-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger delays */
.stagger-item:nth-child(1) {
    animation-delay: 0.05s;
}

.stagger-item:nth-child(2) {
    animation-delay: 0.1s;
}

.stagger-item:nth-child(3) {
    animation-delay: 0.15s;
}

.stagger-item:nth-child(4) {
    animation-delay: 0.2s;
}

.stagger-item:nth-child(5) {
    animation-delay: 0.25s;
}

.stagger-item:nth-child(6) {
    animation-delay: 0.3s;
}

/* ========== BUTTON HOVER EFFECTS ========== */
.btn-hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
}

/* ========== PWA INSTALL PROMPT ========== */
.pwa-install-prompt {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
    color: white;
    padding: 16px 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.3);
    z-index: 9999;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.pwa-install-prompt.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.pwa-install-prompt .icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.pwa-install-prompt .content h4 {
    font-weight: 700;
    margin-bottom: 4px;
}

.pwa-install-prompt .content p {
    font-size: 14px;
    opacity: 0.9;
}

.pwa-install-prompt .close-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: white;
    color: #7C3AED;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* ========== PERSONALIZATION SECTION ========== */
.recommended-section,
.similar-tools-section {
    padding: 2rem;
    background: var(--bg-secondary, #f8fafc);
    border-radius: 24px;
    margin: 2rem 0;
}

html.dark .recommended-section,
html.dark .similar-tools-section {
    background: rgba(30, 41, 59, 0.5);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header .icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #8B5CF6, #EC4899);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* ========== NOTIFICATION BELL ========== */
.notification-bell {
    position: relative;
    cursor: pointer;
}

.notification-bell .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: #EF4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badge-bounce 2s ease-in-out infinite;
}

/* ========== MOBILE OPTIMIZATIONS ========== */
@media (max-width: 768px) {

    .tool-card-v2:hover,
    .tool-card-minimal:hover {
        transform: translateY(-4px);
    }

    .pwa-install-prompt {
        left: 16px;
        right: 16px;
        transform: translateX(0) translateY(100px);
        bottom: 80px;
    }

    .pwa-install-prompt.show {
        transform: translateX(0) translateY(0);
    }
}

/* ========== GLOBAL STICKY FIX (Nuclear Option) ========== */
/* Ensure all parents have overflow visible so sticky works */
html,
body,
.tool-details-page,
.main-content-section,
.container,
.content-grid,
.sidebar-column {
    overflow: visible !important;
}

/* Explicit Sticky Class Override */
.sticky-sidebar-content {
    position: -webkit-sticky !important;
    /* Safari */
    position: sticky !important;
    top: 100px !important;
    z-index: 100 !important;
    height: fit-content !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
    /* Reset any accidental overflows */
    overflow: visible !important;
    max-height: none !important;
}

/* Ensure sidebar column allows sticking */
.sidebar-column {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}