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

body {
    font-family: 'Inter', sans-serif;
    background-color: #0e1117;
    color: #fafafa;
    overflow-x: hidden;
}

.container {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    gap: 20px;
    padding: 20px;
}

/* Header */
.trading-header {
    grid-column: 1 / -1;
    background: linear-gradient(90deg, #1e2329 0%, #2b3139 100%);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid #00ff88;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.trading-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #00ff88, #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.trading-header p {
    font-size: 1.1rem;
    opacity: 0.8;
    font-weight: 300;
}

/* Sidebar */
.sidebar {
    background-color: #1e2329;
    border: 1px solid #2b3139;
    border-radius: 15px;
    padding: 25px;
    height: fit-content;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section h3 {
    color: #00ff88;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #b0b3b8;
}

.control-group select,
.control-group input[type="range"] {
    width: 100%;
    padding: 10px;
    background-color: #2b3139;
    border: 1px solid #404040;
    border-radius: 8px;
    color: #fafafa;
    font-size: 0.9rem;
}

.control-group select:focus,
.control-group input[type="range"]:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2);
}

.status-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 10px;
}

.status-indicator.active {
    background-color: #00ff88;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
}

.reset-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, #ff4757, #ff6b7a);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

/* Wallet Connection Styles */
.wallet-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, #00ff88, #00d4ff);
    border: none;
    border-radius: 8px;
    color: #0e1117;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.wallet-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.4);
}

