﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    background: #050508;
    color: #E5E7EB;
    min-height: 100vh;
    padding: 20px;
    font-size: 0.75rem;
    line-height: 1.5;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 24px;
    padding: 20px 0;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    color: #F3F4F6;
    letter-spacing: -0.02em;
}

.controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    max-width: 280px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #E5E7EB;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.search-input::placeholder {
    color: #6B7280;
}

.search-input:focus {
    outline: none;
    border-color: rgba(91, 141, 239, 0.5);
    background: rgba(255, 255, 255, 0.08);
}



.control-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.toggle-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #9CA3AF;
}

.toggle-btn:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: #E5E7EB;
}

.toggle-btn.active {
    background: rgba(91, 141, 239, 0.15);
    border-color: rgba(91, 141, 239, 0.4);
    color: #5B8DEF;
}

.calculator-btn {
    background: linear-gradient(135deg, #10B981, #059669);
    border: none;
    color: white;
}

.calculator-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
}

.toggle-btn {
    background: rgba(91, 141, 239, 0.15);
    border: 1px solid rgba(91, 141, 239, 0.3);
    color: #5B8DEF;
}

.toggle-btn:hover {
    background: rgba(91, 141, 239, 0.25);
}

.toggle-btn.active {
    background: rgba(91, 141, 239, 0.3);
    border-color: #5B8DEF;
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    flex: 1;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.display-toggle-wrapper {
    display: flex;
    gap: 8px;
}

.display-toggle-btn {
    padding: 8px 16px;
    background: rgba(91, 141, 239, 0.15);
    border: 1px solid rgba(91, 141, 239, 0.3);
    border-radius: 6px;
    color: #5B8DEF;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.display-toggle-btn:hover {
    background: rgba(91, 141, 239, 0.25);
    border-color: rgba(91, 141, 239, 0.5);
}

.display-toggle-btn.active {
    background: rgba(91, 141, 239, 0.3);
    border-color: #5B8DEF;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(15, 17, 23, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #E5E7EB;
    font-size: 0.75rem;
}

.search-box input:focus {
    outline: none;
    border-color: rgba(91, 141, 239, 0.5);
    background: rgba(15, 17, 23, 0.8);
}

.calculator-wrapper {
    display: flex;
    gap: 8px;
}

.calculator-btn {
    padding: 8px 16px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 6px;
    color: #22C55E;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.calculator-btn:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.5);
}

.market-count {
    color: #9CA3AF;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Full screen loading overlay */
.full-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #050508;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.3s ease-out;
}

.full-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: #E5E7EB;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(91, 141, 239, 0.2);
    border-top-color: #5B8DEF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

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

.loading-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #F3F4F6;
    margin-bottom: 12px;
}

.loading-content p {
    font-size: 0.875rem;
    color: #9CA3AF;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #9CA3AF;
    display: none; /* Hide old loading indicator */
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    padding: 12px;
    color: #EF4444;
    margin-bottom: 20px;
}

.top-arbitrage-container {
    margin-bottom: 30px;
}

.top-arbitrage-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
}

.top-arbitrage-header::before {
    content: "";
}

.top-arbitrage-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #9CA3AF;
    margin: 0;
    text-align: center;
    justify-self: center;
}

.top-arbitrage-header .controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    justify-self: end;
}

.top-arbitrage-header .search-input {
    max-width: 180px;
    padding: 6px 12px;
    font-size: 0.8rem;
}

.top-arbitrage-header .control-btn {
    padding: 6px 14px;
    font-size: 0.75rem;
}

