:root {
    --bg-color: #0d1117;
    --card-bg: #161b22;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --border: #30363d;
    --short-bg: rgba(248, 81, 73, 0.15);
    --short-color: #f85149;
    --long-bg: rgba(63, 185, 80, 0.15);
    --long-color: #3fb950;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 200px;
    /* Ensure logo doesn't crush */
}

.logo i {
    color: var(--accent);
    font-size: 24px;
}

.logo h1 {
    font-size: 20px;
    font-weight: 600;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping on mobile */
    gap: 12px;
    align-items: flex-end;
    justify-content: flex-start;
    /* Align left logic on mobile */
}

/* Desktop: No wrap for filters to prevent shifting */
@media (min-width: 1024px) {
    .filters {
        flex-wrap: nowrap;
        justify-content: flex-end;
        flex: 2;
    }
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    /* Prevent inputs from squishing */
}

/* ... existing inputs ... */

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--long-color);
    background: var(--long-bg);
    padding: 6px 12px;
    border-radius: 20px;
    white-space: nowrap;
    /* Keep text on one line */
    flex-shrink: 0;
}

.filter-group label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
}

input,
select {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

input:focus,
select:focus {
    border-color: var(--accent);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--long-color);
    background: var(--long-bg);
    padding: 6px 12px;
    border-radius: 20px;
    margin-left: auto;
}

.status-indicator.offline {
    color: var(--short-color);
    background: var(--short-bg);
}

