/* USDT-M Futures section — matches HyperFlow dashboard theme */

.hf-futures-section {
    margin: 20px 0 24px;
    border: 1px solid rgba(0, 212, 255, 0.22);
    background: linear-gradient(
        145deg,
        rgba(12, 16, 28, 0.92) 0%,
        rgba(8, 12, 22, 0.95) 50%,
        rgba(16, 10, 28, 0.88) 100%
    );
    box-shadow: var(--shadow-glow), var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.hf-futures-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 40% at 100% 0%, rgba(168, 85, 247, 0.08), transparent 60%);
    pointer-events: none;
}

.hf-futures-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.hf-futures-header-text h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes hf-futures-icon-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.hf-futures-icon {
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.5));
    animation: hf-futures-icon-blink 1.6s ease-in-out infinite;
    will-change: opacity;
}

.hf-futures-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 6px;
    max-width: 520px;
}

.hf-futures-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.hf-futures-pill {
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(0, 212, 255, 0.25);
    background: rgba(0, 212, 255, 0.06);
    color: var(--accent-cyan-dim);
}

.hf-futures-offline-banner {
    position: relative;
    z-index: 1;
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 193, 7, 0.35);
    background: rgba(255, 193, 7, 0.08);
    text-align: center;
}

.hf-futures-offline-banner p {
    margin: 0;
    color: #ffc107;
    font-size: 0.9rem;
    font-weight: 600;
}

.hf-futures-offline-banner strong {
    font-weight: 700;
}

.hf-futures-section[data-hf-futures-offline="1"] .hf-futures-stats-grid {
    opacity: 1;
}

.hf-futures-section[data-hf-futures-offline="1"] .hf-futures-recent {
    opacity: 1;
}

.hf-futures-section[data-hf-futures-offline="1"] .hf-futures-table-wrap {
    max-height: none;
    overflow-x: visible;
    overflow-y: visible;
}

.hf-futures-section[data-hf-futures-offline="1"] .hf-futures-table {
    min-width: 0 !important;
    width: 100%;
    table-layout: fixed;
}

.hf-futures-section[data-hf-futures-offline="1"] .hf-futures-table thead {
    display: none;
}

.hf-futures-offline-row td {
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
    width: 100%;
    max-width: 100%;
    white-space: normal;
}

.hf-futures-offline-trades-msg {
    margin: 0;
    padding: 16px 14px;
    text-align: center;
    color: #ffc107;
    font-size: 0.88rem;
    line-height: 1.55;
    font-weight: 500;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

.hf-futures-offline-trades-msg strong {
    font-weight: 700;
}

.hf-futures-section[data-hf-futures-offline="1"] .hf-futures-pill {
    border-color: rgba(255, 193, 7, 0.35);
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.hf-futures-view-btn {
    white-space: nowrap;
}

.hf-futures-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
    position: relative;
    z-index: 1;
}

.hf-futures-stat-order-1 { order: 1; }
.hf-futures-stat-order-2 { order: 2; }
.hf-futures-stat-order-3 { order: 3; }
.hf-futures-stat-order-4 { order: 4; }
.hf-futures-stat-order-5 { order: 5; }
.hf-futures-stat-order-6 { order: 6; }
.hf-futures-stat-order-7 { order: 7; }
.hf-futures-stat-order-8 { order: 8; }

.hf-futures-stat {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 14px 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.hf-futures-stat:hover {
    border-color: var(--border-glow);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.06);
}

.hf-futures-stat--wide {
    grid-column: span 1;
}

.hf-futures-stat--tp {
    border-color: rgba(0, 255, 136, 0.2);
}

.hf-futures-stat--sl {
    border-color: rgba(255, 71, 87, 0.2);
}

.hf-futures-stat--pnl {
    border-color: rgba(0, 255, 136, 0.18);
}

.hf-futures-stat-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.hf-futures-stat-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.hf-futures-stat-volume {
    color: #7dd3fc;
    font-style: italic;
    font-size: 1.15rem;
}

.hf-futures-stat-sub {
    display: block;
    font-size: 0.85rem;
    margin-top: 4px;
    font-weight: 600;
}

.hf-futures-stat-sub.positive { color: var(--profit); }
.hf-futures-stat-sub.negative { color: var(--loss); }

.hf-futures-recent {
    position: relative;
    z-index: 1;
}

.hf-futures-recent-title {
    font-size: 1rem;
    color: var(--accent-cyan);
    margin-bottom: 12px;
    font-weight: 600;
}

.hf-futures-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 560px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.28) transparent;
}

