/* =====================================================
   DESIGN ENHANCEMENTS - Animations, Dark Mode, Cards
   ===================================================== */

/* ========== 3.1 MICRO-ANIMATIONS ========== */

/* Enhanced Card Hover with 3D Effect */
.tool-card-v2 {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.tool-card-v2:hover {
    transform: translateY(-8px) rotateX(2deg);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.12),
        0 8px 16px rgba(124, 58, 237, 0.08);
}

/* Badge Pulse Animation */
.badge-new {
    animation: badgePulse 2s ease-in-out infinite;
}

.badge-trending {
    animation: badgeGlow 1.5s ease-in-out infinite alternate;
}

@keyframes badgePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes badgeGlow {
    0% {
        box-shadow: 0 0 5px rgba(239, 68, 68, 0.5);
    }

    100% {
        box-shadow: 0 0 15px rgba(239, 68, 68, 0.8);
    }
}

/* Image Hover Zoom */
.tool-card-v2 .card-image {
    overflow: hidden;
}

.tool-card-v2 .card-image img {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tool-card-v2:hover .card-image img {
    transform: scale(1.08);
}

/* Button Hover Animations */
.tool-card-v2 .btn-try {
    position: relative;
    overflow: hidden;
}

.tool-card-v2 .btn-try::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.tool-card-v2:hover .btn-try::before {
    left: 100%;
}

/* Staggered Card Entrance Animation */
.tool-card-v2 {
    opacity: 0;
    animation: cardEntrance 0.5s ease-out forwards;
}

.tool-card-v2:nth-child(1) {
    animation-delay: 0.05s;
}

.tool-card-v2:nth-child(2) {
    animation-delay: 0.1s;
}

.tool-card-v2:nth-child(3) {
    animation-delay: 0.15s;
}

.tool-card-v2:nth-child(4) {
    animation-delay: 0.2s;
}

.tool-card-v2:nth-child(5) {
    animation-delay: 0.25s;
}

.tool-card-v2:nth-child(6) {
    animation-delay: 0.3s;
}

.tool-card-v2:nth-child(7) {
    animation-delay: 0.35s;
}

.tool-card-v2:nth-child(8) {
    animation-delay: 0.4s;
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Disable animations and 3D effects on mobile for performance and visibility safety */
@media (max-width: 576px) {
    .tool-card-v2 {
        opacity: 1 !important;
        animation: none !important;
        transform: none !important;
        transform-style: flat !important;
        perspective: none !important;
    }
    
    .tool-card-v2:nth-child(n) {
        animation-delay: 0s !important;
    }
}

/* Smooth Scroll for Entire Page */
html {
    scroll-behavior: smooth;
}

/* Scroll-triggered fade-in for sections */
.section-block {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.section-block.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== SKELETON LOADERS ========== */

.skeleton-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.skeleton-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(90deg,
            var(--bg-tertiary) 25%,
            rgba(255, 255, 255, 0.1) 50%,
            var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-content {
    padding: 1rem;
}

.skeleton-title {
    height: 20px;
    width: 70%;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-bottom: 0.75rem;
    animation: shimmer 1.5s infinite;
}

.skeleton-text {
    height: 14px;
    width: 100%;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    animation: shimmer 1.5s infinite;
}

.skeleton-text:last-child {
    width: 60%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ========== 3.2 DARK MODE ENHANCEMENTS ========== */

/* Smooth Theme Transition */
html {
    transition: background-color 0.4s ease, color 0.3s ease;
}

body,
.tool-card-v2,
.widget,
.sidebar,
.main-header,
.comparison-wrapper,
.verdict-card {
    transition:
        background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Enhanced Colors */
html.dark {
    --glow-primary: rgba(124, 58, 237, 0.3);
    --glow-secondary: rgba(20, 184, 166, 0.3);
}

html.dark .tool-card-v2 {
    background: linear-gradient(145deg,
            rgba(30, 41, 59, 0.8),
            rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

html.dark .tool-card-v2:hover {
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(124, 58, 237, 0.15);
}

html.dark .badge {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Dark mode skeleton */
html.dark .skeleton-image,
html.dark .skeleton-title,
html.dark .skeleton-text {
    background: linear-gradient(90deg,
            rgba(30, 41, 59, 1) 25%,
            rgba(51, 65, 85, 1) 50%,
            rgba(30, 41, 59, 1) 75%);
    background-size: 200% 100%;
}

/* Theme Toggle Button Enhancement */
.theme-toggle {
    position: relative;
    overflow: hidden;
}

.theme-toggle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.3), transparent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.theme-toggle:active::after {
    width: 200%;
    height: 200%;
}

/* ========== 3.3 TOOL CARDS REDESIGN ========== */

/* Enhanced Rating Display */
.tool-card-v2 .card-rating {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #92400e;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

.tool-card-v2 .card-rating i {
    color: #f59e0b;
    font-size: 0.85rem;
}

.tool-card-v2 .card-rating.muted {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    box-shadow: none;
}

html.dark .tool-card-v2 .card-rating {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.15));
    color: #fbbf24;
}

/* Enhanced Badge Styles */
.badge-new {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    font-size: 0.65rem;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}

.badge-trending {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-trending::before {
    content: '🔥';
    font-size: 0.7rem;
}

.badge-featured {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: white;
    font-weight: 700;
}

.badge-featured::before {
    content: '⭐';
    margin-right: 3px;
    font-size: 0.7rem;
}

/* Review Count Display */
.card-reviews {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.card-reviews i {
    font-size: 0.7rem;
}

/* Enhanced Card Footer */
.tool-card-v2 .card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

/* Verified Badge Enhancement */
.tool-card-v2 .verified-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 0.35rem;
    animation: verifiedPop 0.3s ease;
}

@keyframes verifiedPop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* ========== SCROLL-TRIGGERED ANIMATIONS ========== */

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Stats Counter Animation */
.stat-number {
    display: inline-block;
}

.stat-number.counting {
    animation: countPulse 0.1s ease-in-out;
}

@keyframes countPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}