/* Mobile-first base styles */
:root {
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
}

body {
    background-color: #0d1117;
    color: #c9d1d9;
    min-height: 100vh;
    font-size: var(--font-size-base);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* Prevent horizontal scroll */
    position: relative; /* Create new stacking context */
    width: 100%;
}

/* Responsive container padding */
.container-fluid {
    padding: var(--spacing-sm);
    max-width: 100%;
    overflow-x: hidden;
}
@media (min-width: 768px) {
    .container-fluid {
        padding: var(--spacing-lg);
    }
}

/* Responsive headings */
h1 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-md);
}
@media (min-width: 768px) {
    h1 {
        font-size: 2rem;
        margin-bottom: var(--spacing-lg);
    }
}

/* Mobile-optimized table */
.table-responsive {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #30363d #161b22;
    max-width: 100vw;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #161b22;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: #30363d;
    border-radius: 3px;
}

.table {
    table-layout: fixed; /* Improves rendering performance for large tables */
    margin-bottom: 0;
    white-space: nowrap;
}

.table th {
    position: sticky;
    top: 0;
    background-color: #21262d !important;
    z-index: 10;
}

/* Optimize table cell padding for mobile */
.table td, .table th {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
}
@media (min-width: 768px) {
    .table td, .table th {
        padding: var(--spacing-md);
        font-size: var(--font-size-base);
    }
}

/* Stats cards mobile optimization */
.stats-card {
    margin-bottom: var(--spacing-md);
}
.stats-card .card-body {
    padding: var(--spacing-md) !important;
}
.stats-card .card-title {
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-sm);
}
.stats-card h3 {
    font-size: var(--font-size-lg);
}
@media (min-width: 768px) {
    .stats-card .card-body {
        padding: var(--spacing-lg) !important;
    }
    .stats-card .card-title {
        font-size: var(--font-size-base);
    }
    .stats-card h3 {
        font-size: 2rem;
    }
}

/* Mobile-optimized filter section */
.filter-section {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}
@media (min-width: 768px) {
    .filter-section {
        padding: var(--spacing-lg);
        margin-bottom: var(--spacing-lg);
    }
}

/* Optimize month buttons for mobile */
.month-btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
    min-width: auto;
    flex: 1 1 auto;
    white-space: nowrap;
}
@media (min-width: 768px) {
    .month-btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: var(--font-size-base);
        min-width: 120px;
        flex: 0 1 auto;
    }
}

/* Optimize loading spinner */
.loading {
    background-color: rgba(13, 17, 23, 0.9);
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
}
@media (min-width: 768px) {
    .loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }
}

/* Performance optimizations */
.trade-row {
    opacity: 1 !important; /* Force opacity to be visible */
    animation: fadeIn 0.5s ease forwards;
    visibility: visible !important; /* Ensure visibility */
    display: table-row !important; /* Force display as table row */
}

@media (prefers-reduced-motion: reduce) {
    .trade-row, .stats-card, .month-btn {
        animation: none !important;
        transition: none !important;
    }
}

/* Dark theme base */
body {
    background-color: #0d1117;
    color: #c9d1d9;
    min-height: 100vh;
}

/* Date Range Picker Dark Theme */
.daterangepicker {
    background-color: #161b22 !important;
    border: 1px solid #30363d !important;
    color: #c9d1d9 !important;
}
.daterangepicker .calendar-table {
    background-color: #161b22 !important;
    border: none !important;
}
.daterangepicker td.off, 
.daterangepicker td.off.in-range, 
.daterangepicker td.off.start-date, 
.daterangepicker td.off.end-date {
    background-color: #21262d !important;
    color: #484f58 !important;
}
.daterangepicker td.available:hover {
    background-color: #30363d !important;
}
.daterangepicker td.active, 
.daterangepicker td.active:hover {
    background-color: #238636 !important;
    color: #ffffff !important;
}
.daterangepicker .drp-selected {
    color: #c9d1d9 !important;
}
.daterangepicker .calendar-table .next span, 
.daterangepicker .calendar-table .prev span {
    border-color: #c9d1d9 !important;
}
.daterangepicker .ranges li {
    color: #c9d1d9 !important;
    background-color: #161b22 !important;
}
.daterangepicker .ranges li:hover {
    background-color: #30363d !important;
}
.daterangepicker .ranges li.active {
    background-color: #238636 !important;
    color: #ffffff !important;
}
.daterangepicker select.hourselect,
.daterangepicker select.minuteselect,
.daterangepicker select.secondselect,
.daterangepicker select.ampmselect {
    background-color: #0d1117 !important;
    color: #c9d1d9 !important;
    border-color: #30363d !important;
}

