/* Base styles */
body {
    background-color: #111111;
    color: #ffffff;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
    font-family: 'Inter', sans-serif;
    scrollbar-width: auto;
    /* For Firefox */
    scrollbar-color: #555 #1a1a1a;
    /* For Firefox - thumb and track */
}

/* Webkit Scrollbar Styles for body/html */
body::-webkit-scrollbar {
    width: 16px;
    /* Wider scrollbar */
}

body::-webkit-scrollbar-track {
    background: #1a1a1a;
    /* Dark track */
    border-radius: 8px;
}

body::-webkit-scrollbar-thumb {
    background-color: #555;
    /* Visible thumb color */
    border-radius: 8px;
    border: 3px solid #1a1a1a;
    /* Creates padding around thumb */
}

body::-webkit-scrollbar-thumb:hover {
    background-color: #777;
    /* Slightly lighter on hover */
}

/* Hide reCAPTCHA badge */
.grecaptcha-badge {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Container layout */
.outer-container {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
    background: #111111;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Quick filters section */
.quick-filters {
    padding: 1rem;
    background: #161616;
    border: 1px solid #222;
    border-radius: 4px;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}

.quick-filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.quick-filters-title {
    color: #999;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

.quick-filters-title h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.2px;
    position: relative;
}

.info-icon {
    margin-left: 8px;
    display: inline-flex;
    vertical-align: middle;
    cursor: help;
    position: relative;
    z-index: 5;
    background: rgba(255, 184, 0, 0.1);
    border: 1px solid rgba(255, 184, 0, 0.2);
    border-radius: 50%;
    padding: 3px;
    transition: all 0.2s ease;
}

.info-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}

.info-icon:hover {
    background: rgba(255, 184, 0, 0.2);
    transform: scale(1.05);
}

/* Countdown timer */
.countdown {
    font-family: 'Chivo Mono', monospace;
    color: #FFB800;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 4px;
    background: rgba(255, 184, 0, 0.1);
    border: 1px solid rgba(255, 184, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.countdown-label {
    color: #999;
}

.countdown-time {
    display: flex;
    gap: 4px;
}

.countdown-unit {
    display: inline-block;
    min-width: 26px;
    text-align: center;
}

.countdown-seconds {
    color: rgba(255, 184, 0, 0.7);
}

.countdown-next-time {
    color: #999;
    margin-left: 8px;
}

/* Opportunity cards */
.opportunities {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    overflow-x: auto;
    padding: 4px 0 0 0;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    min-height: 115px;
}

.opportunities::-webkit-scrollbar {
    display: none;
}

.opportunity-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-width: 280px;
    flex-shrink: 0;
}

.opportunity-card:hover {
    border-color: var(--hyperliquid-green);
    transform: translateY(-1px);
}

.opportunity-symbol {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #fff;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Chivo Mono', monospace;
}

.opportunity-spread {
    font-family: 'Chivo Mono', monospace;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.opportunity-spread .daily-yield {
    color: #999;
    font-size: 0.85em;
    opacity: 0.9;
}

.opportunity-spread.positive {
    color: #00e5af;
}

.opportunity-spread.negative {
    color: #ff4040;
}

.opportunity-exchanges {
    font-size: 0.7rem;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #222;
}

.opportunity-exchanges .exchange-logo {
    width: 12px;
    height: 12px;
    object-fit: contain;
}

.opportunity-exchanges .buy-side,
.opportunity-exchanges .sell-side {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.opportunity-exchanges .buy-side {
    color: #00e5af;
    font-weight: 500;
}

.opportunity-exchanges .sell-side {
    color: #ff4040;
    font-weight: 500;
}

.opportunity-exchanges .arrow {
    color: #666;
    margin: 0 2px;
}

.rank-badge {
    background: #333;
    color: #999;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    position: absolute;
    top: -6px;
    right: -6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.rank-badge-first {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
}

.rank-badge-second {
    background: linear-gradient(45deg, #C0C0C0, #A9A9A9);
    color: #000;
}

.rank-badge-third {
    background: linear-gradient(45deg, #CD7F32, #8B4513);
    color: #fff;
}

/* Table controls */
.table-controls {
    display: flex;
    align-items: stretch;
    margin: 20px 0;
    gap: 10px;
    width: 100%;
}

/* Unified control box styling */
.control-box {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    min-height: 42px;
    display: flex;
    align-items: center;
}

/* Unit toggle container */
.unit-toggle-container {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.unit-toggle-header {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.unit-toggle-buttons {
    display: flex;
    gap: 4px;
}

.unit-toggle-btn {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #ccc;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.unit-toggle-btn:hover {
    background: #333;
    border-color: #555;
}

.unit-toggle-btn.active {
    background: #375a7f;
    border-color: #375a7f;
    color: #fff;
}

/* Search container */
.search-container {
    position: relative;
    width: 33%;
}

.search-container input {
    background: transparent;
    border: none;
    width: 100%;
    height: 100%;
    padding: 0 72px 0 15px;
    /* Increased right padding to accommodate both buttons */
    color: #fff;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}

.search-container input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.search-container::after {
    content: '⌘K';
    position: absolute;
    right: 42px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
    opacity: 0.8;
    font-family: 'Chivo Mono', monospace;
    letter-spacing: 1px;
}

.search-container input:focus+.search-clear+.search-container::after {
    opacity: 0;
}

.search-clear {
    background: transparent;
    border: none;
    color: #999;
    font-size: 16px;
    width: 32px;
    height: 32px;
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    display: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-clear:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.search-clear:active {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-50%) scale(0.95);
}

.search-clear.visible {
    display: flex;
}

/* Ensure the search container looks good on focus */
.search-container:focus-within {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

/* Add transition for the clear button */
.search-clear {
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.search-clear.visible {
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {

    /* Container adjustments */
    .table-controls {
        flex-wrap: nowrap;
        gap: 4px;
        margin: 8px 0;
        width: 100%;
        padding: 0;
    }

    /* Control box base styles */
    .control-box {
        min-height: 36px;
        border-radius: 6px;
    }

    /* Search container */
    .search-container {
        width: 50%;
        margin: 0;
        flex: 1;
    }

    .search-container input {
        font-size: 13px;
        padding-right: 65px;
        height: 36px;
    }

    .search-container::after {
        font-size: 10px;
        padding: 2px 4px;
        right: 36px;
    }

    /* Unit toggle on mobile */
    .unit-toggle-container {
        padding: 6px 8px;
        gap: 3px;
    }

    .unit-toggle-header {
        font-size: 10px;
    }

    .unit-toggle-btn {
        padding: 3px 8px;
        font-size: 11px;
    }

    .search-clear {
        width: 28px;
        height: 28px;
        font-size: 14px;
        right: 4px;
    }

    /* Exchange filters */
    .exchange-filters {
        width: 50%;
        margin: 0;
        flex: 1;
    }

    /* Completely remove OI Rank filter from layout on mobile */
    .oi-rank-filter {
        display: none;
        width: 0;
        margin: 0;
        padding: 0;
        flex: 0;
    }

    /* Exchange filters dropdown positioning */
    .exchange-filters-content {
        width: 280px !important;
        right: 0;
        left: auto !important;
    }

    /* Compact header */
    .exchange-filters-header {
        padding: 0 10px;
        font-size: 13px;
        height: 36px;
    }

    .filter-toggle-icon {
        opacity: 0.8;
    }

    /* Outer container padding adjustment */
    .outer-container {
        padding: 8px;
    }
}

/* OI Rank filter */
.oi-rank-filter {
    position: relative;
    width: 33%;
    flex-shrink: 0;
    padding: 8px 15px;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    z-index: 99997;
}

.oi-rank-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: #fff;
    width: 100%;
    gap: 12px;
}

.oi-rank-header>span {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.oi-rank-header .info-icon {
    position: relative;
    margin: 0;
    padding: 2px;
    background: none;
    border: none;
    z-index: 99998;
    cursor: help;
}

.oi-rank-header .info-icon svg {
    width: 14px;
    height: 14px;
}

.oi-rank-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.oi-rank-inputs input {
    width: 60px;
    height: 28px;
    background: #161616;
    border: 1px solid #333;
    border-radius: 4px;
    color: #fff;
    font-family: 'Chivo Mono', monospace;
    font-size: 14px;
    padding: 0 8px;
    text-align: center;
}

.oi-rank-inputs input:focus {
    outline: none;
    border-color: #00e5af;
}

.oi-rank-inputs span {
    color: #666;
}

#applyOiRank {
    background: #00e5af;
    color: #111;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#applyOiRank:hover {
    background: #00c49a;
}

#applyOiRank:active {
    transform: scale(0.95);
}

/* Exchange filters */
.exchange-filters {
    position: relative;
    width: 33%;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

.exchange-filters:hover {
    background-color: #252525;
}

.exchange-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    width: 100%;
    height: 100%;
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

.exchange-filters-header.open {
    background-color: #252525;
}

.filter-toggle-icon {
    margin-left: 2px;
    font-size: 9px;
    color: #999;
    transition: transform 0.2s ease;
}

.exchange-filters-header.open .filter-toggle-icon {
    transform: rotate(180deg);
}

.exchange-filters-content {
    position: fixed !important;
    z-index: 9999;
    background: #181818;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    min-width: auto;
    width: auto;
    /* Width will be set via JS to match container */
    border-radius: 10px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    border: 1px solid #333;
}

.exchange-filters-content.visible {
    visibility: visible;
    opacity: 1;
}

.exchange-filters-inner {
    max-height: 80vh;
    overflow-y: auto;
    padding: 16px;
}

.exchange-filters-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 10px;
    width: 100%;
}

.exchange-filters-actions button {
    background: #2a2a2a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 6px 12px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    flex: 1;
    transition: background-color 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.exchange-filters-actions button:hover {
    background: #3a3a3a;
}

/* Exchange type filters (DEX/CEX buttons) */
.exchange-type-filters {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 10px;
    width: 100%;
}

.exchange-type-btn {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 6px 12px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    flex: 1;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.exchange-type-btn:hover {
    background: #2a2a2a;
    border-color: #00e5af;
    color: #00e5af;
}

.exchange-type-btn:active {
    transform: scale(0.95);
}

/* Add visual feedback for active state */
.exchange-type-btn.active {
    background: #00e5af;
    color: #111;
    border-color: #00e5af;
}

.exchange-type-btn.active:hover {
    background: #00c49a;
    color: #111;
    border-color: #00c49a;
}

.exchange-filters-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.exchange-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 0;
    font-family: 'Inter', sans-serif;
}

.exchange-filter-item:hover {
    background: #2a2a2a;
}

.exchange-logo-small {
    width: 18px;
    height: 18px;
    border-radius: 3px;
}

/* Table container */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    margin-bottom: 35px;
    border-radius: 4px;
    background: #161616;
    border: 1px solid #222;
    scrollbar-width: large;
    /* For Firefox */
    scrollbar-color: #555 #1a1a1a;
    /* For Firefox - thumb and track */
}

.table-container::-webkit-scrollbar {
    width: 24px;
    height: 24px;
}

.table-container::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 12px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 12px;
    border: 3px solid #111111;
    min-height: 150px;
    min-width: 100px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.table-container::-webkit-scrollbar-corner {
    background: #111111;
}

/* Ensure proper table layout */
#fundingRatesTable {
    width: 100%;
    min-width: 1200px;
    border-collapse: separate;
    border-spacing: 0;
    font-family: 'Chivo Mono', monospace;
    font-size: 0.85rem;
    table-layout: fixed;
    position: relative;
    margin: 0;
}

/* Column width specifications for fixed table layout */
#fundingRatesTable th:nth-child(1),
#fundingRatesTable td:nth-child(1) {
    width: 120px !important;
    min-width: 120px !important;
    /* Symbol column */
}

#fundingRatesTable th:nth-child(2),
#fundingRatesTable td:nth-child(2) {
    width: 80px !important;
    min-width: 80px !important;
    /* OI Rank column */
}

#fundingRatesTable th:nth-child(3),
#fundingRatesTable td:nth-child(3) {
    width: 110px !important;
    min-width: 110px !important;
    /* Max Arb column - wider for 3-digit numbers */
}

/* Exchange columns - dynamic width with minimum */
#fundingRatesTable th:nth-child(n+4),
#fundingRatesTable td:nth-child(n+4) {
    min-width: 85px !important;
    /* Minimum width to prevent text wrapping */
    width: var(--exchange-column-width, 85px) !important;
    /* Will be set dynamically via JavaScript */
}

/* Main content area */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Important for Firefox */
    padding-bottom: 40px;
    /* Add some bottom padding */
}

/* Header styles */
#fundingRatesTable thead {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #161616;
}

#fundingRatesTable thead tr {
    height: 70px;
    background-color: #2a2a2a;
}

#fundingRatesTable th {
    background: #161616;
    color: #999;
    font-weight: 500;
    padding: 10px 5px;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-align: center;
    border-bottom: 1px solid #222;
    cursor: pointer;
    user-select: none;
    width: auto;
    position: relative;
    min-width: 70px;
    vertical-align: middle;
    height: 70px;
}

/* First column styles - make it sticky */
#fundingRatesTable th:first-child,
#fundingRatesTable td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 10;
    text-align: center;
    padding-left: 8px;
    padding-right: 8px;
    background: #161616 !important;
    border-right: 1px solid #222;
}

/* Specific styling for first column header to appear above other headers */
#fundingRatesTable thead th:first-child {
    z-index: 30 !important;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    /* Add subtle shadow to emphasize it's above other headers */
}

