/* Tool Card Minimal - Clean Aesthetic */

.tool-card-minimal {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    overflow: hidden;
    height: 100%;
    /* Fill container height */
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    /* Visible Grey Border */
}

/* Performance Optimization: Content Visibility */
.content-lazy {
    content-visibility: auto;
    contain-intrinsic-size: 1000px;
}

/* Hover State (Desktop) */
.tool-card-minimal:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.12);
    z-index: 10;
}

/* =========================================
   Image Section
   ========================================= */
.tool-card-minimal .card-image-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    /* Slightly taller for impact */
    background: #f3f4f6;
    overflow: hidden;
    cursor: pointer;
}

.tool-card-minimal .card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.tool-card-minimal:hover .card-image-wrapper img {
    transform: scale(1.05);
}

/* Primary Badge (Top Left) */
.tool-card-minimal .primary-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 8px;
    color: #111;
    z-index: 5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    pointer-events: none;
}

/* Glassy Trending Icon */
/* Glassy Trending Icon */
.tool-card-minimal .primary-badge.badge-trending-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    /* Higher opacity for better contrast */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    /* More subtle shadow */
}

/* Gradient Icon Style */
.tool-card-minimal .primary-badge.badge-trending-icon i {
    background: linear-gradient(135deg, #fbbf24, #ef4444);
    /* Yellow/Orange to Red */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.2));
}

/* Badge Variants */
.tool-card-minimal .primary-badge.badge-featured {
    border-left: 3px solid #f59e0b;
    color: #b45309;
}

.tool-card-minimal .primary-badge.badge-trending {
    border-left: 3px solid #ef4444;
    color: #b91c1c;
}

.tool-card-minimal .primary-badge.badge-new {
    border-left: 3px solid #10b981;
    color: #047857;
}

.tool-card-minimal .primary-badge.badge-top {
    border-left: 3px solid #6366f1;
    color: #4338ca;
}

/* Hover Actions (Top Right) */
.tool-card-minimal .hover-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex !important;
    /* Force flex display to show all buttons */
    flex-direction: row !important;
    /* Force Side-by-Side */
    align-items: center !important;
    gap: 8px !important;
    width: auto !important;
    height: auto !important;
    opacity: 0;
    /* Hidden by default */
    transform: translateY(-8px);
    transition: all 0.25s ease;
    z-index: 20;
}

/* Force buttons to be relative and not overlap */
.tool-card-minimal .action-btn {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    transform: none;
    /* Let hover effect handle transform */
}

/* Restore hover effect for buttons */
.tool-card-minimal .action-btn:hover {
    transform: scale(1.1) !important;
    z-index: 5;
    /* Ensure hovered item is on top */
}

.tool-card-minimal:hover .hover-actions {
    opacity: 1;
    transform: translateY(0);
}

.tool-card-minimal .action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    color: #4b5563;
    display: flex;
    /* Flex is critical */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;

    /* Strict overrides for favorites.css conflict */
    position: relative !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    margin: 0 !important;
    top: auto !important;
    right: auto !important;
}

.tool-card-minimal .action-btn:hover {
    transform: scale(1.1);
    color: #111;
    background: #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.tool-card-minimal .action-btn.heart-btn:hover {
    color: #ef4444;
}

.tool-card-minimal .action-btn.compare-btn:hover {
    color: #3b82f6;
}

/* Remove any pseudo-elements that might add text */
.tool-card-minimal .action-btn::before,
.tool-card-minimal .action-btn::after {
    content: none !important;
    display: none !important;
}

/* =========================================
   Content Section & Layout
   ========================================= */
.tool-card-minimal {
    /* STRICT FIXED HEIGHT - Desktop */
    height: 380px !important;
    display: flex;
    flex-direction: column;
}

.tool-card-minimal .card-content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    /* Ensure footer stays at bottom */
    justify-content: space-between;
    min-height: 0;
    /* Text truncation help */
}

.tool-card-minimal .content-top {
    margin-bottom: 8px;
}

/* Header */
.tool-card-minimal .card-header {
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    /* Align top */
    justify-content: space-between;
    gap: 8px;
}

.tool-card-minimal .card-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #111827;
    margin: 0;
    cursor: pointer;
    line-height: normal;
    transition: color 0.2s;

    /* Flex layout for name + badge */
    display: flex;
    align-items: center;
    min-width: 0;
    /* Allow shrinking in flex container */
    flex: 1;
    /* Take available header space */
}

