/**
 * Best Tool Card - Ranked List Styles
 * 12-color cycling border + hover glow per card
 */

/* =========================================================
   CARD BASE
   ========================================================= */

.ranked-list-card {
    position: relative;
    background: var(--glass-bg, rgba(255, 255, 255, 0.03));
    border: 1.5px solid var(--glass-border, rgba(255, 255, 255, 0.08));
    border-radius: 18px;
    overflow: visible;
    /* Required to let absolute badges sit on the border */
    margin-bottom: 40px;
    /* Increased for better spacing between cards */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(8px);
}

/* Base colored border logic using color-mix for subtle integration */
.ranked-list-card {
    border-color: color-mix(in srgb, var(--rc-color, var(--primary)) 15%, var(--glass-border, rgba(255, 255, 255, 0.08)));
}

/* Colored left accent bar derived from rank color class */
.ranked-list-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--rc-color, var(--primary));
    transition: width 0.3s ease;
    z-index: 2;
}

.ranked-list-card:hover::before {
    width: 6px;
}

/* =========================================================
   12-COLOR CYCLING — border accent + hover glow
   ========================================================= */

.ranked-list-card.rc-purple {
    --rc-color: #a855f7;
}

.ranked-list-card.rc-blue {
    --rc-color: #3b82f6;
}

.ranked-list-card.rc-emerald {
    --rc-color: #10b981;
}

.ranked-list-card.rc-amber {
    --rc-color: #f59e0b;
}

.ranked-list-card.rc-pink {
    --rc-color: #ec4899;
}

.ranked-list-card.rc-cyan {
    --rc-color: #06b6d4;
}

.ranked-list-card.rc-orange {
    --rc-color: #f97316;
}

.ranked-list-card.rc-rose {
    --rc-color: #f43f5e;
}

.ranked-list-card.rc-indigo {
    --rc-color: #6366f1;
}

.ranked-list-card.rc-teal {
    --rc-color: #14b8a6;
}

.ranked-list-card.rc-lime {
    --rc-color: #84cc16;
}

.ranked-list-card.rc-red {
    --rc-color: #ef4444;
}

/* Hover: colored border + glow box-shadow + background lift */
.ranked-list-card:hover {
    border-color: var(--rc-color, var(--primary));
    background: color-mix(in srgb, var(--rc-color, var(--primary)) 4%, var(--glass-bg, rgba(255, 255, 255, 0.03)));
    box-shadow:
        0 12px 40px color-mix(in srgb, var(--rc-color, var(--primary)) 15%, transparent),
        0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-4px);
}

/* =========================================================
   ROW 1: Rank + Name | Editorial Badge
   ========================================================= */

.rlc-row-1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 14px 24px;
    /* Removed border-bottom here for cleaner split layout */
    flex-wrap: wrap;
}

