/* Tool page alternatives — cards, compare modal, finder cross-link */

.tool-alternatives {
    margin-top: 0;
    scroll-margin-top: 88px;
}

.tool-alternatives .section-title {
    margin-bottom: 12px;
}

.tool-alternatives-intro,
.tool-alternatives-intro-sub {
    margin: 0 auto;
    max-width: 40rem;
    text-align: center;
    color: #5f6d7a;
    font-size: 1rem;
    line-height: 1.65;
}

.tool-alternatives-intro-sub {
    margin-bottom: 24px;
    font-size: 0.95rem;
    color: #6c757d;
}

.tool-alternatives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 8px;
}

.tool-alternatives .alt-tool-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e3e8ef;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tool-alternatives .alt-tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.1);
}

.tool-alternatives .alt-tool-card h3 {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.35;
}

.tool-alternatives .alt-tool-card h3 a {
    color: #667eea;
    text-decoration: none;
}

.tool-alternatives .alt-tool-card h3 a:hover {
    color: #764ba2;
}

.tool-alternatives .alt-tool-card-copy {
    margin: 0;
    color: #6c757d;
    font-size: 0.92rem;
    line-height: 1.55;
    flex: 1;
}

.tool-alternatives .alt-tool-type {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f1f3f8;
    color: #5f6d7a;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.tool-alternatives .alt-scores-panel {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f9fc 0%, #f2f5fb 100%);
    border: 1px solid #e8edf5;
}

.tool-alternatives .alt-overall-block {
    display: grid;
    gap: 8px;
}

.tool-alternatives .alt-overall-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.tool-alternatives .alt-overall-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #7a8794;
    white-space: nowrap;
}

.tool-alternatives .alt-overall-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #2c3e50;
    line-height: 1;
}

.tool-alternatives .alt-overall-delta {
    display: inline-block;
    width: fit-content;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    line-height: 1.3;
}

.tool-alternatives .alt-overall-delta.positive {
    color: #1f7a45;
    background: rgba(40, 167, 69, 0.12);
}

.tool-alternatives .alt-overall-delta.negative {
    color: #9a6700;
    background: rgba(240, 173, 78, 0.15);
}

.tool-alternatives .alt-overall-delta.neutral {
    color: #6c757d;
    background: rgba(108, 117, 125, 0.12);
}

.tool-alternatives .alt-factor-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.tool-alternatives .alt-factor-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e8edf5;
    text-align: left;
}

.tool-alternatives .alt-factor-label {
    display: block;
    flex: 1 1 auto;
    font-size: 0.84rem;
    font-weight: 600;
    color: #4f5d6b;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.3;
    word-break: normal;
}

.tool-alternatives .alt-factor-value {
    display: block;
    flex: 0 0 auto;
    font-size: 1rem;
    font-weight: 800;
    color: #2c3e50;
    line-height: 1;
}

.tool-alternatives .alt-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tool-alternatives .alt-compare-btn,
.tool-alternatives .alt-review-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.tool-alternatives .alt-compare-btn {
    flex: 1 1 140px;
    background: #667eea;
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.tool-alternatives .alt-compare-btn:hover {
    background: #5a6fd6;
}

.tool-alternatives .alt-review-link {
    flex: 1 1 120px;
    background: #fff;
    color: #667eea;
    border: 1px solid #d7def0;
}

.tool-alternatives .alt-review-link:hover {
    background: #f7f8ff;
}

.tool-alternatives-finder {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px dashed #dde3ec;
    text-align: center;
    color: #6c757d;
    font-size: 0.92rem;
    line-height: 1.55;
}

.tool-alternatives-finder a {
    color: #667eea;
    font-weight: 700;
    text-decoration: none;
}

.tool-alternatives-finder a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.tool-alternatives-loading,
.tool-alternatives-empty {
    padding: 24px;
    text-align: center;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px dashed #dee2e6;
}

/* Slim inline finder after performance */
.ai-finder-inline {
    margin: 14px 0 4px;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.55;
    color: #6c757d;
}

.ai-finder-inline-link {
    color: #667eea;
    font-weight: 700;
    text-decoration: none;
}

.ai-finder-inline-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Compare modal */
.alt-compare-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 12000;
    background: rgba(15, 23, 42, 0.62);
    padding: 20px;
    overflow-y: auto;
}

.alt-compare-modal.is-open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.alt-compare-dialog {
    width: min(760px, 100%);
    margin: 4vh auto;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.alt-compare-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.alt-compare-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.alt-compare-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.alt-compare-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.alt-compare-body {
    padding: 0;
    overflow-x: auto;
}

.alt-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.alt-compare-table th,
.alt-compare-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #edf0f5;
    text-align: center;
}

.alt-compare-table th:first-child,
.alt-compare-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: #4f5d6b;
    width: 42%;
}

.alt-compare-table thead th {
    background: #f8f9fc;
    color: #2c3e50;
    font-weight: 700;
}

.alt-compare-table tbody tr:last-child td {
    border-bottom: none;
}

.alt-compare-table .row-overall td {
    background: #f4f7ff;
    font-weight: 700;
}

.alt-compare-table .score-better {
    color: #1f7a45;
    font-weight: 700;
}

.alt-compare-table .score-worse {
    color: #9a6700;
}

.alt-compare-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px 20px;
    border-top: 1px solid #edf0f5;
}

.alt-compare-footer a,
.alt-compare-footer button {
    min-height: 40px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: none;
}

.alt-compare-footer button {
    background: #eef1f8;
    color: #4f5d6b;
}

.alt-compare-footer a {
    background: #667eea;
    color: #fff;
}

@media (max-width: 768px) {
    .tool-alternatives .alt-card-actions {
        flex-direction: row;
        gap: 8px;
    }

    .tool-alternatives .alt-compare-btn,
    .tool-alternatives .alt-review-link {
        flex: 1 1 0;
        min-height: 34px;
        padding: 7px 10px;
        font-size: 0.8rem;
        font-weight: 600;
        border-radius: 7px;
    }

    .tool-alternatives .alt-compare-btn {
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    }

    .alt-compare-modal {
        padding: 10px;
    }

    .alt-compare-header h2 {
        font-size: 1.05rem;
    }
}
