/* ── Top Controls Row ──────────────────────────────────────────────────── */

#top-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: stretch;
    width: 90%;
    max-width: 1200px;
    margin: 24px auto 0;
    gap: 16px;
    flex-wrap: wrap;
}

#grading-cost-container {
    display: flex;
    align-items: center;
}

#grading-cost-container a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #1D3557;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#grading-cost-container a:hover {
    border-color: #83000A;
    box-shadow: 0 2px 8px rgba(131, 0, 10, 0.1);
    color: #83000A;
}

#grading-cost {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

#grading-cost img {
    height: 14px;
    opacity: 0.5;
}

#top-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* ── Minimums / Filter Controls ────────────────────────────────────────── */

#minimums-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
}

.above-minimums {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1D3557;
}

.above-minimums label {
    font-size: 0.78rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.above-minimums select {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1D3557;
    background: #fff;
    cursor: pointer;
}

.save-icon {
    height: 24px;
    width: 24px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.save-icon:hover {
    opacity: 1;
}

.above-minimums input {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.82rem;
    width: 120px;
}

/* ── Filter Pills ──────────────────────────────────────────────────────── */

#minimums-pills {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filter-pill {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-pill label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    padding-left: 4px;
}

.pill-input {
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 7px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #1D3557;
    text-align: center;
    width: 115px;
    background: #fff;
    font-family: "Roboto", sans-serif;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pill-input:focus {
    outline: none;
    border-color: #83000A;
    box-shadow: 0 0 0 3px rgba(131, 0, 10, 0.08);
    background: #fffafa;
}

/* ── Filter Bar ────────────────────────────────────────────────────────── */

#filter-container {
    width: 90%;
    max-width: 1200px;
    margin: 16px auto 0;
    position: sticky;
    top: 64px;
    z-index: 20;
    background: #f8fafc;
    padding-bottom: 6px;
}

#filters {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

#filters th {
    background-color: #f1f5f9;
    color: #1D3557;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 12px;
    border-color: #dde3ed;
}

#filters td {
    width: 33.3%;
    height: 38px;
    background: #fff;
    padding: 0;
}

#filters select {
    font-weight: 600;
    border: none;
    width: 100%;
    text-align: center;
    padding: 0 8px;
    height: 100%;
    font-size: 0.875rem;
    color: #1D3557;
    background: transparent;
    cursor: pointer;
}

#search-filter {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1D3557;
    background: transparent;
    padding: 0 8px;
}

#search-filter::placeholder {
    font-weight: 400;
    color: #94a3b8;
}

#search-filter:focus {
    outline: none;
    background: #fffafa;
}

/* ── Profit Table ──────────────────────────────────────────────────────── */

#profit-container {
    width: 100%;
    display: flex;
    align-items: center;
    flex-direction: column;
    margin-top: 20px;
}

#profit-table {
    width: 90%;
    max-width: 1200px;
}

#profit-table th {
    cursor: pointer;
    user-select: none;
    height: 38px;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    transition: background-color 0.12s ease;
}

#profit-table th:hover {
    background-color: #25456e;
}

.us-table td {
    width: 10%;
}

.uk-table td {
    width: 11.1%;
}

.uk-table .tcgp {
    display: none;
}

/* ── Thumbnail Column ──────────────────────────────────────────────────── */

#profit-table th.thumb,
#profit-table td.thumb {
    width: 52px;
    min-width: 52px;
    padding: 4px 6px;
    text-align: center;
    vertical-align: middle;
}

.profit-thumb-img {
    display: block;
    width: 40px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    margin: 0 auto;
}

.skeleton-thumb {
    width: 40px;
    height: 56px;
    margin: 0 auto;
    border-radius: 4px;
}

/* ── Profit Value Coloring ─────────────────────────────────────────────── */