/* Style for sortable headers and indicators */
#fundingRatesTable thead th[data-sort] {
    cursor: pointer;
    position: relative;
}

#fundingRatesTable thead th[data-sort]::after {
    content: '\00A0\00A0';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    color: #888;
}

#fundingRatesTable thead th[data-sort].sorting-asc::after {
    content: '▲';
    color: #fff;
}

#fundingRatesTable thead th[data-sort].sorting-desc::after {
    content: '▼';
    color: #fff;
}

/* Cell styles */
#fundingRatesTable td {
    padding: 12px 8px;
    text-align: center;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: text;
    transition: background-color 0.15s ease;
    background-color: #161616;
}

/* Row backgrounds - need to be on cells for sticky column */
#fundingRatesTable tr td:not(:first-child) {
    background-color: #161616;
}

#fundingRatesTable tr:nth-child(even) td:not(:first-child) {
    background-color: #191919;
}

/* Ensure even rows have consistent background in first column */
#fundingRatesTable tr:nth-child(even) td:first-child {
    background-color: #161616;
}

/* Hover effects */
#fundingRatesTable td:hover {
    background-color: #222 !important;
}

#fundingRatesTable td:active {
    background-color: #333 !important;
}

/* Funding rate colors - for individual cells */
td.rate-positive-high {
    color: #ff4040 !important;
}

