:root { --primary: #f59e0b; --bg: #0b1120; --card: #1e293b; --text: #f8fafc; --success: #10b981; --danger: #ef4444; --info: #3b82f6; --gray: #94a3b8; }
        body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); margin: 0; padding: 20px; }
        
        .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
        .market-badge { padding: 6px 12px; border-radius: 8px; font-size: 0.75rem; font-weight: bold; border: 1px solid rgba(255,255,255,0.1); }
        .mode-panic { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border-color: var(--danger); }
        .mode-protect { background: rgba(59, 130, 246, 0.2); color: #93c5fd; border-color: var(--info); }
        .mode-agressive { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border-color: var(--success); }

        .stats-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-bottom: 20px; }
        .kpi-card { background: var(--card); padding: 15px; border-radius: 12px; border: 1px solid #334155; text-align: center; }
        .kpi-value { display: block; font-size: 1.2rem; font-weight: bold; color: var(--primary); }
        .kpi-label { font-size: 0.65rem; color: var(--gray); text-transform: uppercase; }

        #active-trades-section { margin-bottom: 30px; }
        .active-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; }
        .active-card { background: linear-gradient(145deg, #1e293b, #0f172a); border: 1px solid var(--info); border-radius: 12px; padding: 15px; border-left: 4px solid var(--info); }

        .grid-container { background: var(--card); border-radius: 12px; border: 1px solid #334155; overflow: hidden; margin-bottom: 30px; }
        table { width: 100%; border-collapse: collapse; text-align: left; }
        th { background: #0f172a; padding: 15px; font-size: 0.75rem; color: var(--gray); text-transform: uppercase; }
        td { padding: 12px 15px; border-bottom: 1px solid #334155; font-size: 0.85rem; }
        
        .price { font-family: 'monospace'; font-weight: 600; }
        
        .sort-btn { border:1px solid var(--gray); background:transparent; color:var(--gray); padding: 4px 8px; border-radius: 6px; font-size:0.7rem; font-weight:bold; cursor:pointer; transition: all 0.2s ease-in-out; }
        .sort-btn.active { border-color: var(--primary); background: var(--primary); color: var(--bg); }

        .modal { 
            display: none; /* Hidden by default */
            position: fixed; 
            z-index: 1000; 
            left: 0; 
            top: 0; 
            width: 100%; 
            height: 100%; 
            background: rgba(0,0,0,0.85); 
            backdrop-filter: blur(4px);
            /* Flexbox properties for when it's displayed */
            justify-content: center;
            align-items: center;
        }
        .modal-content { 
            background: var(--card); 
            position: relative; /* Keep relative for stacking context */
            padding: 25px; 
            border-radius: 15px; 
            width: 90%; 
            max-width: 600px;
            height: 90vh;
            display: flex;
            flex-direction: column;
            border: 1px solid var(--primary); 
            box-shadow: 0 0 30px rgba(0,0,0,0.5); 
            /* Removed margin and transform properties */
        }
        .modal-header { font-size: 1.1rem; font-weight: bold; color: var(--primary); border-bottom: 1px solid #334155; padding-bottom: 10px; margin-bottom: 15px; }
        .config-text { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; line-height: 1.6; color: #cbd5e1; white-space: pre-wrap; }
        .rr-info { margin-top: 15px; padding: 10px; background: rgba(59, 130, 246, 0.1); border-radius: 8px; font-size: 0.75rem; color: #93c5fd; border: 1px solid var(--info); }
        .close-btn {
            position: absolute;
            top: 10px;
            right: 15px;
            cursor: pointer;
            color: var(--gray);
            font-size: 1.8rem; /* Larger font size */
            font-weight: bold;
            line-height: 1;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%; /* Circular shape */
            transition: background-color 0.2s, color 0.2s;
        }
        .close-btn:hover {
            background-color: rgba(255, 255, 255, 0.1);
            color: var(--text);
        }
        .manual-close-btn { background: var(--danger); color: white; border: none; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: bold; text-align: center; }

        .heatmap-bar { background: #334155; height: 6px; border-radius: 3px; width: 100%; margin-top: 12px; overflow: hidden; }
        .heatmap-bar-inner { height: 100%; border-radius: 3px; transition: width 0.5s ease, background-color 0.5s ease; }
        
        #loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg); display: flex; justify-content: center; align-items: center; z-index: 9999; transition: opacity 0.5s ease; }
        .spinner { border: 4px solid rgba(255, 255, 255, 0.1); width: 36px; height: 36px; border-radius: 50%; border-left-color: var(--primary); animation: spin 1s ease infinite; }
        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

        .stale-trade {
            animation: stale-pulse 2.5s infinite;
            border-color: var(--primary);
        }

        @keyframes stale-pulse {
            0% {
                box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
            }
            70% {
                box-shadow: 0 0 5px 8px rgba(245, 158, 11, 0);
            }
            100% {
                box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
            }
        }
        .spinner-small {
            display: inline-block;
            border: 2px solid rgba(255, 255, 255, 0.3);
            width: 14px;
            height: 14px;
            border-radius: 50%;
            border-left-color: #fff;
            animation: spin 1s ease infinite;
            vertical-align: middle;
            margin-right: 8px;
        }

        #fear-greed-container {
            max-width: 300px; /* Adjust as needed */
            margin: 20px auto;
        }

        .trade-type-icon {
            font-size: 0.8rem;
            margin-left: 8px;
            font-weight: bold;
        }

        #equity-chart-container {
            margin-bottom: 40px;
        }

        #modalBody { /* For scrollable content within the modal */
            flex-grow: 1;
            overflow-y: auto;
            padding-right: 15px; /* Space for scrollbar */
        }

        /* Custom Scrollbar for Modal Body */
        #modalBody::-webkit-scrollbar {
            width: 8px;
        }

        #modalBody::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.2);
            border-radius: 4px;
        }

        #modalBody::-webkit-scrollbar-thumb {
            background-color: var(--primary);
            border-radius: 4px;
            border: 2px solid transparent;
            background-clip: content-box;
        }

        #modalBody::-webkit-scrollbar-thumb:hover {
            background-color: #fca51a; /* A slightly lighter shade of primary for hover */
        }
/* --- Stale Trade Visuals --- */
.stale-trade {
    position: relative; /* Needed for the overlay */
    border-left-color: var(--primary) !important; /* Make border more prominent */
}

/* Add a semi-transparent overlay to stale cards */
.stale-trade::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(245, 158, 11, 0.05);
    border-radius: 12px;
    pointer-events: none; /* Allows clicking through the overlay */
}

.stale-indicator {
    display: inline-block;
    margin-right: 6px;
    color: var(--primary);
    animation: tick-tock 1.5s infinite;
}

@keyframes tick-tock {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-15deg); }
    100% { transform: rotate(0deg); }
}