.card-row td.ep.profit-positive { color: #16a34a; font-weight: 700; }
.card-row td.ep.profit-negative { color: #dc2626; font-weight: 700; }

/* ── Buy Buttons in Table ──────────────────────────────────────────────── */

.tcgp a {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tcgp div {
    background: #83000A;
    color: white;
    width: 130px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 700;
    transition: opacity 0.15s ease;
}

.tcgp div:hover {
    opacity: 0.88;
}

.search a {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.search div {
    background: #83000A;
    color: white;
    width: 120px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 700;
    transition: opacity 0.15s ease;
}

.search div:hover {
    opacity: 0.88;
}

.card-row {
    cursor: pointer;
    transition: background-color 0.12s ease;
}

#profit-table .card-row:hover td {
    background-color: rgba(255, 255, 255, 0.82) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* ── Filter actions (reset) ────────────────────────────────────────────── */

#filter-actions {
    display: flex;
    justify-content: flex-end;
    padding: 5px 2px 0;
}

#reset-filters-btn {
    background: none;
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    font-family: "Roboto", sans-serif;
    transition: color 0.15s ease;
}

#reset-filters-btn:hover {
    color: #83000A;
}

/* ── Favourite column ──────────────────────────────────────────────────── */

.fav-col {
    width: 40px;
    min-width: 40px;
    text-align: center;
    padding: 4px 0 !important;
}

.row-heart {
    height: 20px;
    width: auto;
    cursor: pointer;
    opacity: 0.3;
    filter: invert(1);
    transition: opacity 0.15s ease, transform 0.15s ease;
    display: block;
    margin: 0 auto;
}

.row-heart:hover {
    opacity: 0.6;
    transform: scale(1.15);
}

.row-heart-filled {
    opacity: 1;
    filter: sepia(1) saturate(10) hue-rotate(325deg) brightness(0.28);
}

/* ── Empty state link ──────────────────────────────────────────────────── */

.empty-state-cell a {
    color: #83000A;
    font-weight: 600;
    text-decoration: underline;
}

/* ── Pagination ────────────────────────────────────────────────────────── */

#next-last-container {
    margin: 24px 0 32px;
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.next-last-button {
    cursor: pointer;
    padding: 8px 18px;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    background: #fff;
    transition: all 0.15s ease;
    user-select: none;
}

.active-next-last {
    border-color: #1D3557;
    color: #1D3557;
}

.active-next-last:hover {
    background: #1D3557;
    color: #fff;
}

#page-no {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1D3557;
    min-width: 90px;
    text-align: center;
}

/* ── Skeleton Loading ──────────────────────────────────────────────────── */

.skeleton-btn {
    width: 110px;
    height: 24px;
    margin: 3px auto;
}

.skeleton-row td {
    padding: 10px 6px;
}

/* ── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    #profit-table th.thumb,
    #profit-table td.thumb {
        display: none;
    }

    #top-row {
        flex-direction: column;
        width: 100%;
        padding: 12px 16px;
        margin-top: 16px;
        gap: 12px;
    }

    #grading-cost-container {
        width: 100%;
    }

    #top-right {
        width: 100%;
        justify-content: flex-start;
    }

    .above-minimums > div,
    #filter-name,
    #minimums-save {
        display: none;
    }

    #minimums-pills {
        gap: 8px;
    }

    .pill-input {
        width: 90px;
        font-size: 0.78rem;
        padding: 6px 10px;
    }

    html, body {
        overflow-x: auto !important;
    }

    #profit-container {
        padding: 0 8px;
        align-items: flex-start;
        overflow-x: visible;
    }

    #profit-table {
        width: auto;
        min-width: 100%;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    #profit-table th, #profit-table td {
        padding: 8px 6px;
    }

    #filter-container {
        width: 100%;
        padding: 0 8px;
    }

    #filters {
        width: 100%;
        font-size: 0.82rem;
    }

    #next-last-container {
        margin: 16px auto 24px;
    }
}

/* ── Profit Paywall ────────────────────────────────────────────────────── */

#profit-paywall {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 40px 16px;
    position: relative;
    overflow: hidden;
}

#profit-paywall::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('/static/img/profit-bg.png');
    background-size: cover;
    background-position: center top;
    filter: blur(3px) brightness(0.35);
    transform: scale(1.04);
    z-index: 0;
}

#profit-paywall-inner {
    background: rgba(14, 22, 33, 0.78);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 16px;
    padding: 48px 48px 44px;
    max-width: 640px;
    width: 100%;
    text-align: left;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    position: relative;
    z-index: 1;
}

#profit-paywall-title {
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 10px;
}

#profit-paywall-text {
    color: #94a3b8;
    font-size: 0.93rem;
    line-height: 1.6;
    margin: 0 0 24px;
}

#profit-paywall-features {
    list-style: none;
    padding: 0;
    margin: 0 0 32px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#profit-paywall-features li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #cbd5e1;
    font-size: 0.88rem;
    line-height: 1.5;
}

.ppf-check {
    color: #16a34a;
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

#profit-paywall-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.profit-paywall-btn {
    display: inline-block;
    padding: 11px 28px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s;
    background: #83000A;
    color: #fff;
}

.profit-paywall-btn:hover {
    opacity: 0.88;
}

.profit-paywall-btn-secondary {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.22);
    color: #cbd5e1;
}

@media (max-width: 680px) {
    #profit-paywall-inner {
        padding: 32px 24px 28px;
    }
    #profit-paywall-actions {
        flex-direction: column;
    }
    .profit-paywall-btn {
        width: 100%;
        text-align: center;
    }
}

/* ── SEO content below paywall ─────────────────────────────────────────── */

#profit-seo-content {
    max-width: 720px;
    margin: 0 auto 60px;
    padding: 0 24px;
    color: #475569;
}

#profit-seo-inner h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1D3557;
    margin: 32px 0 8px;
}

#profit-seo-inner p {
    font-size: 0.92rem;
    line-height: 1.7;
    margin: 0 0 12px;
}

#profit-seo-inner a {
    color: #1D3557;
    text-decoration: underline;
}