td.rate-positive-med {
    color: #ff4040 !important;
}

td.rate-negative-high {
    color: #00e5af !important;
}

td.rate-negative-med {
    color: #00e5af !important;
}

/* Value badges for highest/lowest values */
.value-badge {
    font-size: 8px;
    padding: 2px 4px;
    border-radius: 3px;
    position: absolute;
    top: 3px;
    right: 3px;
    font-weight: 700;
    letter-spacing: 0.5px;
    opacity: 1;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    z-index: 5;
}

.buy-badge {
    background-color: rgba(0, 180, 80, 0.2);
    color: #00e5af;
    border: 1px solid rgba(0, 180, 80, 0.4);
}

.sell-badge {
    background-color: rgba(220, 60, 60, 0.2);
    color: #ff4040;
    border: 1px solid rgba(220, 60, 60, 0.4);
}

/* Improved highlighting of extreme values */
.highest-value {
    position: relative;
    background-color: rgba(220, 60, 60, 0.07) !important;
}

.lowest-value {
    position: relative;
    background-color: rgba(0, 180, 80, 0.07) !important;
}

/* Override alternating row backgrounds for highlighted cells */
#fundingRatesTable tr:nth-child(even) td.highest-value,
#fundingRatesTable tr:nth-child(odd) td.highest-value {
    background-color: rgba(220, 60, 60, 0.07) !important;
}

