/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1f2e 50%, #0f1419 100%);
    min-height: 100vh;
    color: #e2e8f0;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background: rgba(15, 20, 25, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    padding: 1rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header h1 {
    color: #60a5fa;
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header h1 i {
    color: #3b82f6;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.period-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.period-selector label {
    font-weight: 600;
    color: #94a3b8;
    font-size: 0.9rem;
}

.period-selector select {
    padding: 0.5rem 1rem;
    border: 2px solid #334155;
    border-radius: 8px;
    background: #1e293b;
    font-size: 0.9rem;
    font-weight: 500;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-selector select:hover {
    border-color: #3b82f6;
    background: #1e293b;
}

.period-selector select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    padding: 0.5rem 1rem;
    padding-right: 2.5rem;
    border: 2px solid #334155;
    border-radius: 8px;
    background: #1e293b;
    font-size: 0.9rem;
    width: 250px;
    color: #e2e8f0;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-box input::placeholder {
    color: #64748b;
}

.search-box i {
    position: absolute;
    right: 0.75rem;
    color: #64748b;
    pointer-events: none;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Dashboard Section */
.dashboard-section {
    background: rgba(15, 20, 25, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #334155;
}

.section-header h2 {
    color: #f1f5f9;
    font-size: 1.5rem;
    font-weight: 700;
}

.stats-summary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.stats-summary.filtered {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.stats-summary.filtered::before {
    content: "🔍 ";
    margin-right: 0.25rem;
}

/* Filters Section */
.filters-section {
    background: rgba(30, 41, 59, 0.8);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #334155;
    backdrop-filter: blur(10px);
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #334155;
}

.filters-header h3 {
    color: #f1f5f9;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filters-header h3 i {
    color: #3b82f6;
}

.filter-status {
    display: flex;
    align-items: center;
}

.filter-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}

.filters-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 180px;
    flex: 1;
}

.filter-group label {
    font-weight: 600;
    color: #94a3b8;
    font-size: 0.9rem;
    cursor: help;
    position: relative;
}

.filter-group label:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 0.5rem;
}

.filter-group label:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    margin-bottom: -5px;
    z-index: 1000;
}

.filter-group input {
    padding: 0.75rem 1rem;
    border: 2px solid #334155;
    border-radius: 8px;
    background: #1e293b;
    font-size: 0.9rem;
    font-weight: 500;
    color: #e2e8f0;
    transition: all 0.2s ease;
}

.filter-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.filter-group input:hover {
    border-color: #475569;
}

.filters-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    align-items: center;
}

.filters-actions .btn {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filters-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Responsive design for filters */
@media (max-width: 1200px) {
    .filters-row {
        gap: 1rem;
    }
    
    .filter-group {
        min-width: 160px;
    }
}

@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .filters-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .filters-actions .btn {
        min-width: 140px;
    }
}

/* Main Table */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid #334155;
}

.main-table {
    width: 100%;
    border-collapse: collapse;
    background: #0f1419;
    font-size: 0.9rem;
}

.main-table th,
.main-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #334155;
}

.main-table th {
    background: #1e293b;
    font-weight: 600;
    color: #94a3b8;
    font-size: 0.9rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.main-table tbody tr {
    transition: all 0.2s ease;
    cursor: pointer;
}

.main-table tbody tr:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.main-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table Cell Styles */
.rank-cell {
    font-weight: 700;
    color: #3b82f6;
    text-align: center;
}

.wallet-cell {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #cbd5e1;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pnl-cell {
    font-weight: 700;
    font-size: 1rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    letter-spacing: 0.5px;
}

.pnl-positive {
    color: #10b981;
}

.pnl-negative {
    color: #ef4444;
}

/* Order Type Color Coding */
.order-long {
    color: #10b981;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    transition: all 0.2s ease;
}

.order-long:hover {
    background: rgba(16, 185, 129, 0.2);
    transform: scale(1.05);
}

.order-short {
    color: #ef4444;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    transition: all 0.2s ease;
}

.order-short:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.05);
}

/* Fill Type Color Coding */
.fill-close-long {
    color: #10b981;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    transition: all 0.2s ease;
}

.fill-close-long:hover {
    background: rgba(16, 185, 129, 0.2);
    transform: scale(1.05);
}

.fill-close-short {
    color: #ef4444;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    transition: all 0.2s ease;
}

.fill-close-short:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.05);
}

/* PnL Color Coding for Data Tables */
.data-table .pnl-positive {
    color: #10b981;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    transition: all 0.2s ease;
}

.data-table .pnl-positive:hover {
    background: rgba(16, 185, 129, 0.2);
    transform: scale(1.05);
}

