/* Bot Commander V7 - Epic Enhanced with Gradient Risk Slider */

:root {
    --bg-dark: #0d1117;
    --card-bg: #161b22;
    --border: #30363d;
    --text: #c9d1d9;
    --text-muted: #8b949e;
    --accent: #f0b90b;
    --green: #238636;
    --red: #da3633;
    
    /* Risk Level Gradient Colors - White to Yellow to Red */
    --risk-1: #ffffff;
    --risk-2: #ffff99;
    --risk-3: #ffff00;
    --risk-4: #ff9900;
    --risk-5: #ff0000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Portfolio Header */
#portfolio-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

#balance-display {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.balance-amount {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.change-indicator {
    font-size: 1.125rem;
    font-weight: 600;
}

.change-indicator.up {
    color: var(--green);
}

.change-indicator.down {
    color: var(--red);
}

.mini-graph {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.mini-graph button {
    background: var(--border);
    border: none;
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.mini-graph button:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

/* AI Avatar Section */
#ai-avatar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-end;
}

#ai-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--accent);
}

.speech-bubble {
    background: var(--border);
    padding: 1rem;
    border-radius: 12px;
    max-width: 300px;
    position: relative;
    font-size: 0.9rem;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--border);
}

#ai-avatar input {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.75rem;
    border-radius: 8px;
    width: 100%;
    max-width: 300px;
}

/* Bot UI Area */
#bot-ui {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

#bot-slots {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bot-card {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.bot-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.bot-card.running {
    border-left: 4px solid var(--green);
}

/* Bot risk level color coding */
.bot-card.risk-1 { border-left: 4px solid var(--risk-1); }
.bot-card.risk-2 { border-left: 4px solid var(--risk-2); }
.bot-card.risk-3 { border-left: 4px solid var(--risk-3); }
.bot-card.risk-4 { border-left: 4px solid var(--risk-4); }
.bot-card.risk-5 { border-left: 4px solid var(--risk-5); }

.bot-card.empty {
    border: 2px dashed var(--border);
    justify-content: center;
    opacity: 0.6;
}

.bot-card.empty .bot-name {
    text-align: center;
    color: var(--text-muted);
}

.bot-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.bot-allocation {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.bot-pnl {
    font-weight: 600;
    text-align: right;
}

.bot-pnl.up {
    color: var(--green);
}

.bot-pnl.down {
    color: var(--red);
}

.run-bot, .remove-bot {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.run-bot:hover {
    background: var(--green);
    border-color: var(--green);
}

.remove-bot:hover {
    background: var(--red);
    border-color: var(--red);
}

/* Control Panel */
#control-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content;
}

.risk-meter {
    margin-bottom: 2rem;
}

.risk-meter label {
    display: block;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.warning-icon {
    font-size: 0.9rem;
    color: var(--red);
    margin-left: 0.5rem;
}

/* Gradient Risk Slider */
#risk-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, 
        var(--risk-1) 0%, 
        var(--risk-2) 25%, 
        var(--risk-3) 50%, 
        var(--risk-4) 75%, 
        var(--risk-5) 100%);
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 1rem;
}

#risk-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

#risk-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(240, 185, 11, 0.4);
}

#risk-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.roi-tag {
    background: var(--accent);
    color: var(--bg-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 1rem;
}

.strategy-icons {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.risk-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.risk-icon:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
}

.risk-icon.active {
    border-color: var(--accent);
    background: rgba(240, 185, 11, 0.1);
    box-shadow: 0 0 15px rgba(240, 185, 11, 0.3);
}

.risk-warning {
    background: rgba(218, 54, 51, 0.1);
    border: 1px solid var(--red);
    color: var(--red);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
}

/* Add Bot Controls */
.add-bot-controls {
    display: flex;
    gap: 1rem;
}

.add-bot-controls input {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.75rem;
    border-radius: 8px;
    width: 100px;
}

.add-bot {
    background: linear-gradient(135deg, var(--accent), #ffd700);
    border: none;
    color: var(--bg-dark);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.add-bot:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(240, 185, 11, 0.3);
}

.add-bot.shimmer {
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Upgrade Notice */
.upgrade-notice {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
}

.upgrade-notice a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.upgrade-notice a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    #portfolio-header {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    #bot-ui {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .bot-card {
        grid-template-columns: 1fr auto;
        gap: 0.5rem;
    }
    
    .bot-allocation, .bot-pnl {
        font-size: 0.8rem;
    }
}

/* V15 Live Trading Enhancements */
/* PnL styling */
.bot-pnl.up {
    color: #2ecc71;
    font-weight: 600;
}

.bot-pnl.down {
    color: #e74c3c;
    font-weight: 600;
}

.bot-pnl {
    font-size: 0.9em;
    margin: 4px 0;
}

/* Change indicator styling */
.change-indicator.up {
    color: #2ecc71;
}

.change-indicator.down {
    color: #e74c3c;
}

/* Loading states */
.loading-indicator {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
}

/* Risk level color coding for bot cards */
.bot-card.risk-1 {
    border-left: 4px solid #ffffff;
}

.bot-card.risk-2 {
    border-left: 4px solid #ffff99;
}

.bot-card.risk-3 {
    border-left: 4px solid #ffff00;
}

.bot-card.risk-4 {
    border-left: 4px solid #ff9900;
}

.bot-card.risk-5 {
    border-left: 4px solid #ff0000;
}

/* Live update animations */
.bot-card.running {
    transition: all 0.3s ease;
}

.bot-card.running:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}