#fundingRatesTable tr:nth-child(even) td.lowest-value,
#fundingRatesTable tr:nth-child(odd) td.lowest-value {
    background-color: rgba(0, 180, 80, 0.07) !important;
}

/* Ensure hover effects don't override the highlights */
#fundingRatesTable td.highest-value:hover,
#fundingRatesTable td.lowest-value:hover {
    background-color: rgba(34, 34, 34, 0.9) !important;
}

/* Zero/null value styling */
.neutral-value {
    color: #666 !important;
}

/* Hide rows when filtered */
tr.hidden {
    display: none;
}

/* Style exchange headers with warning icons to prevent misalignment */
.exchange-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
    line-height: 1.2;
    flex-direction: column;
    padding: 6px 0;
    height: 100%;
}

.exchange-header span {
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.exchange-logo {
    width: 20px;
    height: 20px;
    margin-bottom: 4px;
    border-radius: 3px;
}

/* Highlight arbitrage column with profit-indicating colors */
.max-spread-header,
.max-spread-cell {
    background: #2a2a2a !important;
    /* Medium gray background */
    border-left: 1px solid #333;
    border-right: 1px solid #333;
}

.max-spread-header {
    position: relative;
}

.max-spread-header::after {
    content: 'bps';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    opacity: 0.5;
}

.max-spread-cell {
    font-weight: 500;
    transition: color 0.2s ease;
}

/* Color gradient for spread values */
.max-spread-cell[data-spread="none"] {
    color: #666 !important;
}

.max-spread-cell[data-spread="low"] {
    color: #3dd177 !important;
    background: rgba(61, 209, 119, 0.1) !important;
}

.max-spread-cell[data-spread="medium"] {
    color: #2ecc71 !important;
    background: rgba(46, 204, 113, 0.15) !important;
}

.max-spread-cell[data-spread="high"] {
    color: #00e5af !important;
    background: rgba(0, 229, 175, 0.2) !important;
}

.max-spread-cell[data-spread="very-high"] {
    color: #00ff9d !important;
    background: rgba(0, 255, 157, 0.25) !important;
    font-weight: 600;
}

/* Tooltip for rates */
.rate-tooltip {
    position: absolute;
    background: rgba(17, 17, 17, 0.95);
    color: #ddd;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    display: none;
    max-width: 220px;
    white-space: pre-line;
    font-family: 'Chivo Mono', monospace;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-align: left;
}

.rate-tooltip.visible {
    display: block;
}

/* Improved tooltip styling */
[data-tooltip] {
    position: relative;
    cursor: help;
    z-index: 1;
}

[data-tooltip]::before,
[data-tooltip]::after {
    position: absolute;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: all 0.15s ease;
    z-index: 9999;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    padding: 10px;
    width: 200px;
    background-color: rgba(17, 17, 17, 0.95);
    color: #FFB800;
    text-align: left;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.5;
    border-radius: 6px;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 184, 0, 0.2);
    font-family: 'Inter', sans-serif;
}