.tool-card-minimal .tool-name-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.tool-card-minimal .verified-badge-icon {
    flex-shrink: 0;
    /* Prevent badge from squishing */
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    color: #3b82f6;
    font-size: 0.9rem;
}

.tool-card-minimal .card-title:hover {
    color: #4338ca;
}

/* DESKTOP RATING - Far Right */
.tool-card-minimal .desktop-rating {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #374151;
    background: #f9fafb;
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
    /* Align visually with text */
    border: 1px solid #f3f4f6;
}

.tool-card-minimal .desktop-rating .text-warning {
    font-size: 0.8rem;
    color: #f59e0b;
}

.tool-card-minimal .desktop-rating .rating-count {
    font-size: 0.75rem;
    color: #9ca3af;
    font-weight: 500;
    margin-left: 2px;
}

/* Hide Mobile Rating on Desktop */
.tool-card-minimal .mobile-rating {
    display: none !important;
}

/* Verified Badge Icon */
.tool-card-minimal .verified-badge-icon {
    color: #3b82f6;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
}

/* Meta Info */
.tool-card-minimal .meta-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
    margin-top: 4px;
}

.tool-card-minimal .meta-separator {
    color: #d1d5db;
    font-size: 0.6rem;
}

.tool-card-minimal .meta-item.pricing {
    color: #4b5563;
    font-weight: 600;
}

.tool-card-minimal .meta-item.pricing.free {
    color: #16a34a;
}

.tool-card-minimal .meta-item.pricing.freemium {
    color: #d97706;
}

/* =========================================
   Footer Section (Desktop)
   ========================================= */
.tool-card-minimal .card-footer {
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
    margin-top: auto;
    width: 100%;
}

.tool-card-minimal .footer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 8px;
}

/* Button Styles */
.tool-card-minimal .btn-details,
.tool-card-minimal .btn-visit {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 0;
    flex: 1;
    /* Equal width */
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Try Now (Left) */
.tool-card-minimal .btn-visit {
    background: #111827;
    color: #ffffff;
    border: 1px solid #111827;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tool-card-minimal .btn-visit:hover {
    background: #000000;
    border-color: #000000;
    transform: translateY(-2px);
}

/* Details (Right) */
.tool-card-minimal .btn-details {
    color: #4b5563;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.tool-card-minimal .btn-details:hover {
    color: #111;
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-2px);
}


/* =========================================
   Dark Mode Support
   ========================================= */
html.dark .tool-card-minimal {
    background: #1f2937;
    border-color: #374151;
}

html.dark .card-image-wrapper {
    background: #111827;
}

html.dark .tool-card-minimal .card-title {
    color: #f3f4f6;
}

html.dark .tool-card-minimal .desktop-rating,
html.dark .tool-card-minimal .mobile-rating {
    background: #374151;
    color: #e5e7eb;
    border-color: #4b5563;
}

html.dark .tool-card-minimal .meta-info {
    color: #9ca3af;
}

html.dark .tool-card-minimal .card-footer {
    border-color: #374151;
}

html.dark .tool-card-minimal .btn-visit {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
}

html.dark .tool-card-minimal .btn-visit:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

html.dark .tool-card-minimal .btn-details {
    color: #d1d5db;
    background: #374151;
    border-color: #4b5563;
}

html.dark .tool-card-minimal .btn-details:hover {
    background: #4b5563;
    color: #fff;
    border-color: #6b7280;
}


/* =========================================
   Mobile Optimizations (Strict Layout)
   ========================================= */
