/**
 * Competitor Comparison Table
 * Themed to match the Munafah pricing cards (glass surface + primary gradient).
 */

.comparison-section {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4rem 1rem 5rem;
    z-index: 10;
}

.comparison-title {
    font-family: var(--font-primary);
    font-size: clamp(1.4rem, 3.5vw, 2.6rem);
    color: var(--text-color);
    text-align: center;
    margin: 0 0 0.75rem;
}

.comparison-subtitle {
    font-family: var(--font-secondary);
    font-size: clamp(0.85rem, 1.6vw, 1rem);
    color: var(--secondary-text-color);
    text-align: center;
    max-width: 720px;
    margin: 0 auto 2.5rem;
    line-height: 1.6;
}

/* Mount point / scroll container ------------------------------------- */

#comparison-table-mount {
    width: 100%;
    max-width: 1400px;
}

.cmp-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    border-radius: 18px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-overflow-scrolling: touch;
}

.cmp-scroll:focus-visible {
    outline: 2px solid #4a76ef;
    outline-offset: 3px;
}

.cmp-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-secondary);
    font-size: 0.85rem;
    color: var(--text-color);
}

/* Vendor header row --------------------------------------------------- */

.cmp-row-vendor th {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 1.1rem 0.85rem 1rem;
    text-align: center;
    vertical-align: top;
    background: var(--feature-details-bg);
    border-bottom: 1px solid var(--card-border);
    min-width: 132px;
}

.cmp-th-feature {
    position: sticky;
    left: 0;
    z-index: 4 !important;
    min-width: 240px;
    width: 240px;
}

/* The Munafah column is the hero: gradient top rule + lifted surface. */
.cmp-th-ours {
    position: relative;
    background:
        linear-gradient(180deg, rgba(74, 118, 239, 0.18), rgba(74, 118, 239, 0.04)),
        var(--feature-details-bg);
}

.cmp-th-ours::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

.cmp-vendor {
    font-family: var(--font-primary);
    font-size: 0.9rem;
    line-height: 1.3;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.cmp-th-ours .cmp-vendor {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.cmp-plan {
    font-size: 0.68rem;
    color: var(--secondary-text-color);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}

.cmp-price {
    font-family: var(--font-primary);
    font-size: 1.05rem;
    line-height: 1.2;
    color: var(--text-color);
    white-space: nowrap;
}

.cmp-price-ours {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.cmp-price-crossed {
    font-size: 0.72rem;
    color: var(--secondary-text-color);
    text-decoration: line-through;
    -webkit-text-fill-color: var(--secondary-text-color);
}

.cmp-price-sub {
    font-size: 0.62rem;
    color: var(--secondary-text-color);
    margin-top: 0.2rem;
    line-height: 1.35;
}

.cmp-price-note {
    font-size: 0.6rem;
    color: var(--secondary-text-color);
    opacity: 0.8;
    margin-top: 0.4rem;
    line-height: 1.35;
    white-space: normal;
}

.cmp-price-onetime {
    font-size: 0.95rem;
}

/* Category rows ------------------------------------------------------- */

.cmp-category {
    position: sticky;
    left: 0;
    text-align: left;
    font-family: var(--font-primary);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.85rem 1rem 0.75rem;
    color: var(--text-color);
    background: linear-gradient(90deg, rgba(74, 118, 239, 0.16), rgba(74, 118, 239, 0));
    border-top: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
}

/* Feature rows -------------------------------------------------------- */

.cmp-feature {
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: left;
    font-weight: 400;
    padding: 0.7rem 1rem;
    color: var(--text-color);
    background: var(--feature-details-bg);
    border-bottom: 1px solid var(--card-border);
    line-height: 1.45;
}

.cmp-row:hover .cmp-feature,
.cmp-row:hover .cmp-cell {
    background: rgba(74, 118, 239, 0.08);
}

.cmp-cell {
    padding: 0.7rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid var(--card-border);
    vertical-align: middle;
}

/* Keep the Munafah column visually distinct all the way down. */
.cmp-cell-ours {
    background: rgba(74, 118, 239, 0.07);
    box-shadow: inset 1px 0 0 rgba(74, 118, 239, 0.25),
        inset -1px 0 0 rgba(74, 118, 239, 0.25);
}

.cmp-row:hover .cmp-cell-ours {
    background: rgba(74, 118, 239, 0.14);
}

/* Marks and tags ------------------------------------------------------ */

.cmp-mark {
    display: inline-block;
    font-size: 1rem;
    line-height: 1;
}

.cmp-yes {
    color: #2fc98a;
}

.cmp-cell-ours .cmp-yes {
    color: #4a76ef;
    text-shadow: 0 0 12px rgba(74, 118, 239, 0.45);
}

.cmp-no {
    /* Slightly deeper red in light theme so the mark keeps contrast on white. */
    color: #ff5a5f;
    font-size: 0.9rem;
}

[data-theme="light"] .cmp-no {
    color: #e03236;
}

.cmp-tag {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.cmp-addon {
    background: linear-gradient(90deg, #ffaa00, #ff8800);
    color: #000;
}

.cmp-planned {
    background: linear-gradient(90deg, #5603fc, #8E2DE2);
    color: #fff;
}

/* Legend -------------------------------------------------------------- */

.cmp-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 1.25rem;
    font-family: var(--font-secondary);
    font-size: 0.72rem;
    color: var(--secondary-text-color);
}

.cmp-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.comparison-footnote {
    max-width: 1000px;
    margin: 1.25rem auto 0;
    font-family: var(--font-secondary);
    font-size: 0.68rem;
    line-height: 1.6;
    color: var(--secondary-text-color);
    text-align: center;
    opacity: 0.85;
}

/* Screen-reader-only helper ------------------------------------------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive ---------------------------------------------------------- */

@media (max-width: 900px) {
    .cmp-table {
        font-size: 0.78rem;
    }

    .cmp-th-feature {
        min-width: 180px;
        width: 180px;
    }

    .cmp-row-vendor th {
        min-width: 116px;
        padding: 0.9rem 0.6rem;
    }

    .cmp-price-note {
        display: none;
    }
}

@media (max-width: 600px) {
    .comparison-section {
        padding: 3rem 0.5rem 4rem;
    }

    .cmp-table {
        font-size: 0.72rem;
    }

    .cmp-th-feature {
        min-width: 150px;
        width: 150px;
    }

    .cmp-feature {
        padding: 0.6rem 0.7rem;
    }

    .cmp-row-vendor th {
        min-width: 104px;
    }

    .cmp-vendor {
        font-size: 0.76rem;
    }

    .cmp-price {
        font-size: 0.9rem;
    }
}
