@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #141822;
    min-height: 100vh;
    padding: 20px;
    color: #B8B8B8;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(91, 141, 239, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 204, 119, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    background: rgba(20, 24, 34, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.02);
    padding: 48px 40px;
    border: 1px solid rgba(91, 141, 239, 0.12);
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.logo-container {
    margin-bottom: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-full,
.logo-fallback {
    height: 48px;
    width: auto;
    opacity: 1;
    display: block;
    object-fit: contain;
    max-width: 100%;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

header h1 {
    font-size: 4rem;
    color: #D0D0D0;
    margin-bottom: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.subtitle {
    color: #6B6B6B;
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    justify-content: center;
}

.refresh-btn {
    background: linear-gradient(135deg, #5B8DEF 0%, #4A7DE8 100%);
    color: #FFFFFF;
    border: none;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 12px rgba(91, 141, 239, 0.25);
    position: relative;
    overflow: hidden;
}

.refresh-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s;
}

.refresh-btn:hover::before {
    left: 100%;
}

.refresh-btn:hover {
    background: linear-gradient(135deg, #6C9EFF 0%, #5B8DEF 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(91, 141, 239, 0.35);
}

.refresh-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(91, 141, 239, 0.3);
}

.refresh-btn:active {
    transform: translateY(0);
}

.search-box {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid rgba(91, 141, 239, 0.18);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
    background: rgba(20, 24, 34, 0.6);
    color: #B8B8B8;
    backdrop-filter: blur(10px);
}

.search-box input:focus {
    outline: none;
    border-color: #5B8DEF;
    background: rgba(20, 24, 34, 0.8);
    box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.12);
}

.search-box input::placeholder {
    color: #555;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.stat-card {
    background: rgba(20, 24, 34, 0.6);
    backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(91, 141, 239, 0.15);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #5B8DEF, transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    border-color: rgba(91, 141, 239, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(91, 141, 239, 0.12);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-label {
    font-size: 0.95rem;
    color: #6B6B6B;
    margin-bottom: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: #D0D0D0;
    letter-spacing: -0.02em;
}

.loading {
    text-align: center;
    padding: 40px;
    display: none;
}

.loading.show {
    display: block;
}

.spinner {
    border: 3px solid rgba(91, 141, 239, 0.15);
    border-top: 3px solid #5B8DEF;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
    box-shadow: 0 0 20px rgba(91, 141, 239, 0.25);
}

.loading p {
    color: #6B6B6B;
    font-weight: 500;
    font-size: 1.1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.table-container {
    overflow-x: auto;
    overflow-y: visible;
    border-radius: 16px;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(91, 141, 239, 0.15);
    background: rgba(20, 24, 34, 0.5);
    backdrop-filter: blur(10px);
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    background: transparent;
    table-layout: auto;
}

thead {
    background: rgba(20, 24, 34, 0.95);
    color: #D0D0D0;
    border-bottom: 2px solid #5B8DEF;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 18px 16px;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    white-space: normal;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #6B6B6B;
    word-wrap: break-word;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.3s;
}

th.sortable:hover {
    background-color: rgba(91, 141, 239, 0.1);
    color: #5B8DEF;
}

.sort-icon {
    margin-left: 8px;
    font-size: 0.8rem;
    opacity: 0.6;
    display: inline-block;
    transition: opacity 0.2s;
}

th.sortable:hover .sort-icon {
    opacity: 1;
}

th.sort-asc .sort-icon,
th.sort-desc .sort-icon {
    opacity: 1;
    color: #5B8DEF;
}

th.sort-asc,
th.sort-desc {
    color: #5B8DEF;
    background-color: rgba(91, 141, 239, 0.08);
}

tbody tr {
    border-bottom: 1px solid rgba(91, 141, 239, 0.08);
    transition: all 0.2s;
    background: transparent;
}

tbody tr:hover {
    background-color: rgba(91, 141, 239, 0.06);
    border-left: 2px solid rgba(91, 141, 239, 0.3);
}

td {
    padding: 18px 16px;
    font-size: 1.1rem;
    color: #B8B8B8;
    text-align: center;
    word-wrap: break-word;
}

.ticker {
    font-weight: 700;
    color: #5B8DEF;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

.name {
    color: #6B6B6B;
    font-weight: 400;
}

.oi-value {
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.long-oi {
    color: #00CC77;
    font-weight: 600;
}

.short-oi {
    color: #CC5555;
    font-weight: 600;
}

.difference {
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.difference.positive {
    color: #10b981;
}

.difference.negative {
    color: #ef4444;
}

.ratio-cell {
    text-align: center;
}

.ratio {
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.ratio.long-heavy {
    background-color: rgba(0, 204, 119, 0.12);
    color: #00CC77;
    border: 1px solid rgba(0, 204, 119, 0.25);
    box-shadow: 0 2px 8px rgba(0, 204, 119, 0.08);
}

.ratio.short-heavy {
    background-color: rgba(204, 85, 85, 0.12);
    color: #CC5555;
    border: 1px solid rgba(204, 85, 85, 0.25);
    box-shadow: 0 2px 8px rgba(204, 85, 85, 0.08);
}

.ratio.na {
    background-color: rgba(107, 107, 107, 0.15);
    color: #6B6B6B;
    border: 1px solid rgba(107, 107, 107, 0.3);
    box-shadow: 0 2px 8px rgba(107, 107, 107, 0.08);
}

.mark-price {
    color: #6B6B6B;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.funding-rate {
    color: #B8B8B8;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.error-message {
    background-color: rgba(204, 85, 85, 0.1);
    color: #CC5555;
    padding: 16px 24px;
    border-radius: 12px;
    margin-top: 24px;
    text-align: center;
    font-weight: 500;
    border: 1px solid rgba(204, 85, 85, 0.25);
    backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    body {
        padding: 12px;
        align-items: flex-start;
        overflow-x: hidden;
    }

    .container {
        padding: 24px 16px;
        border-radius: 20px;
    }

    .logo {
        height: 40px;
    }

    header h1 {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    th, td {
        padding: 12px 16px;
        font-size: 0.85rem;
    }

    .stats-summary {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