/* Rate tooltip specific styling */
.rate-tooltip {
    position: absolute;
    background: rgba(17, 17, 17, 0.95);
    color: #ddd;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    display: none;
    max-width: 220px;
    white-space: pre-line;
    font-family: 'Chivo Mono', monospace;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-align: left;
}

/* Specific tooltip styles for OI Rank header */
.oi-rank-header .info-icon[data-tooltip]::before {
    position: absolute;
    top: 25px;
    left: 0;
    transform: translateX(-45%);
    min-width: 180px;
    max-width: 180px;
    z-index: 99999;
    text-align: left;
    font-size: 11px;
    line-height: 1.5;
    padding: 8px 12px;
    color: #FFB800;
    border: 1px solid rgba(255, 184, 0, 0.2);
    background-color: rgba(17, 17, 17, 0.95);
    font-family: 'Inter', sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: normal;
}

/* Interval icon tooltip */
.interval-icon[data-tooltip]::before {
    transform: translateX(-90%) translateY(10px);
    top: 100%;
    color: #FFB800;
    border: 1px solid rgba(255, 184, 0, 0.2);
    background-color: rgba(17, 17, 17, 0.95);
    text-align: left;
}

.interval-icon.warning-topright[data-tooltip]::before {
    top: 100%;
    left: 0;
    transform: translateY(10px);
    width: 180px;
    color: #FFB800;
    border: 1px solid rgba(255, 184, 0, 0.2);
    background-color: rgba(17, 17, 17, 0.95);
    text-align: left;
}