.rlc-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.rlc-rank-num {
    font-size: 1.6rem;
    /* Increased from 1.3rem */
    font-weight: 800;
    color: var(--rc-color, var(--primary));
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.rlc-header-logo {
    display: block;
}

.rlc-logo-wrap-sm {
    position: relative;
    width: 42px;
    /* Increased from 32px */
    height: 42px;
    /* Increased from 32px */
    background: #fff;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rlc-logo-wrap-sm img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.rlc-verify-badge-sm {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border-radius: 50%;
    border: 1px solid #fff;
}

.rlc-tool-name {
    font-size: 1.5rem;
    /* Increased from 1.35rem */
    font-weight: 700;
    margin: 0 !important;
    line-height: 1.25;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rlc-tool-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.rlc-tool-name a:hover {
    color: var(--primary);
}

/* =========================================================
   EDITORIAL TOP-CENTER BADGE (Ranks 1-5)
   ========================================================= */

/* Increased spacing for top 5 to avoid badge overlap */
.ranked-item-1 .rlc-row-1,
.ranked-item-2 .rlc-row-1,
.ranked-item-3 .rlc-row-1,
.ranked-item-4 .rlc-row-1,
.ranked-item-5 .rlc-row-1 {
    padding-top: 48px !important;
    /* Extra room for the floating badge */
}

.rlc-editorial-badge-abs {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    background: var(--bg-surface, #1a1a2e);
    border: 1.5px solid var(--border-color, rgba(255, 255, 255, 0.1));
    color: var(--text-muted);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 5;
}

.rlc-editorial-badge-abs svg {
    display: block;
    flex-shrink: 0;
}

/* Color Themes for Absolute Badges */
.ranked-item-1 .rlc-editorial-badge-abs {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    border-color: #7c3aed;
}

.ranked-item-2 .rlc-editorial-badge-abs {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    border-color: #2563eb;
}

.ranked-item-3 .rlc-editorial-badge-abs {
    background: rgba(16, 185, 129, 0.08);
    color: #10b981;
    border: 1.2px solid rgba(16, 185, 129, 0.5);
}

.ranked-item-4 .rlc-editorial-badge-abs {
    background: rgba(245, 158, 11, 0.08);
    color: #f59e0b;
    border: 1.2px solid rgba(245, 158, 11, 0.5);
}

.ranked-item-5 .rlc-editorial-badge-abs {
    background: rgba(236, 72, 153, 0.08);
    color: #ec4899;
    border: 1.2px solid rgba(236, 72, 153, 0.5);
}

.rlc-editorial-badge {
    display: none;
    /* Hide old inline badge */
}

/* =========================================================
   CARD BODY
   ========================================================= */

.rlc-card-body {
    padding: 20px 20px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* =========================================================
   ROW 2: Logo + Inline Content | Right Actions
   ========================================================= */

.rlc-main-split {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
}

.rlc-content-col {
    flex: 1;
    min-width: 0;
    border-right: 1px solid var(--border-color);
}

.rlc-actions-col {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 32px;
    min-width: 280px;
}

/* Remove Row 1 Border Bottom for inner grouping */
.rlc-content-col .rlc-row-1 {
    border-bottom: 1px solid var(--border-color);
}

.rlc-row-2 {
    display: block;
    /* No longer a grid of its own */
    padding: 0;
}

.rlc-row-2-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

/* Old big logo styles removed from row 2 as it's now in the header */
.rlc-logo-link,
.rlc-logo-wrap {
    display: none;
}

/* Inline content: tagline + tags */
.rlc-inline-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.rlc-tagline {
    font-size: 0.82rem;
    /* Sync with premium card */
    color: var(--text-muted);
    /* Sync with premium card */
    font-weight: 500;
    line-height: 1.45;
    margin: 0;
}

.rlc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rlc-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(var(--primary-rgb), 0.07);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    text-decoration: none;
    transition: background 0.2s ease;
}

.rlc-tag:hover {
    background: rgba(var(--primary-rgb), 0.14);
}

/* Right side: pricing + button */
.rlc-row-2-right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-width: 240px;
    max-width: 280px;
}

.rlc-pricing-badge {
    display: block;
    text-align: center;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* Badge Color Variants */
.badge-free {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-freemium {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-paid {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-deals {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-neutral {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.2);
}

.rlc-visit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 18px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
    background: var(--rc-color, var(--primary));
    color: #ffffff !important;
    /* Force white text for visibility in all skins */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rlc-visit-btn:hover {
    background: color-mix(in srgb, var(--rc-color, var(--primary)) 88%, #000);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px color-mix(in srgb, var(--rc-color, var(--primary)) 40%, transparent);
    color: #ffffff !important;
}

[data-theme="light"] .rlc-visit-btn {
    box-shadow: 0 2px 8px color-mix(in srgb, var(--rc-color, var(--primary)) 20%, transparent);
}

/* =========================================================
   ROW 3: Key Features Toggle
   ========================================================= */

.rlc-footer-area {
    background: rgba(0, 0, 0, 0.02);
    /* Subtle tint for contrast */
    border-top: 1px solid var(--border-color);
}

[data-theme="dark"] .rlc-footer-area {
    background: rgba(255, 255, 255, 0.02);
}

.rlc-row-3 {
    margin: 0;
    padding: 0 24px;
    /* Align with content col padding */
}

@media (max-width: 768px) {
    .rlc-row-3 {
        padding: 0 20px;
    }
}

.rlc-features-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    padding: 12px 0;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s ease;
    text-align: left;
}

.rlc-features-toggle:hover {
    color: var(--primary);
}

.rlc-features-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-color);
}

.rlc-features-label svg {
    color: var(--rc-color, var(--primary));
    opacity: 0.8;
}

.rlc-features-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.rlc-features-toggle[aria-expanded="true"] .rlc-features-arrow {
    transform: rotate(180deg);
    color: var(--primary);
}

.rlc-features-toggle[aria-expanded="true"] {
    color: var(--primary);
}

.rlc-features-panel {
    padding-bottom: 16px;
}

.rlc-features-panel[hidden] {
    display: none;
}

.rlc-features-list {
    margin: 0;
    padding: 0 0 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    list-style: none;
    /* Remove default bullets */
}

.rlc-features-list li {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.4;
    position: relative;
    padding-left: 24px;
    display: flex;
    align-items: flex-start;
}

/* Custom Checkmark Icons for List Items */
.rlc-features-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    width: 14px;
    height: 14px;
    background-color: var(--rc-color, var(--primary));
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>') no-repeat center;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>') no-repeat center;
    mask-size: contain;
    opacity: 0.9;
}

/* =========================================================
   MOBILE — Use premium card stacked layout
   ========================================================= */

@media (max-width: 768px) {

    .ranked-list-card {
        margin-bottom: 50px;
        /* More space for badges on mobile */
        border-radius: 16px;
    }

    /* Increased spacing for top 5 badges on mobile */
    .ranked-item-1 .rlc-row-1,
    .ranked-item-2 .rlc-row-1,
    .ranked-item-3 .rlc-row-1,
    .ranked-item-4 .rlc-row-1,
    .ranked-item-5 .rlc-row-1 {
        padding-top: 54px !important;
    }

    /* ROW 1: allow wrap on mobile */
    .rlc-row-1 {
        padding: 14px 16px 12px 20px;
        gap: 8px;
    }

    .rlc-rank-num {
        font-size: 1.5rem;
        /* Increased from 1.4rem */
    }

    .rlc-tool-name {
        font-size: 1.35rem;
        /* Increased from 1.3rem */
        white-space: normal;
        line-height: 1.2;
    }

    .rlc-logo-wrap-sm {
        width: 40px;
        /* Increased from 38px */
        height: 40px;
        /* Increased from 38px */
    }

    /* Mobile Header: #1 + Tool Name + Logo */
    .rlc-header-logo {
        display: block;
    }

    .rlc-title-group {
        gap: 8px;
        flex-wrap: nowrap;
        /* Keep on one line */
    }

    /* ROW 2: Layout requested structure */
    .rlc-row-2 {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    /* Row 2 left: contains desktop logo, tagline, tags */
    .rlc-row-2-left {
        flex-direction: column;
        align-items: flex-start;
        /* LEFT ALIGNED */
        text-align: left;
        gap: 12px;
    }

    /* Hide the large desktop logo wrap on mobile since we have the small one in title */
    .rlc-row-2-left .rlc-logo-link {
        display: none !important;
    }

    .rlc-inline-content {
        align-items: flex-start;
        /* LEFT ALIGNED */
        width: 100%;
    }

    .rlc-tagline {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-bottom: 4px;
    }

    .rlc-tag {
        font-size: 0.7rem;
        /* Reduced for better mobile fit */
        padding: 2px 8px;
    }

    .rlc-tags {
        justify-content: flex-start;
        /* LEFT ALIGNED */
    }

    /* Row 2 right: Pricing + Button (CENTERED FULL WIDTH) */
    .rlc-row-2-right {
        max-width: 100%;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        /* CENTERED */
        gap: 12px;
        background: rgba(255, 255, 255, 0.02);
        padding: 15px;
        border-radius: 12px;
        border: 1px solid var(--border-color);
    }

    .rlc-pricing-badge {
        width: 100%;
        justify-content: center;
        text-align: center;
        min-width: unset;
        max-width: unset;
    }

    .rlc-visit-btn {
        width: 100%;
        justify-content: center;
    }

    .rlc-main-split {
        flex-direction: column;
    }

    .rlc-content-col {
        border-right: none;
    }

    .rlc-actions-col {
        padding: 0;
        min-width: unset;
    }

    .rlc-card-body {
        padding: 16px 20px 20px 20px;
    }
}

@media (max-width: 480px) {
    .rlc-logo-wrap {
        width: 60px;
        height: 60px;
    }
}