/* =============================================
   Tables CSS — Sticky Headers + CTA Buttons
   ============================================= */

/* ---- Sticky Table Header ---- */
.has-sticky-header {
    width: 100%;
    border-collapse: collapse;
}

.has-sticky-header thead {
    position: sticky;
    top: 80px;
    z-index: 10;
    background: #f8fafc;
}

.has-sticky-header thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

/* ---- Table Body ---- */
.has-sticky-header tbody tr:nth-child(even) {
    background: #f8fafc;
}

.has-sticky-header tbody tr:hover {
    background: #f1f5f9;
    transition: background 0.15s ease;
}

.has-sticky-header td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}

/* ---- Row Hover Highlight ---- */
.has-sticky-header tbody tr {
    transition: background 0.15s ease;
}

/* ---- Best Value Row ---- */
.best-value {
    position: relative;
    background-color: #f0fdf4 !important;
}

.best-value td:first-child {
    border-left: 4px solid #16a34a;
    padding-left: 12px;
}

/* ---- CTA Button ---- */
.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background-color: #002071;
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    white-space: nowrap;
}

.cta-button:hover {
    background-color: #003399;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 32, 113, 0.25);
}

.cta-button:active {
    transform: scale(0.99);
}

/* ---- Sponsored Indicator ---- */
a[rel="sponsored"] {
    position: relative;
}

.cta-button[rel="sponsored"]::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 2px;
    background-color: #f59e0b;
    border-radius: 50%;
    vertical-align: middle;
    opacity: 0.8;
}

/* ---- Overflow Wrapper for Mobile ---- */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

/* ---- Top Pick Badge ---- */
.top-pick-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 9999px;
}

/* ---- Winner Badge ---- */
.winner-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background-color: #16a34a;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

/* ---- Best Rate ---- */
.best-rate {
    color: #059669;
    font-weight: 700;
}

/* ---- Bank Name Cell ---- */
.bank-name-cell {
    font-weight: 600;
    color: #1e293b;
}

/* ---- Best For Cell ---- */
.best-for-cell {
    font-size: 0.8rem;
    color: #64748b;
}

/* ---- Mobile Responsive ---- */
@media (max-width: 768px) {
    .has-sticky-header thead {
        top: 60px;
    }

    .has-sticky-header td,
    .has-sticky-header th {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .cta-button {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .best-value td:first-child {
        border-left-width: 3px;
    }
}

/* ---- Print-Friendly Styles ---- */
@media print {
    .has-sticky-header thead {
        position: static;
        top: auto;
        z-index: auto;
        background: #f8fafc;
    }

    .table-scroll-wrapper {
        overflow: visible;
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }

    .cta-button,
    .top-pick-badge,
    .winner-badge {
        display: none;
    }

    .best-value {
        background-color: #f0fdf4 !important;
    }
}