/* Table Dark Theme */
.table {
    color: #c9d1d9 !important;
    background-color: #161b22 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}
.table thead th {
    background-color: #21262d !important;
    color: #c9d1d9 !important;
    border-color: #30363d !important;
    border-bottom-width: 2px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1 !important;
}
.table td {
    color: #c9d1d9 !important;
    border: 1px solid #30363d !important;
    background-color: #161b22 !important;
    position: relative !important;
}
.table tr {
    transition: background-color 0.2s !important;
    position: relative !important;
    z-index: 0 !important;
}
.table tr:hover td {
    background-color: #21262d !important;
    border-color: #30363d !important;
}
.table tbody tr:last-child td {
    border-bottom: 1px solid #30363d !important;
}

/* Ensure profit cells don't overlap borders */
.profit-cell {
    position: relative !important;
    z-index: 0 !important;
}
.profit-cell.high-profit {
    z-index: 0 !important;
}

/* Cards and Sections */
.card {
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.card-header {
    background-color: #21262d;
    border-bottom: 1px solid #30363d;
    color: #c9d1d9;
}
.filter-section {
    background-color: #161b22;
    padding: 1.5rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Form Controls */
.form-control, .form-select {
    background-color: #0d1117 !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
    padding: 0.375rem 0.75rem !important; /* Standardized padding */
}
.form-control:focus, .form-select:focus {
    background-color: #161b22 !important;
    border-color: #388bfd !important;
    color: #c9d1d9 !important;
    box-shadow: 0 0 0 0.25rem rgba(56, 139, 253, 0.25) !important;
}
.form-label {
    color: #c9d1d9 !important;
}

/* Trade Direction Styles */
.direction-long {
    color: #3fb950 !important;
    font-weight: bold;
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background-color: rgba(63, 185, 80, 0.1);
}
.direction-short {
    color: #f85149 !important;
    font-weight: bold;
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background-color: rgba(248, 81, 73, 0.1);
}

/* Profit/Loss Styles */
.profit-cell {
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: inline-block;
}
.profit-cell.positive {
    background-color: rgba(63, 185, 80, 0.1);
    color: #3fb950 !important;
    text-shadow: 0 0 10px rgba(63, 185, 80, 0.3);
}
.profit-cell.negative {
    background-color: rgba(248, 81, 73, 0.1);
    color: #f85149 !important;
    text-shadow: 0 0 10px rgba(248, 81, 73, 0.3);
}
.profit-cell.super-profit {
    background: linear-gradient(45deg, rgba(63, 185, 80, 0.2), rgba(46, 160, 67, 0.2));
    color: #3fb950 !important;
    text-shadow: 0 0 15px rgba(63, 185, 80, 0.5);
    animation: glowPulse 2s infinite;
    font-size: 1.1em;
    font-weight: 800;
}
@keyframes glowPulse {
    0% { box-shadow: 0 0 5px rgba(63, 185, 80, 0.5); }
    50% { box-shadow: 0 0 20px rgba(63, 185, 80, 0.8); }
    100% { box-shadow: 0 0 5px rgba(63, 185, 80, 0.5); }
}

/* Other existing styles... */
.btn-primary {
    background-color: #238636;
    border-color: #238636;
}
.btn-primary:hover {
    background-color: #2ea043;
    border-color: #2ea043;
}
.table tr {
    transition: background-color 0.2s;
}
.table tr:hover {
    background-color: #21262d;
}
.stats-card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    background-color: #1c2128 !important;
    border: 1px solid #30363d !important;
}
.stats-card .card-body {
    padding: 1.5rem !important;
}
.stats-card .card-title {
    color: #8b949e !important;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}
.stats-card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(45deg, #238636, #2ea043);
    -webkit-background-clip: text;
    background-clip: text;
    color: #3fb950 !important;
}
.stats-card .win-rate {
    transition: color 0.3s ease;
}
.stats-card .win-rate.high {
    color: #3fb950 !important;
    text-shadow: 0 0 10px rgba(63, 185, 80, 0.3);
}
.stats-card .win-rate.medium {
    color: #f0883e !important;
    text-shadow: 0 0 10px rgba(240, 136, 62, 0.3);
}
.stats-card .win-rate.low {
    color: #f85149 !important;
    text-shadow: 0 0 10px rgba(248, 81, 73, 0.3);
}
.stats-card .ratio-text {
    font-family: monospace;
    font-size: 1.8rem;
}
.stats-card .ratio-text .long-count {
    color: #3fb950 !important;
    text-shadow: 0 0 10px rgba(63, 185, 80, 0.3);
}
.stats-card .ratio-text .short-count {
    color: #f85149 !important;
    text-shadow: 0 0 10px rgba(248, 81, 73, 0.3);
}
.stats-card .ratio-text .separator {
    color: #8b949e !important;
    margin: 0 0.3rem;
}
.trade-row td {
    visibility: visible !important;
    opacity: 1 !important;
}
.trade-row {
    opacity: 1 !important; /* Force opacity to be visible */
    animation: fadeIn 0.5s ease forwards;
    visibility: visible !important; /* Ensure visibility */
    display: table-row !important; /* Force display as table row */
}

@keyframes fadeIn {
    from { 
        opacity: 0.7; /* Start from slightly visible */
        transform: translateY(5px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure table cells are visible */
.trade-row td {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fix for mobile devices */
@media (max-width: 768px) {
    .trade-row {
        display: block !important;
    }
    .trade-row td {
        display: flex !important;
    }
}

/* Modern Pill-Style Sortable Headers */
.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 45px !important;
    user-select: none;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.sortable:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    transform: translateY(-1px);
}

/* Default inactive sort indicator */
.sortable::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    opacity: 0.4;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Hover state for inactive sort */
.sortable:hover::after {
    opacity: 0.7;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Active ascending sort pill */
.sortable.asc::after {
    content: '▲';
    background: rgba(63, 185, 80, 0.2);
    border: 1px solid rgba(63, 185, 80, 0.4);
    color: #3fb950;
    opacity: 1;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 8px rgba(63, 185, 80, 0.6);
    box-shadow: 0 0 12px rgba(63, 185, 80, 0.3);
}

/* Active descending sort pill */
.sortable.desc::after {
    content: '▼';
    background: rgba(56, 139, 253, 0.2);
    border: 1px solid rgba(56, 139, 253, 0.4);
    color: #388bfd;
    opacity: 1;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 8px rgba(56, 139, 253, 0.6);
    box-shadow: 0 0 12px rgba(56, 139, 253, 0.3);
}

/* Pulse animation for active sorts */
.sortable.asc::after,
.sortable.desc::after {
    animation: sortPulse 2s infinite;
}

@keyframes sortPulse {
    0% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.05); }
    100% { transform: translateY(-50%) scale(1); }
}

/* Enhanced hover for active sorts */
.sortable.asc:hover::after {
    background: rgba(63, 185, 80, 0.3);
    border-color: rgba(63, 185, 80, 0.6);
    box-shadow: 0 0 16px rgba(63, 185, 80, 0.5);
}

.sortable.desc:hover::after {
    background: rgba(56, 139, 253, 0.3);
    border-color: rgba(56, 139, 253, 0.6);
    box-shadow: 0 0 16px rgba(56, 139, 253, 0.5);
}

/* Mobile-friendly table cards */
@media (max-width: 768px) {
    .table {
        white-space: normal !important;
    }

    .table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #30363d;
        border-radius: 8px;
        background: linear-gradient(to bottom, #161b22, #1c2128) !important;
        padding: 1rem;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    /* Remove only vertical lines (left/right), keep horizontal lines */
    .table td {
        border-left: none !important;
        border-right: none !important;
        border-bottom: 1px solid #21262d !important; /* keeps the horizontal line */
        /* Optionally, if you want a thin top line as well:
           border-top: 1px solid #21262d !important;
        */
    }

    .table td {
        display: flex;
        flex-direction: column;
        width: 100%;
        padding: 0.75rem 0;
        text-align: left;
        background: transparent !important;
    }
    
    .table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #8b949e;
        margin-bottom: 0.25rem;
    }

    /* Improve direction and profit display on mobile */
    .direction-long, .direction-short {
        display: inline-block;
        width: auto;
        text-align: left;
        margin: 0;
    }

    .profit-cell {
        display: inline-block;
        width: auto;
        text-align: left;
        margin: 0;
    }

    /* Hide table header on mobile */
    .table thead {
        display: none;
    }

    /* Last cell shouldn't have a border */
    .table td:last-child {
        border-bottom: none !important;
    }

    /* Optimize filter section */
    .filter-section {
        padding: 1rem;
    }
    
    .filter-section .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }
    
    .filter-section .form-control,
    .filter-section .form-select {
        font-size: 0.9rem;
        padding: 0.5rem;
        height: auto;
    }

    /* Month buttons optimization */
    .month-btn {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
        margin: 0.2rem;
    }

    /* Improve spacing */
    .container-fluid {
        padding: 0.5rem;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    /* Make date picker more mobile friendly */
    .daterangepicker {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        margin: 0 !important;
        width: 90% !important;
        max-width: 320px !important;
        z-index: 9999 !important;
    }
    
    .daterangepicker .drp-calendar {
        max-width: 100% !important;
        padding: 4px !important;
    }
    
    .daterangepicker .drp-calendar.left, 
    .daterangepicker .drp-calendar.right {
        clear: both !important;
        margin: 0 auto !important;
        float: none !important;
    }
    
    .daterangepicker .ranges {
        width: 100% !important;
        margin: 0 !important;
        padding: 4px !important;
    }
    
    .daterangepicker.show-calendar .ranges {
        margin-top: 4px !important;
    }

    /* Ensure calendar fits on screen */
    .daterangepicker .calendar-table {
        font-size: 14px !important;
    }
}

/* Desktop table column widths */
@media (min-width: 769px) {
    .table th[data-sort="date"],
    .table th[data-sort="closed_date"],
    .table td[data-label="Date Opened (UTC)"],
    .table td[data-label="Date Closed (UTC)"] {
        width: 12%;
        min-width: 120px;
    }
    .table th[data-sort="symbol"],
    .table td[data-label="Symbol"] {
        width: 20%;
    }
    .table th[data-sort="direction"],
    .table td[data-label="Direction"] {
        width: 18%;
    }
    .table th[data-sort="profit"],
    .table td[data-label="Peak Profit"] {
        width: 18%;
    }
    .table th[data-sort="leverage"],
    .table td[data-label="Leverage"] {
        width: 10%;
        min-width: 80px;
    }
}

/* Leverage badge styling - Glass Morphism Effect */
.leverage-badge {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* Safari support */
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #c9d1d9;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    display: inline-block;
    text-align: center;
    min-width: 45px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.leverage-badge:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Update badges styling */
.update-info {
    padding: 1.25rem;
    background-color: #161b22;
    border-radius: 12px;
    border: 1px solid #30363d;
    margin: 0.5rem 0 1.5rem;
}
.update-badge {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background-color: #21262d;
    border-radius: 8px;
    font-size: 1.1rem;
    color: #8b949e;
    position: relative;
    transition: all 0.2s ease;
    min-width: 200px;
}
.update-badge:hover {
    background-color: #2d333b;
    border-color: #444c56;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Pulse dot animations */
.pulse-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: relative;
}
.pulse-dot.pulse-success {
    background-color: #238636;
    box-shadow: 0 0 10px rgba(35, 134, 54, 0.4);
}
.pulse-dot.pulse-warning {
    background-color: #f85149;
    box-shadow: 0 0 10px rgba(248, 81, 73, 0.4);
}
.pulse-dot::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border-radius: 50%;
    animation: pulse 2s infinite;
}
.pulse-dot.pulse-success::after {
    background-color: #238636;
    animation: pulse-success 2s infinite;
    box-shadow: 0 0 10px rgba(35, 134, 54, 0.4);
}
.pulse-dot.pulse-warning::after {
    background-color: #f85149;
    animation: pulse-warning 2s infinite;
    box-shadow: 0 0 10px rgba(248, 81, 73, 0.4);
}
@keyframes pulse-success {
    0% {
        transform: scale(1);
        opacity: 0.8;
        box-shadow: 0 0 0 0 rgba(35, 134, 54, 0.4);
    }
    70% {
        transform: scale(2);
        opacity: 0;
        box-shadow: 0 0 0 10px rgba(35, 134, 54, 0);
    }
    100% {
        transform: scale(2);
        opacity: 0;
        box-shadow: 0 0 0 0 rgba(35, 134, 54, 0);
    }
}
@keyframes pulse-warning {
    0% {
        transform: scale(1);
        opacity: 0.8;
        box-shadow: 0 0 0 0 rgba(248, 81, 73, 0.4);
    }
    70% {
        transform: scale(2.5);
        opacity: 0;
        box-shadow: 0 0 0 10px rgba(248, 81, 73, 0);
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
        box-shadow: 0 0 0 0 rgba(248, 81, 73, 0);
    }
}

/* Update time text styling */
#lastUpdate, #nextUpdate {
    font-weight: 500;
    color: #c9d1d9;
    margin-left: 0.5rem;
}

/* Telegram Join Button Styles */
.telegram-cta {
    background: linear-gradient(45deg, #0088cc, #00a2ff);
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 136, 204, 0.3);
    margin: 1rem 0 2rem;
}

.telegram-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 136, 204, 0.4);
    color: white;
    background: linear-gradient(45deg, #0099e6, #00b3ff);
}

.telegram-cta:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 136, 204, 0.3);
}

.telegram-cta .members-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
}