.total-count {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-end;
    padding-bottom: 4px;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: currentColor;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* Table Styles */
.table-container {
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 50px 1fr 1fr 1fr 80px 70px;
    padding: 12px 16px;
    background-color: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.liquidation-item {
    display: grid;
    grid-template-columns: 50px 1fr 1fr 1fr 80px 70px;
    padding: 14px 16px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    transition: background-color 0.2s;
    animation: slideIn 0.3s ease-out;
}

.liquidation-item:last-child {
    border-bottom: none;
}

.liquidation-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.col-icon img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: contain;
}

.col-pair {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-link {
    color: var(--text-secondary);
    font-size: 12px;
    opacity: 0.5;
    transition: opacity 0.2s;
    text-decoration: none;
}

.chart-link:hover {
    opacity: 1;
    color: var(--accent);
}

.col-price {
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
}

.col-amount {
    font-weight: 600;
}

.side-badge {
    padding: 4px 8px;
    border-radius: 12px;
    /* Pill shape */
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    display: inline-block;
    min-width: 50px;
    text-align: center;
}

.side-short {
    background-color: rgba(105, 240, 174, 0.2);
    /* Light Green bg */
    color: var(--short-color);
    border: 1px solid var(--short-color);
}

.side-long {
    background-color: rgba(255, 82, 82, 0.2);
    /* Light Red bg */
    color: var(--long-color);
    border: 1px solid var(--long-color);
}

/* Row background coloring for visual impact (like in the image) */
/* Standard Liquidations */
/* Long Liq (Price fell) -> Red */
.row-long {
    background-color: rgba(255, 82, 82, 0.1);
    border-left: 3px solid var(--short-color);
}

/* Short Liq (Price rose) -> Green */
.row-short {
    background-color: rgba(105, 240, 174, 0.1);
    border-left: 3px solid var(--long-color);
}

/* --- TIERED HIGHLIGHTING --- */

/* Medium Tier ($25k+) - Slightly saturated */
.liq-medium-long {
    background-color: rgba(255, 82, 82, 0.25) !important;
    border-left: 3px solid #ff5252 !important;
}

.liq-medium-short {
    background-color: rgba(105, 240, 174, 0.25) !important;
    border-left: 3px solid #69f0ae !important;
}

/* Large Tier ($100k+) - Darker, Bold */
.liq-large-long {
    background-color: rgba(183, 28, 28, 0.6) !important;
    /* Dark Red */
    border-left: 4px solid #ff1744 !important;
    color: #ffebee;
}

.liq-large-short {
    background-color: rgba(27, 94, 32, 0.6) !important;
    /* Dark Green */
    border-left: 4px solid #00e676 !important;
    color: #e8f5e9;
}

/* Mega Tier ($500k+) - Very Dark + Accent */
.liq-mega-long {
    background-color: rgba(120, 0, 0, 0.85) !important;
    /* Deepest Red */
    border-left: 5px solid #ffd700 !important;
    /* Gold Border */
    box-shadow: inset 0 0 10px rgba(255, 0, 0, 0.2);
    color: #fff;
    font-weight: bold;
}

.liq-mega-short {
    background-color: rgba(0, 70, 0, 0.85) !important;
    /* Deepest Green */
    border-left: 5px solid #ffd700 !important;
    /* Gold Border */
    box-shadow: inset 0 0 10px rgba(0, 255, 0, 0.2);
    color: #fff;
    font-weight: bold;
}

.col-time {
    color: var(--text-secondary);
    font-size: 12px;
    text-align: right;
}

.loading-state {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.loading-state i {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--accent);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile Responsive Table and Layout */
@media (max-width: 600px) {

    .table-header,
    .liquidation-item {
        /* Icon | Pair | Amount | Side | Time */
        grid-template-columns: 30px 1fr 0.7fr 50px 50px;
        font-size: 11px;
        padding: 10px 6px;
        gap: 8px;
        /* Slightly larger gap */
    }

    /* Hide Price only */
    .col-price {
        display: none;
    }

    .col-side {
        display: flex;
        justify-content: center;
        transform: scale(0.9);
    }

    /* Show Time */
    .col-time {
        display: block;
        font-size: 11px;
    }

    .col-amount {
        text-align: right;
        font-size: 12px;
    }

    .col-pair {
        font-size: 12px;
    }
}

/* Sidebar Layout */
.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.table-container {
    flex: 1;
}

.sidebar {
    width: 300px;
    /* Removed container styles to allow splitting */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    /* Removed border-bottom logic as they are now separate cards */
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
}

.natr-value.gain-pos {
    color: #69f0ae;
    /* Light Green */
    font-weight: 600;
}

.natr-value.gain-neg {
    color: #ff5252;
    /* Light Red */
    font-weight: 600;
}

.natr-header {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.natr-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    transition: var(--transition);
    cursor: pointer;
}

.natr-item:last-child {
    border-bottom: none;
}

.natr-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.natr-coin {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.natr-exchange-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    opacity: 0.7;
}

.natr-value {
    font-family: 'Roboto Mono', monospace;
    color: var(--accent);
    font-weight: 500;
}

.loading-state-small {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Responsive Sidebar */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }

    .table-container {
        width: 100%;
    }

    .sidebar {
        width: 100%;
        /* order: -1; Removed to move sidebar to bottom */
        /* Show sidebar on top or bottom? Prompt didnt specify. Top might be annoying if long. Let's keep default (bottom) or move to top? Let's leave order normal (bottom on mobile) */
        margin-bottom: 20px;
        margin-bottom: 20px;
    }
}

/* Bottom Pagination specific styles - REMOVED */
/* Override for spacing */
.sidebar-section {
    margin-bottom: 2px !important;
}

.sidebar-section:last-child {
    margin-bottom: 0 !important;
}

/* User Requested Style Updates */
.natr-item {
    background: #141E30;
    /* fallback for old browsers */
    background: -webkit-linear-gradient(to right, #243B55, #141E30);
    /* Chrome 10-25, Safari 5.1-6 */
    background: linear-gradient(to right, #243B55, #141E30);
    /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}

.sidebar-section {
    border: 0px !important;
}

/* Settings Button */
.settings-btn {
    background: #0a4086;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #ffffff;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: -5px;
}

.settings-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

/* Modal Content */
.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--danger);
}

/* Modal Body */
.modal-body {
    padding: 20px;
}

.setting-group {
    margin-bottom: 24px;
}

.setting-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.setting-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0 0 12px 0;
}

.setting-group input[type="text"],
.setting-group input[type="number"] {
    width: 100%;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    box-sizing: border-box;
}

.setting-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.setting-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.setting-row input[type="number"] {
    width: 120px;
}

/* Modal Footer */
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    text-align: right;
}

.btn-save {
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-save:hover {
    background: #3a7bd5;
}

#min-volume {
    width: 120px;
}

.filter-group.pagination-controls {
    margin: 0 0 4px 0 !important;
}


/* Split-Flap Airport Display Animation */
@keyframes splitFlapFlip {
    0% {
        transform: perspective(400px) rotateX(-90deg);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: perspective(400px) rotateX(0deg);
        opacity: 1;
    }
}

/* Container for new rows - disable default slideIn */
.airport-row {
    animation: none !important;
}

/* Each cell in the row gets a staggered flip animation */
.airport-row > div {
    transform-origin: center top;
    animation: splitFlapFlip 0.4s ease-out forwards;
    opacity: 0;
    backface-visibility: hidden;
}

/* Stagger each column */
.airport-row > div:nth-child(1) { animation-delay: 0s; }
.airport-row > div:nth-child(2) { animation-delay: 0.05s; }
.airport-row > div:nth-child(3) { animation-delay: 0.1s; }
.airport-row > div:nth-child(4) { animation-delay: 0.15s; }
.airport-row > div:nth-child(5) { animation-delay: 0.2s; }
.airport-row > div:nth-child(6) { animation-delay: 0.25s; }