.hf-futures-table-wrap::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.hf-futures-table-wrap::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
}

.hf-futures-table-wrap::-webkit-scrollbar-thumb {
    background-color: rgba(0, 212, 255, 0.22);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.hf-futures-table-wrap::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 212, 255, 0.42);
}

.hf-futures-table-wrap::-webkit-scrollbar-corner {
    background: transparent;
}

@media (hover: hover) and (pointer: fine) {
    .hf-futures-table-wrap::-webkit-scrollbar-thumb {
        background-color: rgba(0, 212, 255, 0.14);
    }

    .hf-futures-table-wrap:hover::-webkit-scrollbar-thumb {
        background-color: rgba(0, 212, 255, 0.32);
    }

    .hf-futures-table-wrap::-webkit-scrollbar-thumb:active {
        background-color: rgba(0, 212, 255, 0.5);
    }
}

@media (max-width: 640px) {
    .hf-futures-table-wrap {
        max-height: min(480px, 55vh);
    }

    .hf-futures-table-wrap::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    .hf-futures-table-wrap::-webkit-scrollbar-thumb {
        background-color: rgba(0, 212, 255, 0.2);
    }

    .hf-futures-table {
        min-width: 300px;
    }

    .hf-futures-section[data-hf-futures-offline="1"] .hf-futures-table-wrap {
        max-height: none;
        overflow: visible;
        border-color: rgba(255, 193, 7, 0.28);
        background: rgba(255, 193, 7, 0.05);
    }

    .hf-futures-section[data-hf-futures-offline="1"] .hf-futures-table.trades-table {
        min-width: 0 !important;
    }

    .hf-futures-offline-trades-msg {
        padding: 14px 10px;
        font-size: 0.82rem;
    }

    .hf-futures-offline-banner {
        padding: 12px 10px;
    }

    .hf-futures-offline-banner p {
        font-size: 0.82rem;
        line-height: 1.5;
        overflow-wrap: break-word;
    }
}

.hf-futures-table {
    width: 100%;
    min-width: 640px;
    border-collapse: separate;
    border-spacing: 0;
    font-family: var(--font-body);
}