/* Ensure all tooltips have consistent padding and font */
[data-tooltip]::before,
.rate-tooltip,
.interval-icon[data-tooltip]::before,
.oi-rank-header .info-icon[data-tooltip]::before {
    padding: 8px 12px;
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    text-align: left;
}

/* Ensure monospace font for rate values in tooltips */
.rate-tooltip {
    font-family: 'Chivo Mono', monospace;
}

/* Warning icons styling */
.interval-icon.warning-topright {
    position: absolute;
    top: 2px;
    right: -3px;
    margin-right: 4px;
    margin-top: 0;
    color: #FFC107;
    font-size: 0;
    line-height: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 193, 7, 0.3);
    z-index: 5;
    text-transform: none;
    text-align: left;
}

.interval-icon.warning-topright svg {
    width: 10px;
    height: 10px;
}

/* No opportunities message */
.no-opportunities-message {
    width: 100%;
    padding: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin: 10px 0;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-opps-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #888;
    font-family: 'Inter', sans-serif;
}

.no-opps-content svg {
    opacity: 0.6;
}

/* Click hint badge */
.click-hint-badge {
    position: absolute;
    top: 8px;
    right: 12px;
    background: #222;
    color: #fff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    z-index: 20;
    border: 1px solid #4CAF50;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: click-hint-bounce 0.7s cubic-bezier(.68, -0.55, .27, 1.55) 0s 3;
    opacity: 1;
    transition: opacity 0.5s;
    font-family: 'Inter', sans-serif;
}

@keyframes click-hint-bounce {
    0% {
        transform: translateY(0);
    }

    20% {
        transform: translateY(-10px);
    }

    40% {
        transform: translateY(0);
    }

    60% {
        transform: translateY(-6px);
    }

    80% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(0);
    }
}

/* Utility classes */
.visible {
    display: block;
}

.hidden {
    display: none;
}