.wallet-info {
    background-color: #2b3139;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.wallet-address,
.wallet-balance {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.wallet-label {
    color: #b0b3b8;
    font-weight: 500;
}

.wallet-value {
    color: #00ff88;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.disconnect-btn {
    width: 100%;
    padding: 8px;
    background: linear-gradient(45deg, #ff4757, #ff6b7a);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.disconnect-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(255, 71, 87, 0.3);
}

.wallet-network {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

/* Wallet Modal Styles */
.wallet-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.wallet-modal-content {
    background-color: #1e2329;
    border: 1px solid #2b3139;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.wallet-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #2b3139;
}

.wallet-modal-header h3 {
    color: #00ff88;
    margin: 0;
    font-size: 1.3rem;
}

.close-modal {
    background: none;
    border: none;
    color: #b0b3b8;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background-color: #2b3139;
    color: #ff4757;
}

.wallet-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wallet-option {
    display: flex;
    align-items: center;
    padding: 20px;
    background-color: #2b3139;
    border: 1px solid #404040;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.wallet-option:hover {
    border-color: #00ff88;
    background-color: #323842;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 255, 136, 0.1);
}

.wallet-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wallet-option.disabled:hover {
    border-color: #404040;
    background-color: #2b3139;
    transform: none;
    box-shadow: none;
}

.wallet-icon {
    width: 40px;
    height: 40px;
    margin-right: 15px;
    border-radius: 8px;
    object-fit: contain;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.wallet-icon img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: contain;
}

.trust-icon {
    background: linear-gradient(135deg, #3375BB, #4A90E2);
    color: white;
}

.okx-icon {
    background: linear-gradient(135deg, #000000, #333333);
    color: white;
}

.phantom-icon {
    background: linear-gradient(135deg, #AB9FF2, #6C5CE7);
    color: white;
}

.wallet-details {
    flex: 1;
}

.wallet-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fafafa;
    margin-bottom: 5px;
}

.wallet-description {
    font-size: 0.9rem;
    color: #b0b3b8;
}

.wallet-status {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 15px;
    white-space: nowrap;
}

.wallet-status.available {
    background-color: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.wallet-status.detecting {
    background-color: rgba(255, 165, 2, 0.2);
    color: #ffa502;
}

.wallet-status.unavailable {
    background-color: rgba(255, 71, 87, 0.2);
    color: #ff4757;
}

.wallet-modal-footer {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #2b3139;
    text-align: center;
}

.wallet-modal-footer p {
    color: #b0b3b8;
    font-size: 0.9rem;
    margin: 0;
}

.wallet-modal-footer a {
    color: #00ff88;
    text-decoration: none;
    font-weight: 500;
}

.wallet-modal-footer a:hover {
    color: #00d4ff;
    text-decoration: underline;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Metrics Row */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.metric-card {
    background-color: #1e2329;
    border: 1px solid #2b3139;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00ff88, #00d4ff);
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: #00ff88;
}

.metric-label {
    font-size: 0.85rem;
    color: #b0b3b8;
    margin-bottom: 8px;
    font-weight: 500;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 5px;
    font-family: 'JetBrains Mono', monospace;
}

.metric-change {
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.metric-change.positive {
    color: #00ff88;
}

.metric-change.negative {
    color: #ff4757;
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.chart-container,
.orderbook-container {
    background-color: #1e2329;
    border: 1px solid #2b3139;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.chart-container h3,
.orderbook-container h3 {
    color: #00ff88;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

#priceChart {
    height: 400px;
    width: 100%;
}

/* Order Book */
.orderbook {
    font-family: 'JetBrains Mono', monospace;
}

.orderbook-section {
    margin-bottom: 15px;
}

.orderbook-section h4 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: #b0b3b8;
}

.order-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.85rem;
}

.ask-price {
    color: #ff4757;
    font-weight: 600;
}

.bid-price {
    color: #00ff88;
    font-weight: 600;
}

.spread-display {
    text-align: center;
    padding: 15px 0;
    border-top: 1px solid #2b3139;
    border-bottom: 1px solid #2b3139;
    margin: 15px 0;
    font-family: 'JetBrains Mono', monospace;
    color: #00d4ff;
    font-weight: 600;
}

/* Bottom Row */
.bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.pnl-container,
.trades-container {
    background-color: #1e2329;
    border: 1px solid #2b3139;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.pnl-container h3,
.trades-container h3 {
    color: #00ff88;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

#pnlChart {
    height: 300px;
    width: 100%;
}

/* Trades Table */
.trades-table {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.trades-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #2b3139;
    font-weight: 600;
    color: #b0b3b8;
}

.trade-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(43, 49, 57, 0.5);
}

.trade-side-buy {
    color: #00ff88;
    font-weight: 600;
}

.trade-side-sell {
    color: #ff4757;
    font-weight: 600;
}

/* Market Analysis Panel */
.analysis-panel {
    background-color: #1e2329;
    border: 1px solid #2b3139;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.analysis-panel h3 {
    color: #00ff88;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

.analysis-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 1px solid #2b3139;
}

.tab-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: #b0b3b8;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #00ff88;
    border-bottom-color: #00ff88;
}

.tab-btn:hover {
    color: #00d4ff;
}

.tab-content {
    min-height: 300px;
}

.tab-pane {
    display: none;
}

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

/* Technical Indicators */
.indicators-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.indicator-card {
    background-color: #2b3139;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    border: 1px solid #404040;
}

.indicator-card h4 {
    color: #b0b3b8;
    font-size: 0.9rem;
    margin-bottom: 10px;
    font-weight: 500;
}

.indicator-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: 'JetBrains Mono', monospace;
    color: #fafafa;
}

.indicator-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.indicator-status.bullish {
    background-color: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.indicator-status.bearish {
    background-color: rgba(255, 71, 87, 0.2);
    color: #ff4757;
}

.indicator-status.neutral {
    background-color: rgba(176, 179, 184, 0.2);
    color: #b0b3b8;
}

.technical-chart {
    height: 300px;
    background-color: #2b3139;
    border-radius: 10px;
    border: 1px solid #404040;
}

/* Sentiment Analysis */
.sentiment-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.sentiment-card {
    background-color: #2b3139;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #404040;
}

.sentiment-card h4 {
    color: #00ff88;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.sentiment-meter {
    margin-bottom: 15px;
}

.meter-bar {
    width: 100%;
    height: 20px;
    background-color: #404040;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4757, #ffa502, #00ff88);
    transition: width 0.3s ease;
}

.meter-value {
    text-align: center;
    font-weight: 600;
    color: #fafafa;
    font-family: 'JetBrains Mono', monospace;
}

.social-metrics {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.social-metrics .metric {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #b0b3b8;
}

.social-metrics .positive {
    color: #00ff88;
    font-weight: 600;
}

.social-metrics .negative {
    color: #ff4757;
    font-weight: 600;
}

.social-metrics .neutral {
    color: #ffa502;
    font-weight: 600;
}

/* News Feed */
.news-feed {
    max-height: 400px;
    overflow-y: auto;
}

.news-item {
    display: grid;
    grid-template-columns: 100px 1fr 80px;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #2b3139;
    align-items: center;
}

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

.news-time {
    font-size: 0.8rem;
    color: #b0b3b8;
    font-family: 'JetBrains Mono', monospace;
}

.news-title {
    font-size: 0.9rem;
    color: #fafafa;
    font-weight: 500;
}

.news-impact {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
}

.news-impact.positive {
    background-color: rgba(0, 255, 136, 0.2);
    color: #00ff88;
}

.news-impact.negative {
    background-color: rgba(255, 71, 87, 0.2);
    color: #ff4757;
}

.news-impact.neutral {
    background-color: rgba(255, 165, 2, 0.2);
    color: #ffa502;
}

/* Correlation Matrix */
.correlation-matrix {
    height: 400px;
    background-color: #2b3139;
    border-radius: 10px;
    border: 1px solid #404040;
    padding: 10px;
    position: relative;
}

.correlation-chart {
    width: 100%;
    height: 100%;
    min-height: 380px;
    position: relative;
}

#correlationChartDiv {
    width: 100% !important;
    height: 100% !important;
}

/* Insights Row */
.insights-row {
    background-color: #1e2329;
    border: 1px solid #2b3139;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.insights-row h3 {
    color: #00ff88;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.insight-card {
    background-color: #0a0a0a;
    border: 1px solid #00ff88;
    border-radius: 10px;
    padding: 20px;
}

.terminal-text {
    font-family: 'JetBrains Mono', monospace;
    color: #00ff88;
    font-size: 0.85rem;
    line-height: 1.6;
}

.terminal-text strong {
    color: #00d4ff;
}

.terminal-text span {
    color: #fafafa;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }
    
    .sidebar {
        grid-row: 2;
    }
    
    .main-content {
        grid-row: 3;
    }
    
    .metrics-row {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .insights-grid {
        grid-template-columns: 1fr;
    }
    
    .indicators-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sentiment-grid {
        grid-template-columns: 1fr;
    }
    
    .analysis-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 768px) {
    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bottom-row {
        grid-template-columns: 1fr;
    }
    
    .trading-header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 10px;
        gap: 15px;
    }
    
    .indicators-grid {
        grid-template-columns: 1fr;
    }
    
    .analysis-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .news-item {
        grid-template-columns: 80px 1fr 60px;
        gap: 10px;
    }
    
    .news-title {
        font-size: 0.8rem;
    }
    
    .wallet-address .wallet-value {
        font-size: 0.75rem;
    }
}

/* Animations */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 255, 136, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0);
    }
}

.status-indicator.active {
    animation: pulse 2s infinite;
}

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

::-webkit-scrollbar-track {
    background: #1e2329;
}

::-webkit-scrollbar-thumb {
    background: #00ff88;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00d4ff;
}