/* Typography comes from shared .trades-table; only sticky header extras here */
.hf-futures-table.trades-table thead th {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Row text color by close type (no row backgrounds) */
.hf-futures-row--tp td {
    color: var(--profit);
}

.hf-futures-row--tp td.profit-positive,
.hf-futures-row--tp td.profit-negative {
    color: var(--profit) !important;
}

.hf-futures-row--tp .hf-futures-tag--short,
.hf-futures-row--tp .hf-futures-tag--long {
    color: var(--profit);
}

.hf-futures-row--recovery td {
    color: var(--accent-cyan);
}

.hf-futures-row--recovery td.profit-positive,
.hf-futures-row--recovery td.profit-negative {
    color: var(--accent-cyan) !important;
}

.hf-futures-row--recovery .hf-futures-tag--short,
.hf-futures-row--recovery .hf-futures-tag--long {
    color: var(--accent-cyan);
}

.hf-futures-row--manipulation-sl td {
    color: #ff9f43;
}

.hf-futures-row--manipulation-sl td.profit-positive,
.hf-futures-row--manipulation-sl td.profit-negative {
    color: #ff9f43 !important;
}

.hf-futures-row--manipulation-sl .hf-futures-tag--short,
.hf-futures-row--manipulation-sl .hf-futures-tag--long {
    color: #ff9f43;
}

.hf-futures-row--candle-sl td {
    color: #ff9f43;
}

.hf-futures-row--candle-sl td.profit-positive,
.hf-futures-row--candle-sl td.profit-negative {
    color: #ff9f43 !important;
}

.hf-futures-row--candle-sl .hf-futures-tag--short,
.hf-futures-row--candle-sl .hf-futures-tag--long {
    color: #ff9f43;
}

.hf-futures-row--sl-recovery td {
    color: #ff9f43;
}

.hf-futures-row--sl-recovery td.profit-positive,
.hf-futures-row--sl-recovery td.profit-negative {
    color: #ff9f43 !important;
}

.hf-futures-row--sl-recovery .hf-futures-tag--short,
.hf-futures-row--sl-recovery .hf-futures-tag--long {
    color: #ff9f43;
}

.hf-futures-row--sl td {
    color: var(--loss);
}

.hf-futures-row--sl td.profit-positive,
.hf-futures-row--sl td.profit-negative {
    color: var(--loss) !important;
}

.hf-futures-row--sl .hf-futures-tag--short,
.hf-futures-row--sl .hf-futures-tag--long {
    color: var(--loss);
}

/* Account + Time stay default (white) on colored rows */
.hf-futures-row--tp td:nth-child(6),
.hf-futures-row--tp td:nth-child(7),
.hf-futures-row--recovery td:nth-child(6),
.hf-futures-row--recovery td:nth-child(7),
.hf-futures-row--sl-recovery td:nth-child(6),
.hf-futures-row--sl-recovery td:nth-child(7),
.hf-futures-row--manipulation-sl td:nth-child(6),
.hf-futures-row--manipulation-sl td:nth-child(7),
.hf-futures-row--candle-sl td:nth-child(6),
.hf-futures-row--candle-sl td:nth-child(7),
.hf-futures-row--sl td:nth-child(6),
.hf-futures-row--sl td:nth-child(7) {
    color: var(--text-primary);
}

/* Latest close pulse — color-matched glow (runs once when a new row appears) */
@keyframes hf-futures-new-glow-tp {
    0%, 100% {
        opacity: 1;
        text-shadow: none;
    }
    30%, 70% {
        opacity: 0.7;
        text-shadow:
            0 0 8px rgba(0, 255, 136, 0.75),
            0 0 18px rgba(0, 255, 136, 0.35);
    }
    50% {
        opacity: 1;
        text-shadow:
            0 0 12px rgba(0, 255, 136, 0.95),
            0 0 26px rgba(0, 255, 136, 0.45);
    }
}

@keyframes hf-futures-new-glow-recovery {
    0%, 100% {
        opacity: 1;
        text-shadow: none;
    }
    30%, 70% {
        opacity: 0.7;
        text-shadow:
            0 0 8px rgba(0, 212, 255, 0.75),
            0 0 18px rgba(0, 212, 255, 0.35);
    }
    50% {
        opacity: 1;
        text-shadow:
            0 0 12px rgba(0, 212, 255, 0.95),
            0 0 26px rgba(0, 212, 255, 0.45);
    }
}

@keyframes hf-futures-new-glow-sl {
    0%, 100% {
        opacity: 1;
        text-shadow: none;
    }
    30%, 70% {
        opacity: 0.7;
        text-shadow:
            0 0 8px rgba(255, 71, 87, 0.75),
            0 0 18px rgba(255, 71, 87, 0.35);
    }
    50% {
        opacity: 1;
        text-shadow:
            0 0 12px rgba(255, 71, 87, 0.95),
            0 0 26px rgba(255, 71, 87, 0.45);
    }
}

.hf-futures-row--new.hf-futures-row--tp td:not(:nth-child(6)):not(:nth-child(7)) {
    animation: hf-futures-new-glow-tp 2.6s ease-in-out 1;
}

.hf-futures-row--new.hf-futures-row--recovery td:not(:nth-child(6)):not(:nth-child(7)) {
    animation: hf-futures-new-glow-recovery 2.6s ease-in-out 1;
}

.hf-futures-row--new.hf-futures-row--sl td:not(:nth-child(6)):not(:nth-child(7)) {
    animation: hf-futures-new-glow-sl 2.6s ease-in-out 1;
}

@keyframes hf-futures-new-glow-sl-recovery {
    0%, 100% {
        opacity: 1;
        text-shadow: none;
    }
    30%, 70% {
        opacity: 0.7;
        text-shadow:
            0 0 8px rgba(255, 159, 67, 0.75),
            0 0 18px rgba(255, 159, 67, 0.35);
    }
    50% {
        opacity: 1;
        text-shadow:
            0 0 12px rgba(255, 159, 67, 0.95),
            0 0 26px rgba(255, 159, 67, 0.45);
    }
}

.hf-futures-row--new.hf-futures-row--sl-recovery td:not(:nth-child(6)):not(:nth-child(7)) {
    animation: hf-futures-new-glow-sl-recovery 2.6s ease-in-out 1;
}

.hf-futures-row--new.hf-futures-row--candle-sl td:not(:nth-child(6)):not(:nth-child(7)),
.hf-futures-row--new.hf-futures-row--manipulation-sl td:not(:nth-child(6)):not(:nth-child(7)) {
    animation: hf-futures-new-glow-sl-recovery 2.6s ease-in-out 1;
}

@media (prefers-reduced-motion: reduce) {
    .hf-futures-row--new td {
        animation: none !important;
    }
}

.hf-futures-empty {
    text-align: center;
    padding: 24px !important;
    color: var(--text-muted);
}

.hf-futures-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.hf-futures-tag--tp {
    background: rgba(0, 255, 136, 0.14);
    color: var(--profit);
    border: 1px solid rgba(0, 255, 136, 0.25);
}

.hf-futures-tag--recovery {
    background: rgba(0, 212, 255, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 212, 255, 0.28);
}

.hf-futures-tag--sl {
    background: rgba(255, 71, 87, 0.14);
    color: var(--loss);
    border: 1px solid rgba(255, 71, 87, 0.28);
}

.hf-futures-tag--sl-recovery {
    background: rgba(255, 159, 67, 0.16);
    color: #ff9f43;
    border: 1px solid rgba(255, 159, 67, 0.35);
}

.hf-futures-tag--manipulation-sl {
    background: rgba(255, 159, 67, 0.16);
    color: #ff9f43;
    border: 1px solid rgba(255, 159, 67, 0.35);
}

.hf-futures-tag--candle-sl {
    background: rgba(255, 159, 67, 0.16);
    color: #ff9f43;
    border: 1px solid rgba(255, 159, 67, 0.35);
}

.hf-futures-tag--long {
    color: var(--profit);
}

.hf-futures-tag--short {
    color: var(--accent-purple);
}

.hf-futures-modal.view-account-modal-open {
    display: flex;
}

.view-account-modal-body #hf-futures-account-enter {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid rgba(0, 212, 255, 0.35);
    background: rgba(0, 212, 255, 0.12);
    color: var(--accent-cyan);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.view-account-modal-body #hf-futures-account-enter:hover {
    background: rgba(0, 212, 255, 0.18);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.22);
    border-color: rgba(0, 212, 255, 0.5);
}

.view-account-modal-footer #hf-futures-account-cancel {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 71, 87, 0.35);
    background: rgba(255, 71, 87, 0.1);
    color: var(--loss);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}

.view-account-modal-footer #hf-futures-account-cancel:hover {
    background: rgba(255, 71, 87, 0.16);
    border-color: rgba(255, 71, 87, 0.5);
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.15);
}

.hf-futures-account-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
}

@media (max-width: 640px) {
    .hf-futures-header {
        flex-direction: column;
    }
    .hf-futures-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .hf-futures-recent-title {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }

    .hf-futures-tag {
        font-size: 0.58rem;
        padding: 1px 5px;
    }

    .hf-futures-offline-trades-msg {
        padding: 12px 8px;
        font-size: 0.78rem;
        line-height: 1.6;
    }

    .hf-futures-offline-trades-msg strong {
        display: block;
        margin-bottom: 6px;
    }

    .hf-futures-offline-banner p strong {
        display: block;
        margin-bottom: 4px;
    }
}
