.profiles-section {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.profiles-header {
    padding: 15px 20px;
    background-color: #252526;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background-color 0.2s;
}

.profiles-header:hover {
    background-color: #2a2d2e;
}

.profiles-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #e0e0e0;
}

.toggle-icon {
    font-size: 1.2rem;
    color: #888;
    transition: transform 0.3s ease;
}

.profiles-section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.profiles-body {
    padding: 20px;
    display: block;
    border-top: 1px solid #333;
}

.profiles-section.collapsed .profiles-body {
    display: none;
}

.profiles-controls {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 0.9rem;
    color: #aaa;
}

.profile-select {
    padding: 8px 12px;
    background-color: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    color: #e0e0e0;
    min-width: 200px;
    font-size: 1rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 35px;
    cursor: pointer;
}

.profile-select:focus {
    border-color: #30a14e;
    background-color: #333;
    outline: none;
}

.btn-profile {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
}

.btn-new { background-color: #30a14e; }
.btn-new:hover { background-color: #2ea043; }

.btn-edit { background-color: #1f6feb; }
.btn-edit:hover { background-color: #388bfd; }

.btn-delete { background-color: #da3633; }
.btn-delete:hover { background-color: #f85149; }

.market-name {
    font-weight: bold;
    color: #e0e0e0;
}

.btn-icon-delete {
    background-color: #da3633;
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.2s;
    padding: 0;
}

.btn-icon-delete:hover {
    background-color: #f85149;
}

.market-simulation-item {
    background-color: #2d2d2d;
    border: 1px solid #444;
    border-radius: 4px;
    margin-top: 10px;
    overflow: visible;
}

.market-sim-header {
    background-color: #333;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
    cursor: pointer;
    user-select: none;
}

.market-sim-header:hover {
    background-color: #3a3a3a;
}

.market-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-icon-market {
    font-size: 0.8rem;
    color: #888;
    transition: transform 0.2s;
}

.market-simulation-item.active .toggle-icon-market {
    transform: rotate(90deg);
}

.market-sim-body {
    padding: 10px;
    color: #ccc;
    font-size: 0.9rem;
    display: block;
    border-top: 1px solid #444;
    background-color: #252526;
}

.market-sim-body.collapsed {
    display: none;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.config-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.config-group.full-width {
    grid-column: 1 / -1;
}

.config-group label {
    font-size: 0.8rem;
    color: #aaa;
}

.input-sm {
    padding: 4px 6px;
    font-size: 0.85rem;
}

.input-field {
    padding: 6px 10px;
    background-color: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    color: #e0e0e0;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem;
    transition: border-color 0.2s, background-color 0.2s;
}

.input-field:focus {
    border-color: #30a14e;
    background-color: #333;
    outline: none;
}

select.input-field {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 35px;
    cursor: pointer;
}

.market-dropdown-container {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #2d2d2d;
    border: 1px solid #444;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 9999; /* Aumentado para asegurar visibilidad */
    min-width: 180px;
    margin-top: 5px;
}

.market-dropdown-container.hidden {
    display: none;
}

.market-dropdown-item {
    padding: 10px 15px;
    color: #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.market-dropdown-item:hover {
    background-color: #3a3a3a;
}

.market-dropdown-item:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.market-dropdown-item:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.markets-config-section {
    margin-bottom: 20px;
}

/* Simulation Results & Charts */
.simulation-results {
    border-top: 1px solid #444;
    margin-top: 20px;
    padding-top: 20px;
}

.simulation-results.hidden {
    display: none;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.chart-container {
    background-color: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 10px;
    height: 300px;
    position: relative;
}

.btn-simular {
    background-color: #238636;
    font-size: 1rem;
    padding: 10px;
}

.btn-simular:hover {
    background-color: #2ea043;
}

/* Summary panel above charts */
.summary-panel {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    color: #ddd;
    font-size: 0.95rem;
    flex-wrap: wrap;
    align-items: flex-start;
    overflow: visible;
}
.summary-item {
    background: #232323;
    border: 1px solid #3a3a3a;
    padding: 10px 14px;
    border-radius: 6px;
    min-width: 140px;
    max-width: 280px;
}
.summary-item .label { color: #aaa; font-size: 0.8rem; }
.summary-item .value { color: #fff; font-weight: 600; font-size: 1.05rem; margin-top: 4px; }

/* Positive / negative value colors */
.summary-item .value.positive { color: #30a14e; }
.summary-item .value.negative { color: #ff4d4f; }
.summary-item .label.small { font-size: 0.75rem; color: #999; }

.chart-legend-inline { display:flex; align-items:center; gap:8px }
.chart-legend-inline .swatch { width:14px; height:10px; border-radius:3px; display:inline-block }