/* Estilos para actualizaciones de Stop Loss */
.sl-updated {
    background-color: rgba(40, 167, 69, 0.1) !important;
    border-left: 4px solid #28a745 !important;
    animation: pulse-green 2s ease-in-out;
    transition: all 0.3s ease;
}

.sl-updated-modal {
    background-color: rgba(40, 167, 69, 0.15) !important;
    border: 2px solid #28a745 !important;
    animation: pulse-green 3s ease-in-out;
    transition: all 0.3s ease;
}

.sl-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10000;
    animation: slideIn 0.3s ease-out;
    max-width: 300px;
    font-size: 14px;
    border-left: 4px solid #20c997;
}

.sl-update-notification .notification-content {
    line-height: 1.4;
}

.sl-update-notification .notification-content strong {
    display: block;
    margin-bottom: 5px;
    font-size: 16px;
}

.sl-update-notification .notification-content small {
    opacity: 0.8;
    font-style: italic;
}

/* Animaciones */
@keyframes pulse-green {
    0% { background-color: rgba(40, 167, 69, 0); border-left-color: transparent; }
    50% { background-color: rgba(40, 167, 69, 0.2); border-left-color: #28a745; }
    100% { background-color: rgba(40, 167, 69, 0.1); border-left-color: #28a745; }
}

@keyframes slideIn {
    from { 
        transform: translateX(100%); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