@media (max-width: 768px) {
    .tool-card-minimal {
        /* STRICT FIXED HEIGHT - Mobile */
        height: 160px !important;
        flex-direction: row;
        align-items: stretch;
        margin-bottom: 20px !important;
    }

    /* Image Right */
    .tool-card-minimal .card-image-wrapper {
        order: 2;
        width: 120px;
        height: auto;
        flex-shrink: 0;
        border-radius: 0;
    }

    .tool-card-minimal .card-image-wrapper img {
        height: 100%;
        object-fit: cover;
    }

    /* Content Left */
    .tool-card-minimal .card-content {
        order: 1;
        flex: 1;
        padding: 12px;
        justify-content: space-between;
    }

    .tool-card-minimal .card-header {
        margin-bottom: 4px;
        display: block;
        /* Stack title */
    }

    .tool-card-minimal .card-title {
        font-size: 0.95rem;
        -webkit-line-clamp: 2;
        /* Limit title lines */
        margin-bottom: 4px;
    }

    /* Hide Desktop Rating on Mobile */
    .tool-card-minimal .desktop-rating {
        display: none !important;
    }

    /* Show Mobile Rating */
    /* Show Mobile Rating with Pill Style */
    .tool-card-minimal .mobile-rating {
        display: flex !important;
        align-items: center;
        gap: 4px;
        font-size: 0.75rem;
        background: #f3f4f6;
        border: 1px solid #e5e7eb;
        padding: 4px 8px;
        border-radius: 6px;
        margin: 0;
        margin-left: auto;
        /* Push to right */
        color: #4b5563;
        flex-shrink: 0;
        font-weight: 600;
    }

    .tool-card-minimal .mobile-rating .text-warning {
        font-size: 0.7rem;
        color: #f59e0b;
    }

    .tool-card-minimal .mobile-rating .rating-count {
        display: inline-block !important;
        /* Unhide count */
        color: #9ca3af;
        font-size: 0.7rem;
        font-weight: 500;
    }

    /* Dark Mode Mobile Rating Override */
    html.dark .tool-card-minimal .mobile-rating {
        background: rgba(255, 255, 255, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        color: #e5e7eb !important;
    }

    html.dark .tool-card-minimal .mobile-rating .rating-count {
        color: #9ca3af !important;
    }

    .tool-card-minimal .meta-info {
        font-size: 0.75rem;
        margin-top: 0;
    }

    /* Mobile Footer Layout */
    .tool-card-minimal .card-footer {
        padding-top: 8px;
        margin-top: 4px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        /* Spread items */
        gap: 6px;
    }

    .tool-card-minimal .footer-actions {
        /* On mobile, we might hide 'Details' button or make them smaller */
        /* Request: "down next to try now lock in the right side" */
        /* Let's keep both buttons but compact */
        flex: 1;
        justify-content: flex-start;
        gap: 6px;
    }

    .tool-card-minimal .btn-visit,
    .tool-card-minimal .btn-details {
        padding: 4px 8px;
        font-size: 0.7rem;
        height: 28px;
        width: auto;
        flex: initial;
        /* Don't stretch */
    }

    /* Re-order footer items if needed to put rating on right */
    /* Structure is: [Mobile Rating] [Actions: TryNow, Details] */
    /* User wants: Rating next to Try Now in the RIGHT SIDE */
    /* So: [Details] [Try Now] [Rating] ?? */
    /* Or: [Try Now] [Rating] */

    /* Let's try matching the image: Usually Rating Left, Buttons Right. */
    /* User said: "In mobile version bring it down next to try now lock in the right side" */
    /* Interpreting as: The Try Now button is on the Right, and Rating is next to it. */

    /* New Layout for Footer Mobile: */
    .tool-card-minimal .card-footer {
        flex-wrap: wrap;
    }

    .tool-card-minimal .footer-actions {
        order: 1;
        /* Actions first? No, let's keep standard flow */
        flex: 1;
    }

    .tool-card-minimal .mobile-rating {
        order: 2;
        /* Rating on the right */
        margin-left: auto;
        /* Push to right */
    }
}

/* =========================================
   Review & Compare Button Override (Fix for JS Injection)
   ========================================= */
/* Force hidden text on action buttons to prevent 'Compare' appearing due to JS */
.tool-card-minimal .action-btn {
    font-size: 0 !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden !important;
    padding: 0 !important;
}

/* Hide the span injected by JS */
.tool-card-minimal .action-btn span {
    display: none !important;
}

.tool-card-minimal .action-btn i {
    font-size: 14px !important;
    margin: 0 !important;
}

/* Active State for Heart Button (Red when bookmarked) */
.tool-card-minimal .action-btn.active,
.tool-card-minimal .action-btn.bookmark-btn.active {
    color: #ef4444 !important;
    background: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.tool-card-minimal .action-btn.active i,
.tool-card-minimal .action-btn.bookmark-btn.active i {
    color: #ef4444 !important;
    font-weight: 900;
    /* Solid style for FontAwesome */
}