.top-arbitrage-search {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.top-arbitrage-search .search-input {
    width: 100%;
    max-width: 300px;
    padding: 10px 14px;
    background: rgba(15, 17, 23, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #E5E7EB;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.top-arbitrage-search .search-input:focus {
    outline: none;
    border-color: rgba(91, 141, 239, 0.5);
    background: rgba(15, 17, 23, 1);
}

.top-arbitrage-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 30px;
}

@media (max-width: 900px) {
    .top-arbitrage-cards {
        grid-template-columns: 1fr;
    }
}

.arbitrage-card {
    background: rgba(15, 17, 23, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    transition: all 0.2s ease;
}

.arbitrage-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(15, 17, 23, 0.8);
}

.card-rank {
    position: absolute;
    top: 12px;
    right: 12px;
    color: #6B7280;
    font-size: 0.75rem;
    font-weight: 600;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.card-ticker {
    font-size: 1.4rem;
    font-weight: 700;
    color: #F3F4F6;
    text-align: center;
    letter-spacing: -0.01em;
}

.card-profit {
    font-size: 2.2rem;
    font-weight: 700;
    color: #22C55E;
    text-align: center;
    line-height: 1.2;
}

.card-apr-value {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6B7280;
}

.card-strategy {
    margin-top: 4px;
    width: 100%;
}

.table-container {
    overflow-x: auto;
    background: rgba(15, 17, 23, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    margin: 0 auto;
    table-layout: fixed;
}

thead {
    background: rgba(15, 17, 23, 0.8);
}

th {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    color: #D1D5DB;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    background: rgba(15, 17, 23, 0.95);
    z-index: 10;
}

th:first-child {
    width: 110px;
    min-width: 110px;
    max-width: 110px;
}

/* Exchange columns (Variational, Binance, Bybit, Hyperliquid, Lighter) */
th:nth-child(2),
th:nth-child(3),
th:nth-child(4),
th:nth-child(5),
th:nth-child(6) {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

td:nth-child(2),
td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6) {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

/* Arbitrage column (last column) */
th:last-child {
    border-right: none;
    width: 240px;
    min-width: 240px;
    max-width: 240px;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px;
}

th.sortable:hover {
    color: #5B8DEF;
}

.sort-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: #6B7280;
}

th.sortable.asc .sort-icon::after {
    content: '??;
    color: #5B8DEF;
}

th.sortable.desc .sort-icon::after {
    content: '??;
    color: #5B8DEF;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    color: #D1D5DB;
    text-align: center;
}

td.ticker {
    font-size: 1.1rem;
    font-weight: 700;
    color: #F3F4F6;
    position: relative;
    width: 110px;
    min-width: 110px;
    max-width: 110px;
    text-align: center;
}

td:last-child {
    border-right: none;
}

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.positive {
    color: #22C55E;
}

.negative {
    color: #EF4444;
}

.neutral {
    color: #9CA3AF;
}

.funding-rate-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.funding-rate-line {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}

.funding-annual {
    font-size: 0.9rem;
    font-weight: 600;
}

.funding-interval-time {
    font-size: 0.75rem;
    font-weight: 500;
    color: #9CA3AF;
}

.funding-interval {
    font-size: 0.65rem;
    font-weight: 400;
    color: #6B7280;
}

.strategy-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.strategy-button {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    width: 100%;
    max-width: 200px;
}

.strategy-button.long {
    background: rgba(34, 197, 94, 0.2);
    color: #22C55E;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.strategy-button.short {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.strategy-button:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

.strategy-separator {
    color: #6B7280;
    font-size: 0.5rem;
    font-weight: 600;
    white-space: nowrap;
    padding: 0 1px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: 2;
}

/* Arbitrage column styling */
.strategy-cell {
    color: #D1D5DB;
    text-align: center;
    padding: 8px 6px;
    vertical-align: middle;
    width: 240px;
    max-width: 240px;
    min-width: 240px;
    box-sizing: border-box;
    overflow: hidden;
}

.strategy-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.strategy-profit-large {
    font-size: 1.2rem;
    font-weight: 700;
    color: #22C55E;
    text-align: center;
    line-height: 1.2;
    width: 100%;
}

.strategy-apr {
    font-size: 0.7rem;
    font-weight: 500;
    color: #9CA3AF;
    text-align: center;
    margin-top: -2px;
}

.strategy-apr span {
    color: #5B8DEF;
    font-weight: 600;
}

.strategy-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Horizontal row layout for strategy actions with arrow separator */
.strategy-actions-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap;
}

.strategy-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 500;
    white-space: nowrap;
    box-sizing: border-box;
    justify-content: center;
}

.strategy-item.long {
    background: rgba(34, 197, 94, 0.15);
    color: #22C55E;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.strategy-item.short {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.strategy-item .strategy-icon {
    font-size: 0.75rem;
    line-height: 1;
    flex-shrink: 0;
}

.strategy-item .strategy-exchange {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50px;
    font-size: 0.6rem;
}

.strategy-item .strategy-label {
    font-weight: 700;
    flex-shrink: 0;
    font-size: 0.6rem;
    text-transform: uppercase;
}

.strategy-separator-arrow {
    color: #6B7280;
    font-size: 0.8rem;
    font-weight: 400;
    padding: 0 2px;
}

/* Direction labels for strategy display */
.strategy-direction-label {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.strategy-exchange-full {
    font-weight: 600;
    font-size: 0.65rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Top 3 cards strategy display with rows */
.strategy-simple {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    width: 100%;
}

.strategy-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.direction-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    min-width: 45px;
    text-align: center;
}

.long-label {
    background: rgba(34, 197, 94, 0.2);
    color: #22C55E;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.short-label {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Top 3 cards horizontal row layout for Long/Short exchanges */
.strategy-simple-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    flex-wrap: nowrap;
}

.exchange-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.direction-label-inline {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.exchange-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #E5E7EB;
}

.long-item .exchange-name {
    color: #22C55E;
}

.short-item .exchange-name {
    color: #EF4444;
}

/* Table arbitrage column - smaller version of top 3 cards style */
.table-strategy-row {
    gap: 4px;
}

.table-strategy-row .exchange-item {
    gap: 4px;
    font-size: 0.75rem;
}

.table-strategy-row .direction-label-inline {
    font-size: 0.6rem;
    padding: 2px 6px;
}

.table-strategy-row .exchange-name {
    font-size: 0.7rem;
}

/* Arrow separator for arbitrage display - elegant gradient design */
.arrow-separator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
}

.arrow-separator svg {
    width: 28px;
    height: 14px;
}

/* Larger arrow for Top 3 cards */
.strategy-simple-row .arrow-separator svg {
    width: 32px;
    height: 16px;
}

/* Smaller arrow for table rows */
.strategy-actions-row .arrow-separator svg {
    width: 24px;
    height: 12px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: rgba(15, 17, 23, 0.95);
    margin: 5% auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #F3F4F6;
}

.modal-close {
    color: #9CA3AF;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #EF4444;
}

.modal-body {
    padding: 24px;
}

.calculator-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.calculator-inputs h3,
.calculator-results h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #F3F4F6;
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #D1D5DB;
}

.form-control {
    padding: 10px 12px;
    background: rgba(15, 17, 23, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #E5E7EB;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: rgba(91, 141, 239, 0.5);
    background: rgba(15, 17, 23, 1);
}

.form-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.calculator-results {
    padding: 20px;
    background: rgba(15, 17, 23, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.result-card {
    padding: 16px;
    background: rgba(15, 17, 23, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-align: center;
}

.result-card .result-label {
    font-size: 0.75rem;
    color: #9CA3AF;
    margin-bottom: 8px;
    font-weight: 500;
}

.result-value-large {
    font-size: 1.25rem;
    font-weight: 700;
    color: #22C55E;
}

.result-value-large.negative {
    color: #EF4444;
}

.result-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #22C55E;
}

.result-value.negative {
    color: #EF4444;
}

.calc-note {
    margin-top: 16px;
    padding: 12px;
    background: rgba(91, 141, 239, 0.1);
    border-radius: 6px;
    text-align: center;
}

.calc-note small {
    font-size: 0.75rem;
}

@media (max-width: 1200px) {
    .calculator-layout {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}





