/**
 * Public Closed Trades — Proof Page Styles
 * Used inside the iframe source page AND by the iframe wrapper.
 *
 * @package ContrarianTraderMember
 */

/* ── Wrapper ──────────────────────────────────────────────────────────── */
.tctm-public-trades-wrap {
    font-family: var(--global-body-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 14px;
    color: var(--global-palette3, #1a1a2e);
    background: #fff;
    padding: 16px 16px 24px;
    box-sizing: border-box;
}

/* ── Table container — horizontal scroll on small screens ───────────── */
.tctm-public-trades-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── DataTables base overrides ─────────────────────────────────────── */
.tctm-public-trades-table {
    width: 100% !important;
    border-collapse: collapse;
}

.tctm-public-trades-table thead th {
    background: #0f1b2d;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 10px;
    border: none;
    white-space: nowrap;
}

.tctm-public-trades-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.tctm-public-trades-table tbody tr:hover {
    background: #f8fafc;
}

.tctm-public-trades-table tbody td {
    padding: 11px 10px;
    vertical-align: middle;
    border: none;
}

/* ── Ticker ─────────────────────────────────────────────────────────── */
.tctm-pt-ticker {
    font-weight: 700;
    font-size: 13px;
    color: #0f1b2d;
    letter-spacing: 0.03em;
}

/* ── Company ────────────────────────────────────────────────────────── */
.tctm-pt-company {
    color: #555;
    font-size: 13px;
}

/* ── Dates ───────────────────────────────────────────────────────────── */
.tctm-pt-date {
    white-space: nowrap;
    color: #666;
    font-size: 13px;
}

/* ── Return badge ────────────────────────────────────────────────────── */
.tctm-pt-return {
    text-align: center;
}

.tctm-pt-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.tctm-pt-up {
    background: #e6f9ef;
    color: #1a7f4b;
}

.tctm-pt-down {
    background: #fdecea;
    color: #c0392b;
}

/* ── Video button ────────────────────────────────────────────────────── */
.tctm-pt-video-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1px solid #2a7de1;
    color: #2a7de1;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    min-height: 32px;
    min-width: 70px;
    transition: background 0.15s, color 0.15s;
}

.tctm-pt-video-btn:hover {
    background: #2a7de1;
    color: #fff;
}

.tctm-pt-play-icon {
    font-size: 10px;
}

.tctm-pt-no-video {
    color: #bbb;
    font-size: 13px;
}

/* ── Loading spinner ─────────────────────────────────────────────────── */
.tctm-pt-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    padding: 20px;
    color: #555;
}

.tctm-pt-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: #2a7de1;
    border-radius: 50%;
    animation: tctmSpin 0.7s linear infinite;
}

@keyframes tctmSpin {
    to { transform: rotate(360deg); }
}

/* ── DataTables UI overrides ─────────────────────────────────────────── */
.tctm-pt-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.tctm-pt-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    margin-bottom: 0;
    font-size: 13px;
    color: #666;
}

/* ── Video Modal ─────────────────────────────────────────────────────── */
.tctm-video-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tctm-video-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
}

.tctm-video-modal-box {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 860px;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}

.tctm-video-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 2;
    background: rgba(0,0,0,0.5);
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tctm-video-modal-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
}

.tctm-video-modal-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Prevent page scroll when modal is open */
body.tctm-modal-open {
    overflow: hidden;
}

/* ── iframe wrapper (on the parent/performance page) ─────────────────── */
.tctm-trades-iframe-wrapper {
    width: 100%;
    position: relative;
}

.tctm-trades-iframe-wrapper iframe {
    width: 100%;
    border: none;
    display: block;
    /* No min-height — postMessage auto-resize sets exact height */
}

/* ── DataTables Pagination overrides ────────────────────────────────── */
.tctm-public-trades-wrap .dataTables_paginate .paginate_button {
    background: #fff !important;
    border: 1px solid #ddd !important;
    color: #0f1b2d !important;
    border-radius: 4px !important;
    padding: 4px 10px !important;
    margin: 0 2px !important;
    cursor: pointer;
    font-size: 13px;
}

.tctm-public-trades-wrap .dataTables_paginate .paginate_button:hover {
    background: #f0f4f8 !important;
    border-color: #0f1b2d !important;
    color: #0f1b2d !important;
}

.tctm-public-trades-wrap .dataTables_paginate .paginate_button.current,
.tctm-public-trades-wrap .dataTables_paginate .paginate_button.current:hover {
    background: #0f1b2d !important;
    border-color: #0f1b2d !important;
    color: #fff !important;
    font-weight: 700;
}

.tctm-public-trades-wrap .dataTables_paginate .paginate_button.disabled,
.tctm-public-trades-wrap .dataTables_paginate .paginate_button.disabled:hover {
    color: #bbb !important;
    border-color: #eee !important;
    cursor: default;
}

/* Remove extra bottom padding so iframe height is tight */
.tctm-public-trades-wrap {
    padding-bottom: 8px;
}

/* ── Mobile ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .tctm-public-trades-wrap {
        padding: 10px 8px 20px;
    }

    .tctm-public-trades-table thead th,
    .tctm-public-trades-table tbody td {
        padding: 10px 8px;
        font-size: 12px;
    }

    .tctm-pt-video-btn {
        min-height: 36px; /* larger tap target on mobile */
        padding: 6px 10px;
    }

    .tctm-video-modal-box {
        width: 96%;
    }

    .tctm-pt-top {
        flex-direction: column;
        align-items: stretch;
    }
}
