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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background-dark: #0f172a;
    --background-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--background-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

/* Header */
.header {
    background: var(--background-card);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 1.5rem;
}

.connect-wallet-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.connect-wallet-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.connect-wallet-btn:active {
    transform: scale(0.98);
}

/* Main Content */
.main-content {
    padding: 1rem;
    padding-bottom: 5rem;
}

/* Network Status */
.network-status {
    background: var(--background-card);
    padding: 1rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.status-indicator.online {
    background: var(--secondary-color);
    box-shadow: 0 0 10px var(--secondary-color);
    animation: pulse 2s infinite;
}

.gas-price {
    margin-left: auto;
    color: var(--primary-color);
    font-weight: 600;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Stats Cards */
.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--background-card);
    padding: 1rem 0.8rem;
    border-radius: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    font-size: 1.2rem;
}

.stat-icon.profit {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.stat-icon.transactions {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.stat-icon.attacks {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* MEV Types */
.mev-types {
    margin-bottom: 1.5rem;
}

.mev-types h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

.type-card {
    background: var(--background-card);
    padding: 1.2rem 1rem;
    border-radius: 1rem;
    text-align: center;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
}

.type-card.active {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.type-icon {
    width: 50px;
    height: 50px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.8rem;
    font-size: 1.5rem;
}

.type-icon.sandwich {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.type-icon.arbitrage {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.type-icon.liquidation {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.type-icon.frontrun {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.type-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.type-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Activity Section */
.activity-section {
    margin-bottom: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    font-size: 1.1rem;
}

.filter-btn {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.activity-item {
    background: var(--background-card);
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.activity-icon {
    width: 45px;
    height: 45px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.sandwich {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.activity-icon.arbitrage {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.activity-icon.liquidation {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.activity-icon.frontrun {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.activity-details {
    flex: 1;
    min-width: 0;
}

.activity-type {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.activity-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
    background: var(--primary-color);
    color: white;
}

.activity-address {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    word-break: break-all;
}

.activity-profit {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.2rem;
}

.activity-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Chart Section */
.chart-section {
    margin-bottom: 1.5rem;
}

.chart-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.chart-container {
    background: var(--background-card);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    height: 250px;
    margin-bottom: 1rem;
    position: relative;
}

#profitChart {
    width: 100%;
    height: 100%;
}

.chart-timeframes {
    display: flex;
    gap: 0.5rem;
}

.timeframe-btn {
    flex: 1;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.timeframe-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.timeframe-btn:hover:not(.active) {
    background: rgba(99, 102, 241, 0.1);
}

/* Settings Section */
.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--background-card);
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    margin-bottom: 0.8rem;
}

.settings-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.95rem;
}

.settings-info i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    background: var(--background-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 100;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    transition: color 0.2s;
}

.nav-item i {
    font-size: 1.3rem;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item:hover {
    color: var(--primary-color);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 480px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .type-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        display: flex;
        align-items: center;
        text-align: left;
        padding: 1rem;
    }
    
    .stat-icon {
        margin: 0 1rem 0 0;
    }
    
    .type-card {
        display: flex;
        align-items: center;
        text-align: left;
        padding: 1rem;
        gap: 1rem;
    }
    
    .type-icon {
        margin: 0;
    }
}

/* Capital Section */
.capital-section {
    margin-bottom: 1.5rem;
}

.capital-card {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
}

.capital-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.capital-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.capital-info {
    flex: 1;
}

.capital-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.3rem;
}

.capital-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
}

.recharge-btn {
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.recharge-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.capital-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.capital-stat {
    text-align: center;
}

.capital-stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.3rem;
}

.capital-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--background-card);
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

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

.modal-body {
    padding: 1.5rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

.quick-amounts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.quick-amount-btn {
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-amount-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.balance-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--background-dark);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.balance-info span:last-child {
    color: var(--primary-color);
    font-weight: 600;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.modal-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn.cancel {
    background: var(--background-dark);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.modal-btn.cancel:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-color: var(--danger-color);
}

.modal-btn.confirm {
    background: var(--primary-color);
    color: white;
}

.modal-btn.confirm:hover {
    background: var(--primary-dark);
}

@media (max-width: 480px) {
    .capital-header {
        flex-direction: column;
        text-align: center;
    }
    
    .capital-info {
        text-align: center;
    }
    
    .recharge-btn {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
    }
}