@media (max-width: 768px) {
    .telegram-cta {
        padding: 0.75rem 1.5rem;
        font-size: 1.1rem;
    }
}

/* Mobile update styling */
@media (max-width: 768px) {
    .update-info {
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem;
    }
    .update-badge {
        font-size: 1rem;
        padding: 0.75rem 1rem;
        min-width: 150px;
    }
}

/* Loading styles */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 17, 23, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    border: 4px solid #30363d;
    border-top: 4px solid #238636;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Month button styles */
.month-btn {
    background-color: #21262d;
    border-color: #30363d;
    color: #c9d1d9;
    transition: all 0.2s ease;
    min-width: 120px;
}
.month-btn:hover {
    background-color: #30363d;
    border-color: #8b949e;
    color: #ffffff;
}
.month-btn.active {
    background-color: #238636;
    border-color: #238636;
    color: #ffffff;
}

/* Direction button styles - exact match to form-control for perfect alignment */
.direction-btn {
    background-color: #21262d;
    border-color: #30363d;
    color: #c9d1d9;
    transition: all 0.2s ease;
    
    /* Match form-control exactly */
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    border: 1px solid #30363d;
    border-radius: 0.375rem;
    
    /* Button-specific */
    min-width: auto;
    text-align: center;
    display: inline-block;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
}
.direction-btn:hover {
    background-color: #30363d;
    border-color: #8b949e;
    color: #ffffff;
}
.direction-btn.active {
    background-color: #238636;
    border-color: #238636;
    color: #ffffff;
}