/* Media queries */
@media (max-width: 1400px) {
    .opportunities {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1200px) {
    .opportunities {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .opportunities {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .outer-container {
        padding: 4px;
    }

    /* Aggressively reduce vertical spacing */
    .content-wrapper {
        padding-bottom: 8px;
        gap: 4px;
    }

    .quick-filters {
        padding: 0.25rem;
        margin-bottom: 4px;
        border-radius: 3px;
    }

    .quick-filters-header {
        padding: 4px 8px !important;
        margin-bottom: 4px !important;
        min-height: 0 !important;
        gap: 8px !important;
        background: none;
    }

    .quick-filters-title {
        margin: 0 !important;
    }

    .quick-filters-title h2 {
        font-size: 12px !important;
        line-height: 1 !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    .info-icon {
        margin-left: 2px;
        padding: 2px;
    }

    .info-icon svg {
        width: 12px;
        height: 12px;
    }

    /* Compact countdown */
    .countdown {
        padding: 2px 6px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .countdown-label {
        display: none;
    }

    .countdown-next-time {
        font-size: 0.65rem;
        margin-left: 2px;
    }

    /* Table controls */
    .table-controls {
        margin: 4px 0;
        gap: 6px;
    }

    .control-box {
        height: 32px;
    }

    /* Larger table scrollbar */
    .table-container {
        margin: 0 -4px;
        width: calc(100% + 8px);
    }

    .table-container::-webkit-scrollbar {
        width: 24px !important;
        height: 24px !important;
    }

    .table-container::-webkit-scrollbar-thumb {
        background: #555 !important;
        border-radius: 12px !important;
        border: 3px solid #111111 !important;
        min-height: 100px !important;
        min-width: 100px !important;
    }

    .table-container::-webkit-scrollbar-thumb:hover {
        background: #666 !important;
    }

    .table-container::-webkit-scrollbar-track {
        background: #1a1a1a !important;
        border-radius: 12px !important;
    }

    /* Firefox table scrollbar */
    .table-container {
        scrollbar-width: large !important;
        scrollbar-color: #555 #1a1a1a !important;
    }

    /* Compact search and filter boxes */
    .search-container,
    .exchange-filters,
    .oi-rank-filter {
        width: 33% !important;
        margin: 0 !important;
    }

    .search-container input,
    .exchange-filters-header,
    .oi-rank-header {
        font-size: 13px;
    }

    .oi-rank-filter {
        padding: 4px 8px;
        gap: 2px;
    }

    .oi-rank-header {
        font-size: 12px;
    }

    .oi-rank-values {
        font-size: 11px;
    }

    .oi-rank-sliders {
        height: 16px;
    }

    .oi-rank-slider::-webkit-slider-thumb {
        width: 10px;
        height: 10px;
    }

    .oi-rank-slider::-moz-range-thumb {
        width: 10px;
        height: 10px;
    }

    /* More compact table header */
    #fundingRatesTable th {
        padding: 6px 4px;
        height: auto;
    }

    .exchange-header {
        padding: 4px 0;
    }

    .exchange-logo {
        width: 16px;
        height: 16px;
        margin-bottom: 2px;
    }

    .exchange-header span {
        font-size: 11px;
    }

    .exchange-filters-inner {
        max-height: 65vh;
        /* Reduced max-height for mobile */
        padding-bottom: 20px;
        /* Add some padding at the bottom */
    }

    .oi-rank-filter {
        display: none;
    }

    .search-container {
        width: 65%;
    }

    .exchange-filters {
        width: 35%;
    }

    /* Reduce minimum exchange column width on mobile */
    #fundingRatesTable th:nth-child(n+4),
    #fundingRatesTable td:nth-child(n+4) {
        min-width: 50px !important;
        /* Smaller minimum width for mobile */
    }
}

/* Custom scrollbar styling - for all screen sizes */
.table-container::-webkit-scrollbar {
    width: 24px;
    height: 24px;
}

.table-container::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 12px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 12px;
    border: 3px solid #111111;
    min-height: 150px;
    min-width: 100px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Firefox scrollbar styling */
.table-container {
    scrollbar-width: large;
    scrollbar-color: #555 #1a1a1a;
}

/* Scroll indicator for mobile */
.scroll-indicator {
    position: absolute;
    right: 10px;
    bottom: 50%;
    width: 30px;
    height: 30px;
    opacity: 0.5;
    z-index: 3;
    animation: scrollPulse 2s infinite;
    pointer-events: none;
}

@keyframes scrollPulse {
    0% {
        transform: translateX(0);
        opacity: 0.7;
    }

    50% {
        transform: translateX(10px);
        opacity: 0.3;
    }

    100% {
        transform: translateX(0);
        opacity: 0.7;
    }
}

/* Mobile scroll hint */
.mobile-scroll-hint {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 10;
    animation: pulse 1.5s infinite;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0.9;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.mobile-scroll-hint.fading {
    opacity: 0;
}

.mobile-scroll-hint svg {
    stroke: #fff;
    width: 28px;
    height: 28px;
    stroke-width: 1.5;
}

@keyframes pulse {
    0% {
        transform: translateY(-50%) scale(1);
        opacity: 0.9;
    }

    50% {
        transform: translateY(-50%) scale(1.1);
        opacity: 1;
    }

    100% {
        transform: translateY(-50%) scale(1);
        opacity: 0.9;
    }
}

/* Table scroll indicator */
.table-scroll-indicator {
    position: fixed;
    bottom: 80px;
    /* Above the scrollbar */
    right: 50px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(42, 42, 42, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #00e5af;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: auto;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: bounceRight 0.6s ease-in-out 3;
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.2s ease;
}

.table-scroll-indicator:hover {
    background: rgba(42, 42, 42, 0.95);
    transform: translateX(4px);
}

.table-scroll-indicator.hidden {
    opacity: 0;
    pointer-events: none;
}

.table-scroll-indicator svg {
    stroke: #00e5af;
    flex-shrink: 0;
}

@keyframes bounceRight {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(8px);
    }
}

/* Hide on mobile */
@media (max-width: 768px) {
    .table-scroll-indicator {
        display: none;
    }
}