.data-table .pnl-negative {
    color: #ef4444;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    transition: all 0.2s ease;
}

.data-table .pnl-negative:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.05);
}

/* ROI Color Coding */
.roi-positive {
    color: #10b981;
    font-weight: 600;
}

.roi-negative {
    color: #ef4444;
    font-weight: 600;
}

/* ROI Color Coding for Data Tables - Same as PnL */
.data-table .roi-positive {
    color: #10b981;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    transition: all 0.2s ease;
}

.data-table .roi-positive:hover {
    background: rgba(16, 185, 129, 0.2);
    transform: scale(1.05);
}

.data-table .roi-negative {
    color: #ef4444;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    transition: all 0.2s ease;
}

.data-table .roi-negative:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.05);
}

/* PnL Color Coding for Overview Cards - Text only */
.overview-value.pnl-positive {
    color: #10b981;
    font-weight: 600;
}

.overview-value.pnl-negative {
    color: #ef4444;
    font-weight: 600;
}

.volume-cell,
.trades-cell,
.winrate-cell,
.avgtrade-cell {
    text-align: center;
    font-weight: 500;
    color: #cbd5e1;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.trading-days-cell {
    text-align: center;
    font-weight: 500;
    color: #cbd5e1;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.coins-cell {
    text-align: center;
    font-weight: 500;
    color: #cbd5e1;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.roi-positive {
    color: #10b981;
}

.roi-negative {
    color: #ef4444;
}

.actions-cell {
    text-align: center;
}

/* Trader Details Page */
.trader-details-page {
    background: rgba(15, 20, 25, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #334155;
}

.page-header h2 {
    color: #f1f5f9;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Trader Overview */
.trader-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Responsive grid adjustments */
@media (max-width: 1200px) {
    .trader-overview {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .trader-overview {
        grid-template-columns: 1fr;
    }
}

.overview-card {
    background: linear-gradient(135deg, #1e293b, #334155);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #475569;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.overview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    border-color: #3b82f6;
}

.overview-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #f1f5f9;
    margin-bottom: 0.5rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    letter-spacing: 0.5px;
}

.overview-label {
    font-size: 0.9rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tabs */
.tabs-container {
    background: #0f1419;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid #334155;
}

.tabs-header {
    display: flex;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

.tab-button {
    flex: 1;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-button:hover {
    background: #334155;
    color: #e2e8f0;
}

.tab-button.active {
    background: #0f1419;
    color: #3b82f6;
    border-bottom: 3px solid #3b82f6;
}

.tab-content {
    padding: 2rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #334155;
    gap: 0.5rem;
}

.tab-header h3 {
    color: #f1f5f9;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.tab-header span {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    white-space: nowrap;
    flex-shrink: 0;
}

.count-badge {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.count-badge span {
    background: none;
    padding: 0;
    box-shadow: none;
    color: white;
    font-weight: 700;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #0f1419;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid #334155;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #334155;
}

.data-table th {
    background: #1e293b;
    font-weight: 600;
    color: #94a3b8;
    font-size: 0.9rem;
}

.data-table td {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

/* Ensure colored cells maintain proper alignment */
.data-table td.order-long,
.data-table td.order-short,
.data-table td.fill-close-long,
.data-table td.fill-close-short,
.data-table td.pnl-positive,
.data-table td.pnl-negative,
.data-table td.roi-positive,
.data-table td.roi-negative {
    text-align: center;
    vertical-align: middle;
}

.data-table tr:hover {
    background: #1e293b;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: #475569;
    color: #e2e8f0;
    border: 1px solid #64748b;
}

.btn-secondary:hover {
    background: #64748b;
    border-color: #94a3b8;
}

.btn-ai {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    border: 1px solid #a78bfa;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-ai:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.btn-ai::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-ai:hover::before {
    left: 100%;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 20, 25, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-spinner.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #334155;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .header-controls {
        justify-content: center;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .main-table th,
    .main-table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .trader-overview {
        grid-template-columns: 1fr;
    }
    
    .tabs-header {
        flex-direction: column;
    }
    
    .tab-button {
        border-bottom: 1px solid #334155;
    }
    
    .tab-button.active {
        border-bottom: 3px solid #3b82f6;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .dashboard-section,
    .trader-details-page {
        padding: 1rem;
    }
}

/* ROI Color Coding for Overview Cards - Same as Total PnL */
.overview-value.roi-positive {
    color: #10b981 !important;
    font-weight: 600;
}

.overview-value.roi-negative {
    color: #ef4444 !important;
    font-weight: 600;
}