/* Remove the custom height and flex styling that was causing issues */
.filter-section .btn-primary {
    /* Let it use Bootstrap's default sizing */
}

/* Responsive adjustments for direction buttons */
@media (max-width: 768px) {
    .direction-btn {
        padding: 0.25rem 0.375rem;
        font-size: 0.8rem;
    }
} 

/* Add CSS for virtual scrolling optimizations */

/* Optimize table rendering for virtual scrolling */
.table-responsive {
    position: relative;
    will-change: scroll-position;
    transform: translateZ(0); /* Force hardware acceleration */
}

.table tbody tr.virtual-spacer {
    /* Virtual spacer rows for efficient scrolling */
    pointer-events: none;
    user-select: none;
}

.table tbody tr.virtual-spacer td {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

/* Optimize trade rows for better scrolling performance */
.trade-row {
    will-change: transform;
    transform: translateZ(0); /* Force GPU compositing */
    backface-visibility: hidden;
}

/* Smooth scroll behavior for virtual scrolling */
@supports (scroll-behavior: smooth) {
    .table-responsive {
        scroll-behavior: auto; /* Disable smooth scroll for virtual scrolling performance */
    }
}

/* Virtual scroll indicators */
.virtual-scroll-info {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.virtual-scroll-info.visible {
    opacity: 1;
}

/* Performance optimizations for large datasets */
.table {
    contain: layout style paint;
}

.table tbody {
    contain: layout style;
}

/* Optimize icon loading during virtual scroll */
.trade-row img {
    image-rendering: optimizeSpeed;
    image-rendering: -webkit-optimize-contrast;
    transform: translateZ(0);
}

/* Smooth loading indicator for virtual scroll */
.loading-spinner {
    will-change: transform;
    transform: translateZ(0);
}

/* Hide scrollbar on mobile for better virtual scroll experience */
@media (max-width: 768px) {
    .table-responsive {
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    }
    
    .table-responsive::-webkit-scrollbar {
        width: 4px;
    }
    
    .table-responsive::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .table-responsive::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }
}

/* Optimize animations for virtual scrolling */
@media (prefers-reduced-motion: no-preference) {
    .trade-row {
        animation: fadeInUp 0.3s ease-out forwards;
        opacity: 0;
        transform: translateY(20px);
    }
    
    /* Disable animations during virtual scroll for performance */
    .virtual-scrolling .trade-row {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

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

/* Large dataset performance indicators */
.performance-mode-indicator {
    position: absolute;
    top: -25px;
    right: 0;
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
}

.performance-mode-indicator::before {
    content: "🚀";
    margin-right: 4px;
} 