/**
 * Best Tool Card - Premium Grid Styles (Updated)
 */

/* =========================================================
   GRID LAYOUT
   ========================================================= */

.premium-desktop-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .premium-desktop-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
        row-gap: 60px;
        /* Crucial for absolute badges not to overlap cards above */
    }
}

@media (max-width: 768px) {
    .premium-desktop-grid {
        grid-template-columns: 1fr;
        gap: 60px;
        /* Generous gap for absolute badges */
    }
}

/* =========================================================
   CARD BASE
   ========================================================= */

.premium-rank-card {
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 18px;
    padding-top: 22px;
    /* Reduced from 36px to bring logo closer to badge */
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s ease, border-color 0.4s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow: visible;
}

.premium-rank-card:hover {
    transform: translateY(-8px) scale(1.02);
}

/* =========================================================
   EDITORIAL TOP-CENTER BADGE
   ========================================================= */

.prc-editorial-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.68rem;
    /* Reduced from 0.72rem */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    color: var(--text-muted);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.prc-editorial-badge svg {
    display: block;
    flex-shrink: 0;
}

/* Rank-specific badge colors */
.premium-rank-card.glow-purple .prc-editorial-badge {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    border-color: #7c3aed;
}

.premium-rank-card.glow-blue .prc-editorial-badge {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    border-color: #2563eb;
}

.premium-rank-card.glow-emerald .prc-editorial-badge {
    background: rgba(16, 185, 129, 0.08);
    /* Light tint */
    color: #10b981;
    border: 1.2px solid rgba(16, 185, 129, 0.5);
    /* Discrete border line */
}

.premium-rank-card.glow-amber .prc-editorial-badge {
    background: rgba(245, 158, 11, 0.08);
    color: #f59e0b;
    border: 1.2px solid rgba(245, 158, 11, 0.5);
}

.premium-rank-card.glow-pink .prc-editorial-badge {
    background: rgba(236, 72, 153, 0.08);
    color: #ec4899;
    border: 1.2px solid rgba(236, 72, 153, 0.5);
}

/* =========================================================
   PER-RANK HOVER GLOW
   ========================================================= */

.premium-rank-card.glow-purple:hover {
    border-color: #a855f7;
    box-shadow: 0 12px 40px rgba(168, 85, 247, 0.32);
}

.premium-rank-card.glow-blue:hover {
    border-color: #3b82f6;
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.32);
}

.premium-rank-card.glow-emerald:hover {
    border-color: #10b981;
    box-shadow: 0 12px 40px rgba(16, 185, 129, 0.32);
}

.premium-rank-card.glow-amber:hover {
    border-color: #f59e0b;
    box-shadow: 0 12px 40px rgba(245, 158, 11, 0.32);
}

.premium-rank-card.glow-pink:hover {
    border-color: #ec4899;
    box-shadow: 0 12px 40px rgba(236, 72, 153, 0.32);
}

/* =========================================================
   CARD BODY
   ========================================================= */

.prc-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 12px 20px 20px;
    /* Reduced top padding from 24px */
    flex: 1;
}

.prc-row {
    width: 100%;
}

/* ROW 1: Logo + Name */
.prc-row-1 {
    display: flex;
    align-items: center;
    gap: 10px;
    /* Reduced from 12px */
}

/* Desktop Redesign: Center Logo & Name, Stacking them vertically */
@media (min-width: 769px) {
    .prc-row-1 {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        margin-bottom: 5px;
    }
}

.prc-logo-link {
    text-decoration: none;
    display: block;
    flex-shrink: 0;
}

.prc-logo-wrap {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    /* Slightly adjusted for better centering balance */
    height: 48px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    padding: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

@media (min-width: 769px) {
    .prc-logo-wrap {
        margin: 0 auto;
        /* Center logo link */
    }
}

[data-theme="dark"] .prc-logo-wrap {
    background: #1a1a2e;
}

.prc-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Verify badge — TOP-RIGHT absolute inside logo wrap */
.prc-verify-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 14px;
    /* Reduced from 16px */
    height: 14px;
    /* Reduced from 16px */
    background: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border: 1.5px solid var(--card-bg);
}

.prc-tool-name {
    font-size: 0.95rem;
    /* Reduced from 1rem */
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    flex: 1;
    letter-spacing: -0.2px;
}

@media (min-width: 769px) {
    .prc-tool-name {
        text-align: center;
        width: 100%;
    }
}

.prc-tool-name a {
    color: var(--text-color);
    text-decoration: none;
}

.prc-tool-name a:hover {
    color: var(--primary);
}

/* ROW 2: Tagline — 2-line clamp */
.prc-tagline {
    font-size: 0.82rem;
    /* Reduced from 0.85rem */
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.9em;
    text-align: left;
    /* 3rd row left side per request */
}

/* ROW 3: Pricing Badge — FULL WIDTH, dynamic color */
.prc-pricing-badge {
    display: block;
    width: 100%;
    text-align: center;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.72rem;
    /* Reduced from 0.78rem */
    font-weight: 700;
    box-sizing: border-box;
}

/* Share pricing variants logic across all cards or define specifically here */
.prc-pricing-badge.badge-free {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.prc-pricing-badge.badge-freemium {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.prc-pricing-badge.badge-paid {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.prc-pricing-badge.badge-deals {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.prc-pricing-badge.badge-neutral {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.2);
}

[data-theme="dark"] .prc-pricing-badge.badge-free {
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}

/* ROW 4: Visit Button — full width, pushed to bottom */
.prc-row-4 {
    margin-top: auto;
}

.prc-visit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 9px 16px;
    font-size: 0.82rem;
    /* Reduced from 0.85rem */
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    background: var(--primary);
    color: #ffffff !important;
    /* Force white text for visibility in all modes */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.prc-visit-btn:hover {
    background: color-mix(in srgb, var(--primary) 85%, #000);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.35);
    color: #ffffff !important;
}

[data-theme="light"] .prc-visit-btn {
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.15);
}

/* =========================================================
   MOBILE — increased card padding
   ========================================================= */

@media (max-width: 768px) {
    .premium-rank-card {
        padding-top: 20px;
        /* Enhanced vertical clearance */
    }

    .prc-body {
        padding: 24px 20px 20px;
        gap: 16px;
    }

    .prc-logo-wrap {
        width: 48px;
        height: 48px;
    }

    .prc-pricing-badge {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .prc-visit-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}

/* Disclosure text */
.premium-grid-disclosure {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 24px;
    padding: 8px 16px;
    opacity: 0.8;
}